JAXB issue with 6.2 Blueprint container when sharing JAXBContext across bundles

Solution Verified - Updated -

Issue

  • We are migrating from 6.1 to 6.2P2 and one of our existing application which works fine on 6.1 gets some issues during deployment in 6.2.
  • We can see the following log files,
org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean jaxbContext of class javax.xml.bind.JAXBContext
    at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:315)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[21:org.apache.aries.blueprint.core:1.4.2]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:933)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[21:org.apache.aries.blueprint.core:1.4.2]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:933)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[21:org.apache.aries.blueprint.core:1.4.2]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:682)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:377)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[21:org.apache.aries.blueprint.core:1.4.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
    at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[21:org.apache.aries.blueprint.core:1.4.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]
Caused by: javax.xml.bind.JAXBException: <some package name>" doesnt contain ObjectFactory.class or jaxb.index
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:281)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_45]
    at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_45]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:143)[:2.5.0]
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:310)[:2.5.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)[:2.5.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)[:2.5.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:313)[:2.5.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_45]
    at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_45]
    at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)[21:org.apache.aries.blueprint.core:1.4.2]
    at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:313)[21:org.apache.aries.blueprint.core:1.4.2]


  • Same thing works fine in 6.1. Even though it complains about missing objectfactory or jaxb.index file, we can see objectFactory class in the same package.
  • Also this works when using spring file and not with blueprint.

Environment

  • Red Hat JBoss Fuse
    • 6.2.x
  • Aries Blueprint

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content