cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] [Resolved] (CXF-4686) NoClassDefFoundError for in OSGi environment
Date Mon, 10 Dec 2012 17:13:21 GMT


Sergey Beryozkin resolved CXF-4686.

    Resolution: Not A Problem
      Assignee: Sergey Beryozkin

OK, thanks for the update - closing as 'not a problem' given that using the shipped class
loader works
> NoClassDefFoundError for in OSGi environment
> -----------------------------------------------------------------------
>                 Key: CXF-4686
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.6.2
>         Environment: Apache Felix
>            Reporter: Konrad Windszus
>            Assignee: Sergey Beryozkin
> I try to create a JAX-RS client from bundle a with the help of an annotated class like
> {code}
> // Jax-RS client
> ProductClientProxy productProxy = JAXRSClientFactory.create(<url>, ProductClientProxy.class);
> {code}
> CXF and JAX-RS are both exposed from another bundle (bundle b). The problem is during
runtime I get the following exception
> {noformat}
> java.lang.NoClassDefFoundError: not found by <bundle a>
> 	at $Proxy205.<clinit>(Unknown Source)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> 	at java.lang.reflect.Constructor.newInstance(
> 	at java.lang.reflect.Proxy.newProxyInstance(
> 	at org.apache.cxf.common.util.ProxyHelper.getProxyInternal(
> 	at org.apache.cxf.common.util.ProxyHelper.getProxy(
> 	at org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWithValues(
> 	at org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.create(
> 	at org.apache.cxf.jaxrs.client.JAXRSClientFactory.create(
> 	at org.apache.cxf.jaxrs.client.JAXRSClientFactory.create(
> 	at org.apache.cxf.jaxrs.client.JAXRSClientFactory.create(
> 	at <code line listed above>
> {noformat}
> The problem is that CXF tries to instanciate a Client in JAXRSClientFactoryBean (line
302, leveraging the classloader of the client bundle (bundle a), not with the classloader
of the CXF bundle(bundle b)). Unfortunately the classloader of the bundle a does not import
the package, and therefore this NoClassDefFoundError is thrown. 
> As a workaround we explicitly import the package in bundle a. Although
I don't know how to fix it from your site, it would be great if the necessary packages would
automatically detected (in this case by the maven-bundle-plugin) or you use another classloader
to load the org.apache.cxf.jaxrs.client.Client interface, or you remove all the dependencies
on other packages from the Client interface.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message