camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-3341) ProxyHelper and JMS component - need to start producer or fails with NPE
Date Wed, 17 Nov 2010 17:55:25 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-3341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63384#action_63384
] 

Claus Ibsen commented on CAMEL-3341:
------------------------------------

Thanks for reporting and well spotted.

Yes the producer needs to be started beforehand.

The patch looks good.
However we can use ServiceHelper.startService to have it log the event that this service/producer
is being started.


> ProxyHelper and JMS component - need to start producer or fails with NPE
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-3341
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3341
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-jms
>    Affects Versions: 2.5.0
>         Environment: linux (debian) 2.6, maven 2.2.1, pax-exam 1.2.2 (using latest felix
and equinox)
>            Reporter: Caspar MacRae
>         Attachments: ProxyHelper.diff
>
>
> I've a very simple unit test (based on http://camel.apache.org/using-camelproxy.html)
that works fine when using endpoint uri "direct:start" but fails with the following exception
when using "activemq:somequeue"
> java.lang.NullPointerException
> 	at org.apache.camel.component.jms.JmsProducer.processInOut(JmsProducer.java:140)
> 	at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:90)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
> 	at org.apache.camel.impl.DefaultAsyncProducer.process(DefaultAsyncProducer.java:37)
> 	at org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:65)
> 	at $Proxy7.sayWordTo(Unknown Source)
> 	at net.earcam.cdosgi.remoteserviceadmin.CamelProxyTest.simpleArgTest(CamelProxyTest.java:93)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Looks like the problem is simply that the producer isn't started so never creates a UuidGenerator
(needed for the JMS Reply-To)
> org.apache.camel.component.bean.ProxyHelper - lines 45 - 51, needs to start producer
(for JmsProducer)
>     /**
>      * Creates a Proxy which sends PojoExchange to the endpoint.
>      */
>     @SuppressWarnings("unchecked")
>     public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class[]
interfaces, MethodInfoCache methodCache) throws Exception {
>         return (T) createProxyObject(endpoint, endpoint.createProducer(), cl, interfaces,
methodCache);
>     }
> As a workaround, simply create the producer, start it and use the overloaded method createProxy
that takes a producer parameter.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message