0 Replies Latest reply on Feb 24, 2010 8:32 AM by daniele.sacchetti

    Problem with method createBus of org.apache.cxf.bus.spring.SpringBusFactory

    daniele.sacchetti

      Hi,

       

      I'm running fuse-esb 4.1.0.2 and the bundles that provide CXF in my enviroment are the following:

       

      Apache CXF Bundle Jar (2.2.2.1-fuse)

      ServiceMix :: CXF Binding Component (2009.01.0.fuse)

      Apache CXF Runtime JBI Binding (2.2.2.1-fuse)

      Apache CXF Runtime JBI Transport (2.2.2.1-fuse)

      ServiceMix :: CXF Service Engine (2009.01.0.fuse)

      Apache ServiceMix CXF Transport for OSGi (4.1.0.fuse)

       

      I have implemented a bundle:

      swim-iop-mdw (0.0.1)

      that provides a Web Services and that is based on the spring definition in bundle-context.xml (see attachment)

      My bundle works fine and all the dependecies from other OSGI CXF bundles are resolved.

       

       

       

      When I try to implement WS-RM in my bundle with the following (client side) code:

       

      366            org.apache.cxf.bus.spring.SpringBusFactory bf = new org.apache.cxf.bus.spring.SpringBusFactory();

      367            java.net.URL busFile = RequestFOImpl.class.getResource("/ws_rm.xml");

      368            org.apache.cxf.Bus bus = bf.createBus(busFile.toString());

      369            bf.setDefaultBus(bus);

       

      I get some problems when this code is executed and I get the following exception in the servicemix log file:

       

      09:34:56,092 | INFO  | 29767569@qtp0-1  | BusApplicationContext            | pport.AbstractApplicationContext  411 | Refreshing org.apache.cxf.bus.spring.BusApplicationContext@170146: display name ; startup date ; root of context hierarchy

      09:34:56,096 | INFO  | 29767569@qtp0-1  | alidationXmlBeanDefinitionReader | tory.xml.XmlBeanDefinitionReader  323 | Loading XML bean definitions from class path resource

      09:34:56,098 | WARN  | 29767569@qtp0-1  | SpringBusFactory                 | oaplatform.swim.ws.RequestFOImpl  368 | Initial attempt to crate application context was unsuccessful.

      org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource ; nested exception is java.io.FileNotFoundException: class path resource cannot be opened because it does not exist

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)

              at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:128)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

              at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:109)

              at org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusApplicationContext.java:263)

              at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)

              at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)

              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:88)

              at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)

              at com.thalesgroup.trt.soaplatform.swim.ws.RequestFOImpl.wireMDWRequestFoService(RequestFOImpl.java:368)

              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.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166)

              at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)

              at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55)

              at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)

              at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

              at java.util.concurrent.FutureTask.run(FutureTask.java:138)

              at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

              at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)

              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)

              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)

              at org.apache.servicemix.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:83)

              at org.apache.servicemix.cxf.transport.http_osgi.OsgiServlet.invokeDestination(OsgiServlet.java:291)

              at org.apache.servicemix.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:184)

              at org.apache.servicemix.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)

              at org.apache.servicemix.cxf.transport.http_osgi.OsgiServlet.doPost(OsgiServlet.java:71)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)

              at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)

              at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)

              at org.ops4j.pax.web.service.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)

              at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)

              at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)

              at org.ops4j.pax.web.service.internal.HttpServiceContext.handle(HttpServiceContext.java:108)

              at org.ops4j.pax.web.service.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)

              at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

              at org.mortbay.jetty.Server.handle(Server.java:324)

              at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)

              at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)

              at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:741)

              at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)

              at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)

              at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)

              at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

      Caused by: java.io.FileNotFoundException: class path resource cannot be opened because it does not exist

              at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)

              ... 53 more

       

       

      I do not understand why in this case, the resource META-INF/cxf/cxf.xml provided by Apache CXF Bundle Jar (2.2.2.1-fuse) cannot be resolved.

       

      I've the impression that the classloader used by org.apache.cxf.bus.spring.SpringBusFactory for the creation of the object org.apache.cxf.Bus is not the same as the classloader and the spring environment used by my bundle when running without the WS-RM code.

       

       

       

      The MANIFEST in META-INF of my bundle is:

       

      Manifest-Version: 1.0
      Export-Package: com.thalesgroup.trt.soaplatform.swim.ws;uses:="com.tha
      lesgroup.trt.soaplatform.swim.dds,IOP.WIRE,com.thalesgroup.trt.soapla
      tform.swim,monitor,org.apache.cxf.bus.spring,javax.jws,com.thalesgrou
      p.trt.soaplatform.swim.types,org.apache.cxf,org.apache.cxf.jaxws,java
      x.xml.ws,org.apache.cxf.interceptor",com.thalesgroup.trt.soaplatform.
      swim.types;uses:="javax.xml.bind.annotation",com.thalesgroup.trt.soap
      latform.swim.camel;uses:="com.thalesgroup.trt.soaplatform.swim.dds,or
      g.apache.camel,IOP.WIRE,org.apache.camel.builder,org.apache.camel.spr
      ing",com.thalesgroup.trt.soaplatform.swim;uses:="javax.xml.ws,javax.x
      ml.namespace,javax.jws.soap,javax.jws,com.thalesgroup.trt.soaplatform
      .swim.types,javax.xml.bind.annotation"
      Built-By: T0070284
      Tool: Bnd-0.0.357
      Bundle-Name: swim-iop-mdw
      Created-By: Apache Maven Bundle Plugin
      Require-Bundle: org.apache.cxf.bundle, swim-dds
      Build-Jdk: 1.6.0_14
      Bundle-Version: 0.0.1
      Bnd-LastModified: 1267015173712
      Spring-Context: *;publish-context:=false
      Bundle-ManifestVersion: 2
      Bundle-SymbolicName: swim-iop-mdw
      Import-Package: IOP.WIRE,META-INF.cxf,META-INF.cxf.osgi,com.thalesgrou
      p.trt.soaplatform.swim,com.thalesgroup.trt.soaplatform.swim.camel,com
      .thalesgroup.trt.soaplatform.swim.dds,com.thalesgroup.trt.soaplatform
      .swim.types,com.thalesgroup.trt.soaplatform.swim.ws,javax.jws;version
      ="2.0",javax.jws.soap;version="2.0",javax.wsdl,javax.xml.bind.annotat
      ion,javax.xml.namespace,javax.xml.ws;version="2.1",monitor,org.apache
      .camel;version="1.6",org.apache.camel.builder;version="1.6",org.apach
      e.camel.component.file;version="1.6",org.apache.camel.component.file.
      strategy;version="1.6",org.apache.camel.converter.jaxb,org.apache.cam
      el.converter.stream;version="1.6",org.apache.camel.spring;version="1.
      6",org.apache.cxf,org.apache.cxf.bus,org.apache.cxf.bus.resource,org.
      apache.cxf.bus.spring,org.apache.cxf.configuration.spring,org.apache.
      cxf.interceptor,org.apache.cxf.jaxws,org.apache.cxf.resource,org.apac
      he.cxf.transport.http_osgi;resolution:=optional,org.apache.servicemix
      .cxf.transport.http_osgi;resolution:=optional,org.springframework.bea
      ns.factory.config;version="2.5"

       

      Thanks,

      Daniele