title: cxf NullPointerException while deploying on glassfish
body: <p>I'm trying to deploy war on glassfish3 and i get exception:</p>
  
  <pre><code>SEVERE|glassfish3.1.1|org.apache.catalina.core.ContainerBase|_ThreadID=10;_ThreadName=Thread-2;|ContainerBase.addChild: start: 
  org.apache.catalina.LifecycleException: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [cxf.xml]
  Offending resource: class path resource [applicationContext-ws.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [cxf.xml]; nested exception is java.lang.NullPointerException
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5389)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2000)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1651)
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
      at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
      at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:294)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
      at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)
      at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)
      at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
      at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
      at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
      at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
      at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
      at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
      at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:253)
      at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145)
      at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:136)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
      at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
      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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
      at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)
  Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [cxf.xml]
  Offending resource: class path resource [applicationContext-ws.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [cxf.xml]; nested exception is java.lang.NullPointerException
      at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:218)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
      at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
      at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
      ... 32 more
  Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [cxf.xml]; nested exception is java.lang.NullPointerException
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:202)
      ... 53 more
  Caused by: java.lang.NullPointerException
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:205)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:186)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
      at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.&lt;init&gt;(ArrayReferenceNodeProperty.java:87)
      at sun.reflect.GeneratedConstructorAccessor91.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:181)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:168)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
      at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.&lt;init&gt;(ArrayReferenceNodeProperty.java:87)
      at sun.reflect.GeneratedConstructorAccessor91.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:181)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
      at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.&lt;init&gt;(ArrayReferenceNodeProperty.java:87)
      at sun.reflect.GeneratedConstructorAccessor91.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:181)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:168)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
      at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.&lt;init&gt;(SingleElementNodeProperty.java:105)
      at sun.reflect.GeneratedConstructorAccessor90.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:181)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
      at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.&lt;init&gt;(ArrayElementProperty.java:112)
      at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.&lt;init&gt;(ArrayElementNodeProperty.java:62)
      at sun.reflect.GeneratedConstructorAccessor103.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
      at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.&lt;init&gt;(ClassBeanInfoImpl.java:181)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.&lt;init&gt;(JAXBContextImpl.java:326)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.&lt;init&gt;(JAXBContextImpl.java:141)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:236)
      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 javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:187)
      at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:147)
      at javax.xml.bind.ContextFinder.find(ContextFinder.java:349)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)
      at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext(CamelNamespaceHandler.java:179)
      at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:166)
      at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:249)
      at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
      at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
      at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335)
      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
      ... 56 more
  </code></pre>
  
  <p>here is this offending cxf.xml</p>
  
  <pre><code>&lt;import resource="classpath:META-INF/cxf/cxf.xml" /&gt;
  &lt;import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" /&gt;
  &lt;import resource="classpath:META-INF/cxf/cxf-servlet.xml" /&gt;
  
  &lt;bean name="taskServiceBean" class="com.example.TaskServiceImpl" /&gt;
  
  &lt;camelContext id="context" trace="true" xmlns="http://camel.apache.org/schema/spring"&gt;
      &lt;route id="serverRoute"&gt;
          &lt;from uri="jms:queue:com.example.taskservice" /&gt;
          &lt;to uri="direct:TaskServiceServer" /&gt;
      &lt;/route&gt;
  
  &lt;/camelContext&gt;
  
  
  &lt;jaxws:endpoint id="taskServiceJMS" address="camel://direct:TaskServiceServer" implementor="#taskServiceBean"&gt;
  &lt;/jaxws:endpoint&gt;
  
  &lt;cxf:bus&gt;
      &lt;cxf:features&gt;
          &lt;cxf:logging /&gt;
      &lt;/cxf:features&gt;
  &lt;/cxf:bus&gt;
  
  &lt;bean class="org.apache.camel.component.cxf.transport.CamelTransportFactory"
      p:camelContext-ref="context" p:bus-ref="cxf"&gt;
      &lt;property name="checkException" value="true" /&gt;
      &lt;property name="transportIds"&gt;
          &lt;list&gt;
              &lt;value&gt;http://cxf.apache.org/transports/camel&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="jms" class="org.apache.camel.component.jms.JmsComponent"&gt;
      &lt;property name="connectionFactory" ref="myConnectionFactory" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>myConnectionFactory is defined as follows in project that is on classpath:</p>
  
  <pre><code>&lt;jee:jndi-lookup id="myConnectionFactory" jndi-name="java:comp/env/amqConnectionFactory" /&gt;
  </code></pre>
  
  <p>However, the same file can be deployed, even on the same domain after any successfull deployment has been done.</p>
  
  <p>Anyone knows what is happening?</p>