[
https://issues.apache.org/jira/browse/CAMEL-4073?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Kulp updated CAMEL-4073:
-------------------------------
Fix Version/s: 2.7.3
> Misconfigured CXF Endpoint url results in NPE instead of actual exception.
> ----------------------------------------------------------------------------
>
> Key: CAMEL-4073
> URL: https://issues.apache.org/jira/browse/CAMEL-4073
> Project: Camel
> Issue Type: Bug
> Components: camel-cxf
> Affects Versions: 2.7.2
> Environment: Spring 3.0.5.RELEASE, CXF 2.3.2, Camel 2.7.2
> Reporter: Sven Zethelius
> Assignee: Daniel Kulp
> Fix For: 2.7.3, 2.8.0
>
> Attachments: CAMEL-4073.patch
>
>
> I'm new to Camel, trying to setup the JMS CXF service based on the
> [http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-apache-camel.html],
> but with our own JMS services. In the process I transposed some
> configuration and ended up with an NPE when CXF tried to start.
> The URL passed to
> jaxws:endpoint/@address="tcp://MyDomainServer1:2506,tcp://MyDomainServer1:2506".
> I know this wasn't what camel expected here, after debugging, but wanted to
> open a bug, since the actual meaningful exception is actually lost due to an
> NPE.
> Expected Exception. this was obtained with a debugger in CXF/camel before
> the NPE is thrown.
> {code}
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint:
> MyDomainServer1://2506,tcp://MyDomainServer2:2506 due to: No component found
> with scheme: MyDomainServer1
> at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:457)
> at
> org.apache.camel.component.cxf.transport.CamelDestination.activate(CamelDestination.java:116)
> at
> org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48)
> at
> org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:181)
> at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:127)
> at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
> at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239)
> at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:489)
> 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
> at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
> at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
> at
> org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:91)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:102)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:86)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:53)
> at com.expedia.cc.container.remoting.prototype.Main.main(Main.java:37)
> {code}
> The Actual Exception was:
> {code}
> Exception in thread "main" java.lang.RuntimeException:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'JMS_prototype.Server': Invocation of init method failed; nested
> exception is javax.xml.ws.WebServiceException: java.lang.NullPointerException
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:96)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:86)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:53)
> at com.expedia.cc.container.remoting.prototype.Main.main(Main.java:37)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'JMS_prototype.Server': Invocation of init method
> failed; nested exception is javax.xml.ws.WebServiceException:
> java.lang.NullPointerException
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
> at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
> at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
> at
> org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:91)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:102)
> at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
> ... 4 more
> Caused by: javax.xml.ws.WebServiceException: java.lang.NullPointerException
> at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:343)
> at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239)
> at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:489)
> 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
> ... 16 more
> Caused by: java.lang.NullPointerException
> at
> org.apache.camel.FailedToCreateConsumerException.<init>(FailedToCreateConsumerException.java:31)
> at
> org.apache.camel.component.cxf.transport.CamelDestination.activate(CamelDestination.java:120)
> at
> org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48)
> at
> org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:181)
> at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:127)
> at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
> ... 25 more
> {code}
> Basically the problem is that the {{destinationEndpoint =
> getCamelContext().getEndpoint(camelDestinationUri);}} call fails, resulting
> the the FailedToCreateConsumerException first parameter to be null. Since
> its internally expecting the endpoint to not be null, it NPE's. Fix is most
> likely to make FailedToCreateConsumerException null safe. Since it principly
> uses the endpoint to get the URI, you could make a constructor that took the
> URI that you were trying to configure, instead of relying on an already
> created endpoint.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira