You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2009/06/09 11:18:59 UTC
OSGI - camel spring bean - @Handler (java.lang.NullPointerException
at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197))
Hi,
When I use the following route :
<camel:route>
<camel:from ref="queueClientInEndpoint" />
<camel:choice>
<camel:when>
<camel:simple>${in.header.messageType} ==
'OINP'</camel:simple>
<!-- Call the requestService to save the request -->
<camel:bean ref="requestService"/>
</camel:when>
....
<!-- Request Service -->
<osgi:reference id="requestService"
interface="com.xpectis.x3s.platform.service.RequestService" />
@Handler
public void createRequest(@Header(value = "messageType") String
messageType, @Body String body, Exchange exchange) {
// Instantiate the Request class
Request request = new Request();
// Add the CSV records to the body field
request.setMessageContent(body.getBytes());
// Save the request in the DB
this.saveRequest(request);
// add the request object to the exchange
exchange.getOut().setBody(request);
}
, camel generates the following error :
Caused by: java.lang.NullPointerException
at
org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197)
at
org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:81)
at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:151)
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:104)
at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81)
Is the problem related to the fact that camel can't find the method where
@handler has been defined ?
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com
Re: OSGI - camel spring bean - @Handler (java.lang.NullPointerException
at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197))
Posted by Charles Moulliard <cm...@gmail.com>.
Yes. as showed in my initial email posted.
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com
On Tue, Jun 9, 2009 at 1:00 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Tue, Jun 9, 2009 at 12:03 PM, Charles Moulliard<cm...@gmail.com>
> wrote:
> > Complement of information :
> >
> > The service (which is packaged as bundle and is deployed as a spring OSGI
> > service) publish the interface
> >
> > <osgi:service ref="requestService"
> > interface="com.xpectis.x3s.platform.service.RequestService"/>
> >
> > while the class implementing the service is declared private and of
> course
> > is instantiated locally by spring.
> >
> > So we have two different bundles :
> >
> > A) one containing the routing and where camelContext is created
> >
> > B) the other which is the service
> >
> > Question : Can the following method of the bundle B) called while the
> > camelcontext runs in the bundle A) ?
>
> How does you route invoke this bean? Are you refering to it using the
> spring bean id?
>
>
> >
> > @Handler
> > public void createRequest(@Header(value = "messageType") String
> > messageType, @Body String body, Exchange exchange) {
> >
> > // Instantiate the Request class
> > Request request = new Request();
> >
> > // Add the CSV records to the body field
> > request.setMessageContent(body.getBytes());
> >
> > // Save the request in the DB
> > this.saveRequest(request);
> >
> > // add the request object to the exchange
> > exchange.getOut().setBody(request);
> >
> > }
> >
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
> >
> > On Tue, Jun 9, 2009 at 11:28 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> Hi
> >>
> >> Could be OSGi related. Can you try without OSGi.
> >> Just to get the fact straight.
> >>
> >> And I assume you use 2.0-SNAPSHOT.
> >>
> >>
> >> On Tue, Jun 9, 2009 at 11:18 AM, Charles Moulliard<cmoulliard@gmail.com
> >
> >> wrote:
> >> > Hi,
> >> >
> >> > When I use the following route :
> >> >
> >> > <camel:route>
> >> > <camel:from ref="queueClientInEndpoint" />
> >> > <camel:choice>
> >> > <camel:when>
> >> > <camel:simple>${in.header.messageType} ==
> >> > 'OINP'</camel:simple>
> >> > <!-- Call the requestService to save the request
> -->
> >> > <camel:bean ref="requestService"/>
> >> > </camel:when>
> >> > ....
> >> >
> >> > <!-- Request Service -->
> >> > <osgi:reference id="requestService"
> >> > interface="com.xpectis.x3s.platform.service.RequestService" />
> >> >
> >> > @Handler
> >> > public void createRequest(@Header(value = "messageType") String
> >> > messageType, @Body String body, Exchange exchange) {
> >> >
> >> > // Instantiate the Request class
> >> > Request request = new Request();
> >> >
> >> > // Add the CSV records to the body field
> >> > request.setMessageContent(body.getBytes());
> >> >
> >> > // Save the request in the DB
> >> > this.saveRequest(request);
> >> >
> >> > // add the request object to the exchange
> >> > exchange.getOut().setBody(request);
> >> >
> >> > }
> >> >
> >> > , camel generates the following error :
> >> >
> >> > Caused by: java.lang.NullPointerException
> >> > at
> >> >
> >>
> org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197)
> >> > at
> >> >
> >>
> org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:81)
> >> > at
> >> >
> >>
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:151)
> >> > at
> >> >
> >>
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:104)
> >> > at
> >> >
> >>
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> >> > at
> >> >
> >>
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> >> > at
> >> >
> >>
> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
> >> > at
> >> >
> >>
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> >> > at
> >> >
> >>
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> >> > at
> >> >
> >>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> >> > at
> >> >
> >>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> >> > at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
> >> > at
> >> >
> >>
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
> >> > at
> >> >
> >>
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
> >> > at
> >> >
> >>
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81)
> >> >
> >> > Is the problem related to the fact that camel can't find the method
> where
> >> > @handler has been defined ?
> >> >
> >> > Charles Moulliard
> >> > Senior Enterprise Architect
> >> > Apache Camel Committer
> >> >
> >> > *****************************
> >> > blog : http://cmoulliard.blogspot.com
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> Apache Camel Committer
> >>
> >> Open Source Integration: http://fusesource.com
> >> Blog: http://davsclaus.blogspot.com/
> >> Twitter: http://twitter.com/davsclaus
> >>
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
Re: OSGI - camel spring bean - @Handler (java.lang.NullPointerException
at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197))
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jun 9, 2009 at 12:03 PM, Charles Moulliard<cm...@gmail.com> wrote:
> Complement of information :
>
> The service (which is packaged as bundle and is deployed as a spring OSGI
> service) publish the interface
>
> <osgi:service ref="requestService"
> interface="com.xpectis.x3s.platform.service.RequestService"/>
>
> while the class implementing the service is declared private and of course
> is instantiated locally by spring.
>
> So we have two different bundles :
>
> A) one containing the routing and where camelContext is created
>
> B) the other which is the service
>
> Question : Can the following method of the bundle B) called while the
> camelcontext runs in the bundle A) ?
How does you route invoke this bean? Are you refering to it using the
spring bean id?
>
> @Handler
> public void createRequest(@Header(value = "messageType") String
> messageType, @Body String body, Exchange exchange) {
>
> // Instantiate the Request class
> Request request = new Request();
>
> // Add the CSV records to the body field
> request.setMessageContent(body.getBytes());
>
> // Save the request in the DB
> this.saveRequest(request);
>
> // add the request object to the exchange
> exchange.getOut().setBody(request);
>
> }
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Tue, Jun 9, 2009 at 11:28 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> Could be OSGi related. Can you try without OSGi.
>> Just to get the fact straight.
>>
>> And I assume you use 2.0-SNAPSHOT.
>>
>>
>> On Tue, Jun 9, 2009 at 11:18 AM, Charles Moulliard<cm...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > When I use the following route :
>> >
>> > <camel:route>
>> > <camel:from ref="queueClientInEndpoint" />
>> > <camel:choice>
>> > <camel:when>
>> > <camel:simple>${in.header.messageType} ==
>> > 'OINP'</camel:simple>
>> > <!-- Call the requestService to save the request -->
>> > <camel:bean ref="requestService"/>
>> > </camel:when>
>> > ....
>> >
>> > <!-- Request Service -->
>> > <osgi:reference id="requestService"
>> > interface="com.xpectis.x3s.platform.service.RequestService" />
>> >
>> > @Handler
>> > public void createRequest(@Header(value = "messageType") String
>> > messageType, @Body String body, Exchange exchange) {
>> >
>> > // Instantiate the Request class
>> > Request request = new Request();
>> >
>> > // Add the CSV records to the body field
>> > request.setMessageContent(body.getBytes());
>> >
>> > // Save the request in the DB
>> > this.saveRequest(request);
>> >
>> > // add the request object to the exchange
>> > exchange.getOut().setBody(request);
>> >
>> > }
>> >
>> > , camel generates the following error :
>> >
>> > Caused by: java.lang.NullPointerException
>> > at
>> >
>> org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197)
>> > at
>> >
>> org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:81)
>> > at
>> >
>> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:151)
>> > at
>> >
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:104)
>> > at
>> >
>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>> > at
>> >
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>> > at
>> >
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>> > at
>> >
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
>> > at
>> >
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
>> > at
>> >
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
>> > at
>> >
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>> > at
>> >
>> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
>> > at
>> >
>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>> > at
>> >
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>> > at
>> >
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>> > at
>> >
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
>> > at
>> >
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>> > at
>> >
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
>> > at
>> >
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
>> > at
>> >
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
>> > at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>> > at
>> >
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>> > at
>> >
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>> > at
>> >
>> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81)
>> >
>> > Is the problem related to the fact that camel can't find the method where
>> > @handler has been defined ?
>> >
>> > Charles Moulliard
>> > Senior Enterprise Architect
>> > Apache Camel Committer
>> >
>> > *****************************
>> > blog : http://cmoulliard.blogspot.com
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: OSGI - camel spring bean - @Handler (java.lang.NullPointerException
at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197))
Posted by Charles Moulliard <cm...@gmail.com>.
Complement of information :
The service (which is packaged as bundle and is deployed as a spring OSGI
service) publish the interface
<osgi:service ref="requestService"
interface="com.xpectis.x3s.platform.service.RequestService"/>
while the class implementing the service is declared private and of course
is instantiated locally by spring.
So we have two different bundles :
A) one containing the routing and where camelContext is created
B) the other which is the service
Question : Can the following method of the bundle B) called while the
camelcontext runs in the bundle A) ?
@Handler
public void createRequest(@Header(value = "messageType") String
messageType, @Body String body, Exchange exchange) {
// Instantiate the Request class
Request request = new Request();
// Add the CSV records to the body field
request.setMessageContent(body.getBytes());
// Save the request in the DB
this.saveRequest(request);
// add the request object to the exchange
exchange.getOut().setBody(request);
}
Regards,
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com
On Tue, Jun 9, 2009 at 11:28 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Could be OSGi related. Can you try without OSGi.
> Just to get the fact straight.
>
> And I assume you use 2.0-SNAPSHOT.
>
>
> On Tue, Jun 9, 2009 at 11:18 AM, Charles Moulliard<cm...@gmail.com>
> wrote:
> > Hi,
> >
> > When I use the following route :
> >
> > <camel:route>
> > <camel:from ref="queueClientInEndpoint" />
> > <camel:choice>
> > <camel:when>
> > <camel:simple>${in.header.messageType} ==
> > 'OINP'</camel:simple>
> > <!-- Call the requestService to save the request -->
> > <camel:bean ref="requestService"/>
> > </camel:when>
> > ....
> >
> > <!-- Request Service -->
> > <osgi:reference id="requestService"
> > interface="com.xpectis.x3s.platform.service.RequestService" />
> >
> > @Handler
> > public void createRequest(@Header(value = "messageType") String
> > messageType, @Body String body, Exchange exchange) {
> >
> > // Instantiate the Request class
> > Request request = new Request();
> >
> > // Add the CSV records to the body field
> > request.setMessageContent(body.getBytes());
> >
> > // Save the request in the DB
> > this.saveRequest(request);
> >
> > // add the request object to the exchange
> > exchange.getOut().setBody(request);
> >
> > }
> >
> > , camel generates the following error :
> >
> > Caused by: java.lang.NullPointerException
> > at
> >
> org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197)
> > at
> >
> org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:81)
> > at
> >
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:151)
> > at
> >
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:104)
> > at
> >
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> > at
> >
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> > at
> >
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> > at
> >
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> > at
> >
> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
> > at
> >
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> > at
> >
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> > at
> >
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> > at
> >
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> > at
> >
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> > at
> >
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> > at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
> > at
> >
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
> > at
> >
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81)
> >
> > Is the problem related to the fact that camel can't find the method where
> > @handler has been defined ?
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
Re: OSGI - camel spring bean - @Handler (java.lang.NullPointerException
at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197))
Posted by Charles Moulliard <cm...@gmail.com>.
I use the snapshot 2.0 of Camel
It will be difficult to test without osgi as everything have been packaged
as bundles, ...
How should I interpret the error returned ?
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com
On Tue, Jun 9, 2009 at 11:28 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Could be OSGi related. Can you try without OSGi.
> Just to get the fact straight.
>
> And I assume you use 2.0-SNAPSHOT.
>
>
> On Tue, Jun 9, 2009 at 11:18 AM, Charles Moulliard<cm...@gmail.com>
> wrote:
> > Hi,
> >
> > When I use the following route :
> >
> > <camel:route>
> > <camel:from ref="queueClientInEndpoint" />
> > <camel:choice>
> > <camel:when>
> > <camel:simple>${in.header.messageType} ==
> > 'OINP'</camel:simple>
> > <!-- Call the requestService to save the request -->
> > <camel:bean ref="requestService"/>
> > </camel:when>
> > ....
> >
> > <!-- Request Service -->
> > <osgi:reference id="requestService"
> > interface="com.xpectis.x3s.platform.service.RequestService" />
> >
> > @Handler
> > public void createRequest(@Header(value = "messageType") String
> > messageType, @Body String body, Exchange exchange) {
> >
> > // Instantiate the Request class
> > Request request = new Request();
> >
> > // Add the CSV records to the body field
> > request.setMessageContent(body.getBytes());
> >
> > // Save the request in the DB
> > this.saveRequest(request);
> >
> > // add the request object to the exchange
> > exchange.getOut().setBody(request);
> >
> > }
> >
> > , camel generates the following error :
> >
> > Caused by: java.lang.NullPointerException
> > at
> >
> org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197)
> > at
> >
> org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:81)
> > at
> >
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:151)
> > at
> >
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:104)
> > at
> >
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> > at
> >
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> > at
> >
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> > at
> >
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> > at
> >
> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
> > at
> >
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> > at
> >
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> > at
> >
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> > at
> >
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> > at
> >
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> > at
> >
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> > at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
> > at
> >
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
> > at
> >
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
> > at
> >
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81)
> >
> > Is the problem related to the fact that camel can't find the method where
> > @handler has been defined ?
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
Re: OSGI - camel spring bean - @Handler (java.lang.NullPointerException
at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197))
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Could be OSGi related. Can you try without OSGi.
Just to get the fact straight.
And I assume you use 2.0-SNAPSHOT.
On Tue, Jun 9, 2009 at 11:18 AM, Charles Moulliard<cm...@gmail.com> wrote:
> Hi,
>
> When I use the following route :
>
> <camel:route>
> <camel:from ref="queueClientInEndpoint" />
> <camel:choice>
> <camel:when>
> <camel:simple>${in.header.messageType} ==
> 'OINP'</camel:simple>
> <!-- Call the requestService to save the request -->
> <camel:bean ref="requestService"/>
> </camel:when>
> ....
>
> <!-- Request Service -->
> <osgi:reference id="requestService"
> interface="com.xpectis.x3s.platform.service.RequestService" />
>
> @Handler
> public void createRequest(@Header(value = "messageType") String
> messageType, @Body String body, Exchange exchange) {
>
> // Instantiate the Request class
> Request request = new Request();
>
> // Add the CSV records to the body field
> request.setMessageContent(body.getBytes());
>
> // Save the request in the DB
> this.saveRequest(request);
>
> // add the request object to the exchange
> exchange.getOut().setBody(request);
>
> }
>
> , camel generates the following error :
>
> Caused by: java.lang.NullPointerException
> at
> org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197)
> at
> org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:81)
> at
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:151)
> at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:104)
> at
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> at
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> at
> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
> at
> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
> at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
> at
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
> at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
> at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
> at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
> at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
> at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81)
>
> Is the problem related to the fact that camel can't find the method where
> @handler has been defined ?
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus