Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-13610

Karaf Assembly - JaxbAnnotationIntrospector not found by com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider

XMLWordPrintable

    • % %
    • Workaround Exists
    • Hide

      Adding "<bundle>wrap:mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.9.10$overwrite=merge&Import-Package=javax.ws.rs*;version="[2.0,3)",com.fasterxml.jackson.module.jaxb;version="[2.8,3)",com.fasterxml.jackson*;version="[2.8,3)"</bundle>" to bootBundles section in the karaf-maven-plugin configuration and I removed resolution:=optional in the bundle declaration, forcing resolution all the time. This line is commented out in the pom.xml for testing / reproduction.

      Show
      Adding "<bundle>wrap:mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.9.10$overwrite=merge&Import-Package=javax.ws.rs*;version="[2.0,3)",com.fasterxml.jackson.module.jaxb;version="[2.8,3)",com.fasterxml.jackson*;version="[2.8,3)"</bundle>" to bootBundles section in the karaf-maven-plugin configuration and I removed resolution:=optional in the bundle declaration, forcing resolution all the time. This line is commented out in the pom.xml for testing / reproduction.
    • Hide

      See attached reproducer:

      1. Download the attached reproducer
      2. Run mvn clean install
      3. On terminal, navigate to project source directory and run 'target/assembly/bin/karaf server'
      4. The start up should fail with ClassNotFoundException

      Show
      See attached reproducer: 1. Download the attached reproducer 2. Run mvn clean install 3. On terminal, navigate to project source directory and run 'target/assembly/bin/karaf server' 4. The start up should fail with ClassNotFoundException

      This issue does not happen in local standalone fuse distro but only happens when using karaf-maven-plugin to construct an assembly.

      Based on the error message, it looks like, jackson-jaxrs-json-provider has an optional import to jackson-module-jaxb-annotations bundle. In local standalone jackson-jaxrs-json-provider is made to start after jackson-module-jaxb-annotations thus resolving the optional import all the time.

      But in karaf assembly - this sequence is missing causing jaxb-annotations to start later than jackson-jaxrs-json-provider — causing optional dependency to be never satisfied even though the bundle there.

      2020-04-27 09:04:12,205 | ERROR | features-3-thread-1  | o.a.a.b.c.BlueprintContainerImpl | 17 - org.apache.aries.blueprint.core - 1.10.2 | Unable to start container for blueprint bundle cxfrs-fuse-karaf.1.0-SNAPSHOT/1.0.0.SNAPSHOT
      org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to convert value BeanRecipe[name='#recipe-9'] to type class java.lang.Object
      	at org.apache.aries.blueprint.di.CollectionRecipe.internalCreate(CollectionRecipe.java:92) ~[?:?]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:108) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:810) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:784) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:765) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:699) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:666) ~[?:?]
      	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:81) ~[?:?]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_252]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:90) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:360) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:190) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:737) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:433) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:298) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:311) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:280) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276) ~[?:?]
      	at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:266) ~[?:?]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) ~[?:?]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) ~[?:?]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) ~[?:?]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) ~[?:?]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) ~[?:?]
      	at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179) ~[?:?]
      	at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730) ~[?:?]
      	at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485) ~[?:?]
      	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
      	at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
      	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
      	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
      	at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.startBundle(BundleInstallSupportImpl.java:165) ~[?:?]
      	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1153) ~[?:?]
      	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1036) ~[?:?]
      	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062) ~[?:?]
      	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998) ~[?:?]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
      	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
      Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean #recipe-9 of class com.example.cxfrs.JacksonJaxbProviderFactory
      	at org.apache.aries.blueprint.container.BeanRecipe.wrapAsCompDefEx(BeanRecipe.java:362) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromStaticFactory(BeanRecipe.java:332) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:281) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:685) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:666) ~[?:?]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:108) ~[?:?]
      	at org.apache.aries.blueprint.di.CollectionRecipe.internalCreate(CollectionRecipe.java:90) ~[?:?]
      	... 39 more
      Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/module/jaxb/JaxbAnnotationIntrospector
      	at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator._resolveIntrospector(JsonMapperConfigurator.java:109) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator._resolveIntrospectors(JsonMapperConfigurator.java:84) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.cfg.MapperConfiguratorBase._setAnnotations(MapperConfiguratorBase.java:120) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator.mapper(JsonMapperConfigurator.java:66) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.cfg.MapperConfiguratorBase.configure(MapperConfiguratorBase.java:93) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.base.ProviderBase.configure(ProviderBase.java:349) ~[?:?]
      	at java.util.HashMap.forEach(HashMap.java:1289) ~[?:1.8.0_252]
      	at com.example.cxfrs.JacksonJaxbProviderFactory.create(JacksonJaxbProviderFactory.java:93) ~[?:?]
      	at com.example.cxfrs.JacksonJaxbProviderFactory.newInstance(JacksonJaxbProviderFactory.java:71) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
      	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:337) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:835) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromStaticFactory(BeanRecipe.java:330) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:281) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:685) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:666) ~[?:?]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:108) ~[?:?]
      	at org.apache.aries.blueprint.di.CollectionRecipe.internalCreate(CollectionRecipe.java:90) ~[?:?]
      	... 39 more
      Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector not found by com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider [113]
      	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639) ~[?:?]
      	at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
      	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053) ~[?:?]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_252]
      	at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator._resolveIntrospector(JsonMapperConfigurator.java:109) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator._resolveIntrospectors(JsonMapperConfigurator.java:84) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.cfg.MapperConfiguratorBase._setAnnotations(MapperConfiguratorBase.java:120) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator.mapper(JsonMapperConfigurator.java:66) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.cfg.MapperConfiguratorBase.configure(MapperConfiguratorBase.java:93) ~[?:?]
      	at com.fasterxml.jackson.jaxrs.base.ProviderBase.configure(ProviderBase.java:349) ~[?:?]
      	at java.util.HashMap.forEach(HashMap.java:1289) ~[?:1.8.0_252]
      	at com.example.cxfrs.JacksonJaxbProviderFactory.create(JacksonJaxbProviderFactory.java:93) ~[?:?]
      	at com.example.cxfrs.JacksonJaxbProviderFactory.newInstance(JacksonJaxbProviderFactory.java:71) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
      	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:337) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:835) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromStaticFactory(BeanRecipe.java:330) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:281) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:685) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:666) ~[?:?]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:108) ~[?:?]
      	at org.apache.aries.blueprint.di.CollectionRecipe.internalCreate(CollectionRecipe.java:90) ~[?:?]
      	... 39 more
      

              ldemasi Luigi De Masi
              rhn-support-mrobson Matt Robson
              Salvatore Mongiardo Salvatore Mongiardo
              Francesco Mongiardo, Lukas Lowinger, Vratislav Hais (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: