Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2C6414871 for ; Wed, 8 Jun 2011 21:08:26 +0000 (UTC) Received: (qmail 9449 invoked by uid 500); 8 Jun 2011 21:08:25 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 9411 invoked by uid 500); 8 Jun 2011 21:08:25 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 9377 invoked by uid 99); 8 Jun 2011 21:08:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2011 21:08:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2011 21:08:22 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 96EDE1092F2 for ; Wed, 8 Jun 2011 21:08:00 +0000 (UTC) Date: Wed, 8 Jun 2011 21:08:00 +0000 (UTC) From: "Sven Zethelius (JIRA)" To: dev@camel.apache.org Message-ID: <631138738.4723.1307567280615.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (CAMEL-4073) Misconfigured CXF Endpoint url results in NPE instead of actual exception. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org 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 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.(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.(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.(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