On Nov 9, 2012, at 9:51 AM, "Pitteloud, Gaëtan" <[email protected]> wrote:
> Both solutions work, thank you guys : I have initially added the system > property, but finally prefer the solution to set Autostart to true on > servicemix's jsr311 bundle. > This is actually how it's supposed to work : this bundle has an activator > that register loaders for loading classes from other bundles when using > FactoryFinder, see classes in or.apache.servicemix.specs.locator. Yep. It's a shame the 'standard' api jars from Oracle don't have this capability built into it. ServiceMix has "OSGi enabled" versions of a bunch of the spec jars including jaxws, jaxb, jaxrs, etc… Definitely use them if you can. Dan > -- > Gaëtan > > -----Message d'origine----- > De : Angelo zerr [mailto:[email protected]] > Envoyé : vendredi 9 novembre 2012 15:23 > À : [email protected] > Objet : Re: OSGi : fails to load CXF classes > > Hi Gaëtan, > > I had the same problem than you, I have explained how to fix that at > http://angelozerr.wordpress.com/2012/05/29/eclipse_spring_dosgi_step1/#serverMock > > that's to say: > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > It's very important too to unselect *javax.ws.rs.jsr311-api* (JAX-RS API) and > select *org.apache.servicemix.specs.jsr311-api* with *Auto-Start to true *. > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > > Hope it's the same problem than you. > > Regards Angelo > > 2012/11/9 Malisetti, Ramanjaneyulu <[email protected]> > >> We too faced similar problem in OSGi. Setting system property >> javax.ws.rs.ext.RuntimeDelegate=org.apache.cxf.jaxrs.impl.RuntimeDeleg >> ateImpl, >> issue is resolved. >> >> Regards >> Raman >> >> -----Original Message----- >> From: Pitteloud, Gaëtan [mailto:[email protected]] >> Sent: Friday, November 09, 2012 7:14 PM >> To: [email protected] >> Subject: OSGi : fails to load CXF classes >> >> Hi all, >> >> I must use CXF (client) within a RCP (eclipse) application. Here's my >> config: >> - I have defined a plugin project that contains a library with the >> code that makes the CXF call (actually uses WebClient). This bundle A >> imports org.apache.cxf.bundle-minimal (Require-bundle) and specifies >> the library in the Classpath header of the MANIFEST. >> - My OSGi runtime contains servicemix's jsr311 bundle, and this bundle >> is the only provider of javax.ws.rs.* >> - I'm using Gemini blueprint to expose the service defined in the >> library of bundle A >> - Bundle B (ui bundle) imports service defined in bundle A, also using >> Gemini blueprint facilities. >> - When invoking the service from B, it tries to create a WebClient to >> issue a http request, and I get the following error: >> >> Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: >> com.sun.ws.rs.ext.RuntimeDelegateImpl >> at >> javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:122) >> at >> javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91) >> at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69) >> at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80) >> at >> org.apache.cxf.jaxrs.client.LocalClientState.<init>(LocalClientState.java:47) >> at >> org.apache.cxf.jaxrs.client.AbstractClient.<init>(AbstractClient.java:96) >> at org.apache.cxf.jaxrs.client.WebClient.<init>(WebClient.java:76) >> at org.apache.cxf.jaxrs.client.WebClient.<init>(WebClient.java:72) >> at >> org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWebClient(JAXRSClientFactoryBean.java:197) >> at >> org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWebClient(JAXRSClientFactoryBean.java:206) >> at org.apache.cxf.jaxrs.client.WebClient.create(WebClient.java:142) >> at org.apache.cxf.jaxrs.client.WebClient.create(WebClient.java:115) >> ... 43 more >> Caused by: java.lang.ClassNotFoundException: >> com.sun.ws.rs.ext.RuntimeDelegateImpl >> at java.net.URLClassLoader$1.run(URLClassLoader.java:202) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java:190) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:307) >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:248) >> at >> org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:131) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:248) >> at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:37) >> at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:143) >> at >> javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:105) >> ... 54 more >> >> Based on what I know from FactoryFinder, it tries to load a file named >> META-INF/services/javax.ws.rs.ext.RuntimeDelegate, that contains the >> implementation class name of the RuntimeDelegate to use. If either the >> file or the class defined in the file cannot be loaded, it tries to >> load the default RuntimeDelegate implementation, which is >> com.sun.ws.rs.ext.RuntimeDelegateImpl. Thus getting this exception. >> >> org.apache.cxf.bundle-minimal contains a file named >> META-INF/services/javax.ws.rs.ext.RuntimeDelegate, and this file >> contains a class name that exists in cxf bundle, thus I rather suspect >> some classloading issues related to bundles since CXF and servicemix >> jsr311 are in separate bundles. >> >> Did anybody already face such an issue ? >> Thanks in advance, >> -- >> Gaëtan >> -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
