Unable to find META-INF/cxf/cxf.xml when running inside native and forked container

1,102 views
Skip to first unread message

Stephen Smithstone

unread,
Mar 18, 2013, 3:02:39 AM3/18/13
to op...@googlegroups.com
I am trying to test a CXF frontend SOAP client using JaxWsClientFactoryBean inside of a bundle the code works when run as a non paxexam test case, however when I package it up into a bundle with the maven felix plugin and deploy to a forked paxexam 2.5.0 / 2.6.0 , 3.0.0 , 3.0.1 container I fails with a message about unable to find binding for a method, however looking through the pax container log I see it fails with 

Mar 18, 2013 6:57:28 AM org.apache.cxf.bus.spring.SpringBusFactory createApplicationContext
WARNING: Initial attempt to create application context was unsuccessful.
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [META-INF/cxf/cxf.xml]; nested exception is java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:131)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:123)
at org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusApplicationContext.java:262)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
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 org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)
at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)
at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)
at org.apache.cxf.endpoint.AbstractEndpointFactory.getBus(AbstractEndpointFactory.java:82)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.initializeServiceFactory(AbstractWSDLBasedEndpointFactory.java:231)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:117)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:124)
at com.lbi.vaa.tdd.flightstatus.tcs.TCSFlightStatusService.createClient(TCSFlightStatusService.java:73)
at com.lbi.vaa.tdd.flightstatus.tcs.TCSFlightStatusService.findDepartures(TCSFlightStatusService.java:51)
at uk.co.smithstone.osgi.SimpleActivator.start(SimpleActivator.java:40)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1904)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1192)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:266)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
... 32 more


but when this bundle is deployed inside of karaf or felix it works fine, I am using cxf-bundle 2.3.2 and need to use this with spring 3.2.1.RELEASE and eclise gemini 1.0.0.RELEASE as well as all the dependencies, has any one got experience of getting this to work.

I'm currently running pax exam 3.0.1 with forked container with felix container, I need to use felix container as thats what production is as its Adobe CQ5 / Sling / Felix combination

I've uploaded the same project to github.com/ssmithstone/learning_pax_exam

Cheers

Stephen

Christoph Läubrich

unread,
Mar 18, 2013, 3:12:33 AM3/18/13
to op...@googlegroups.com
Have you provisioned (and started) all dependecies inside the PaxExam test?
Have you checked that the file is present in the exported bundle?

Stephen Smithstone

unread,
Mar 18, 2013, 4:22:31 AM3/18/13
to op...@googlegroups.com, lae...@googlemail.com
good question , all the bundles are loaded and active i ran the following code to check 

Bundle[] bundles = bundleContext.getBundles();
        for (Bundle bundle : bundles) {
            System.out.println("Bundle " + bundle.getSymbolicName() +" is expecting " + Bundle.ACTIVE +  " and got "  + bundle.getState());
        }

and all of them are 32 which according to the constant or Active

I 've modified the bundle to import META-INF.cxf  and added a log statement that checks for the resource using the code below in the activator the class that creates the client and the junit test
getClass().getClassLoader().getResourceAsStream("META-INF/cxf/cxf.xml")

inside of the activator that resolves to true , and the same goes for the actual class that is creating the client, the junit test it can resolve the file, and still it fails
Reply all
Reply to author
Forward
0 new messages