[ 
https://issues.apache.org/jira/browse/CXF-3949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13183964#comment-13183964
 ] 

metatech commented on CXF-3949:
-------------------------------

The problem happened again, this time with a possibility to debug.
It looks like a race condition in the OsgiLocator between the JSR 311 bundle 
still starting (trying to register the RuntimeDelegate) and the application 
bundle trying to retrieve the RuntimeDelegate.
The problem still happens even after several SMX restarts.
Any idea ?

{code}
"SpringOsgiExtenderThread-16" prio=10 tid=0x08ba1400 nid=0x316c runnable 
[0x8aeb9000]
   java.lang.Thread.State: RUNNABLE
        at 
org.apache.servicemix.specs.locator.OsgiLocator.locate(OsgiLocator.java:58)
        - locked <0x925e62d8> (a java.lang.Class for 
org.apache.servicemix.specs.locator.OsgiLocator)
        at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:79)
        at 
javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:105)
        at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91)
        - locked <0x91fd0a48> (a java.lang.Class for 
javax.ws.rs.ext.RuntimeDelegate)
        at javax.ws.rs.core.MediaType.<clinit>(MediaType.java:44)
        at org.apache.cxf.jaxrs.utils.JAXRSUtils.<clinit>(JAXRSUtils.java:104)
        at 
org.apache.cxf.jaxrs.model.OperationResourceInfo.checkMediaTypes(OperationResourceInfo.java:169)
        at 
org.apache.cxf.jaxrs.model.OperationResourceInfo.<init>(OperationResourceInfo.java:74)
        at 
org.apache.cxf.jaxrs.utils.ResourceUtils.createOperationInfo(ResourceUtils.java:341)
        at 
org.apache.cxf.jaxrs.utils.ResourceUtils.evaluateResourceClass(ResourceUtils.java:218)
        at 
org.apache.cxf.jaxrs.utils.ResourceUtils.createClassResourceInfo(ResourceUtils.java:204)
        at 
org.apache.cxf.jaxrs.JAXRSServiceFactoryBean.setResourceClassesFromBeans(JAXRSServiceFactoryBean.java:214)
        at 
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBeans(JAXRSServerFactoryBean.java:188)
        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.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1114)
        at 
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
        at 
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
        at 
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
{code}

{code}
"FelixStartLevel" daemon prio=10 tid=0x8e39ec00 nid=0x3003 waiting for monitor 
entry [0x8ec73000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at 
org.apache.servicemix.specs.locator.OsgiLocator.register(OsgiLocator.java:44)
        - waiting to lock <0x925e62d8> (a java.lang.Class for 
org.apache.servicemix.specs.locator.OsgiLocator)
        at 
org.apache.servicemix.specs.locator.Activator.register(Activator.java:116)
        at 
org.apache.servicemix.specs.locator.Activator.start(Activator.java:70)
        - locked <0x970ce220> (a org.apache.servicemix.specs.locator.Activator)
        at 
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:1842)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1759)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1163)
        at 
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
        at java.lang.Thread.run(Thread.java:662)

{code}

                
> NoClassDefFoundError when using CXF JAX-RS in OSGi environment
> --------------------------------------------------------------
>
>                 Key: CXF-3949
>                 URL: https://issues.apache.org/jira/browse/CXF-3949
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> When using the CXF JAX-RS implementation in an OSGi environment, the CXF 
> implementation might fail to initialize properly.
> The problem is non-consistently reproduceable, but more likely to occur on 
> machines with high parallelism (due to several cores/threads).
> The CXF bundle ("org.apache.cxf.bundle") has a dependency on the JSR 311 API 
> JAR ("org.apache.servicemix.specs.jsr311-api-1.1").
> But the dependency is marked as "resolution=optional" in the OSGi headers of 
> the CXF bundle manifest.
> As a result, if the JSR-311 bundle is not yet fully started when the CXF 
> bundle is started, OSGi does not "wire" these packages into the imports of 
> the CXF bundle:
> javax.ws.rs
> javax.ws.rs.core
> javax.ws.rs.ext
> The error is the following : 
> java.lang.NoClassDefFoundError: Could not initialize class 
> org.apache.cxf.jaxrs.utils.JAXRSUtils
> See similar error DOSGI-1
> I guess that these packages are marked as optional because CXF can be used in 
> an environment where no JAX-RS is available, and it works fine as long as the 
> application does not use this API.  However, when an application is known to 
> use the API, the dependency marked as "optional" is not correct.
> Long-term solution : split CXF bundle into smaller bundles (like Jetty).
> Workaround : edit the manifest of the CXF bundle, and remove the 
> "resolution=optional" for the packages which are known to be used by the 
> application.  Tip : replace "resolution" by "resolutio2", this tricks 
> prevents from changing the alignment of the 80-characters columns.
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to