Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
ClassNotFoundExceptions in SpringExtender Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassNotFoundExceptions in SpringExtender

    Hi,

    I'm getting strange exceptions during the startup of Eclipse Run configurations. The problem seems to be that the Spring OSGi extender starts setting up application contexts before Equinox has completely resolved/started all bundles.
    The classes not found can be resolved if I set the bundle that contains the classes to start level 3 (instead of the default: 4). So the configuration must be consistent.

    QUESTION: Is it possible to influence the way the Spring OSGi Extender behaves, to make sure that the OSGi resolver has finished before Spring application contexts are created ????

    P.S.:
    This is the exception I see:
    SEVERE: Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=org.eclips e.swordfish.plugins.resolver.policy, config=osgibundle:/META-INF/spring/*.xml))
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in OSGi resource[classpath:/META-INF/cxf/cxf.xml|bnd.id=42|bnd.sym=org.eclipse.swordfish.pl ugins.resolver.policy]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
    - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:883)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:839)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:440)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:728)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.access$1600(Ab stractDelegatedExecutionApplicationContext.java:69 )
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext$4.run(Abstract DelegatedExecutionApplicationContext.java:355)
    at org.springframework.osgi.util.internal.PrivilegedU tils.executeWithCustomTCCL(PrivilegedUtils.java:85 )
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.completeRefres h(AbstractDelegatedExecutionApplicationContext.jav a:320)
    at org.springframework.osgi.extender.internal.depende ncies.startup.DependencyWaiterApplicationContextEx ecutor$CompleteRefreshTask.run(DependencyWaiterApp licationContextExecutor.java:132)
    at java.lang.Thread.run(Thread.java:637)
    Caused by: org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
    - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
    at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:115)
    at org.springframework.beans.factory.support.SimpleIn stantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:61)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:877)
    ... 18 more
    Caused by: java.lang.RuntimeException: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
    - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
    at org.apache.cxf.wsdl.JAXBExtensionHelper.getJAXBCon text(JAXBExtensionHelper.java:185)
    at org.apache.cxf.wsdl.JAXBExtensionHelper.addExtensi ons(JAXBExtensionHelper.java:168)
    at org.apache.cxf.wsdl.JAXBExtensionHelper.addExtensi ons(JAXBExtensionHelper.java:88)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.registerInit ialExtensions(WSDLManagerImpl.java:263)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.registerInit ialExtensions(WSDLManagerImpl.java:243)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.<init>(WSDLM anagerImpl.java:113)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:513)
    at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:100)
    ... 20 more
    Caused by: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
    - with linked exception:
    [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
    at javax.xml.bind.ContextFinder.loadSpi(ContextFinder .java:174)
    at javax.xml.bind.ContextFinder.find(ContextFinder.ja va:60)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext .java:77)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext .java:73)
    at org.apache.cxf.wsdl.JAXBExtensionHelper.createJAXB Context(JAXBExtensionHelper.java:196)
    at org.apache.cxf.wsdl.JAXBExtensionHelper.getJAXBCon text(JAXBExtensionHelper.java:183)
    ... 30 more
    Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
    at org.eclipse.osgi.internal.loader.BundleLoader.find ClassInternal(BundleLoader.java:506)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:410)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
    at javax.xml.bind.ContextFinder.loadSpi(ContextFinder .java:169)
    ... 35 more



    P.P.S.: I also found that FUSE / SMX encounter similar problems: https://fusesource.com/issues/browse/ESB-1117 but with what I see in the context of Equinox, it looks like the problem is not exclusively Felix related.

  • #2
    Can it be ...

    ... that nobody ever had this kind of concurrency problem with Spring & OSGi (except for the ServiceMix people of course!) and there is no way to make the Spring OSGi Extender behave in a way that it does not start kicking before the OSGi internal class resolution is done ?????

    Comment

    Working...
    X