Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11281

camel-spring is not usable in an osgi-context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.18.0, 2.18.1, 2.18.2, 2.18.3, 2.19.0
    • 2.18.4, 2.19.1, 2.20.0
    • camel-spring
    • None
    • osgi

    • Novice

    Description

      When using camel-spring in an osgi-context with xml-based spring config, following exception occurs:

      org.springframework.beans.factory.BeanDefinitionStoreException: Failed to create the JAXB binder; nested exception is javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index

      • with linked exception:
        [javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index]
        at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:380) ~[?:?]
        at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:61) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1411) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:168) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:138) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[43:org.apache.servicemix.bundles.spring-beans:4.2.6.RELEASE_1]
        at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:170) ~[?:?]
        at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:140) ~[?:?]
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) ~[64:org.apache.servicemix.bundles.spring-context:4.2.6.RELEASE_1]
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609) ~[64:org.apache.servicemix.bundles.spring-context:4.2.6.RELEASE_1]
        at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:60) ~[58:org.eclipse.gemini.blueprint.core:2.0.0.RELEASE]
        at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:242) ~[58:org.eclipse.gemini.blueprint.core:2.0.0.RELEASE]
        at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85) ~[58:org.eclipse.gemini.blueprint.core:2.0.0.RELEASE]
        at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:220) ~[58:org.eclipse.gemini.blueprint.core:2.0.0.RELEASE]
        at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:224) [49:org.eclipse.gemini.blueprint.extender:2.0.0.RELEASE]
        at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:177) [49:org.eclipse.gemini.blueprint.extender:2.0.0.RELEASE]
        at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:157) [58:org.eclipse.gemini.blueprint.core:2.0.0.RELEASE]
        at org.eclipse.gemini.blueprint.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:207) [49:org.eclipse.gemini.blueprint.extender:2.0.0.RELEASE]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
        at java.lang.Thread.run(Thread.java:745) [?:?]
        Caused by: javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146) ~[?:?]
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:356) ~[?:?]
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431) ~[?:?]
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394) ~[?:?]
        at org.apache.camel.impl.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:31) ~[?:?]
        at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:217) ~[?:?]
        at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:378) ~[?:?]
        ... 30 more
        Caused by: javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index
        at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:266) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:171) ~[?:?]
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:131) ~[?:?]
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:356) ~[?:?]
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431) ~[?:?]
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394) ~[?:?]
        at org.apache.camel.impl.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:31) ~[?:?]
        at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:217) ~[?:?]
        at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:378) ~[?:?]
        ... 30 moresun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:171) ~[?:?]
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:131) ~[?:?]
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:356) ~[?:?]
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431) ~[?:?]
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394) ~[?:?]
        at org.apache.camel.impl.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:31) ~[?:?]
        at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:217) ~[?:?]
        at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:378) ~[?:?]
        ... 30 more

      The reason is the fact that not all packages defined in:

      org.apache.camel.model.Constants.JAXB_CONTEXT_PACKAGES

      are listed as Import-Package in the MANIFEST.MF

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              guyv Guy Veraghtert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: