camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject OSGI - camel spring bean - @Handler (java.lang.NullPointerException at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:197))
Date Tue, 09 Jun 2009 09:18:59 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message