Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
1.6.2
-
None
-
None
-
OSGi / Karaf
Description
In Camel CDI, when bootstrapped in Karaf container, the following code:
BeanManagerHelper.getReference(manager, CamelContext.class, context);
available at the following location: https://github.com/astefanutti/camel-cdi/blob/d3f1d0c9ca2c119d9df36c5f56b8078d9a4ee9c9/impl/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java#L231
throws:
ERROR: Bundle org.ops4j.pax.cdi.extender [86] EventDispatcher: Error during dispatch. (org.apache.webbeans.exception.WebBeansDeploymentException: Error while sending SystemEvent to a CDI Extension! org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl@3631cfa8) org.apache.webbeans.exception.WebBeansDeploymentException: Error while sending SystemEvent to a CDI Extension! org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl@3631cfa8 at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:697) at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:485) at org.apache.webbeans.container.BeanManagerImpl.fireLifecycleEvent(BeanManagerImpl.java:480) at org.apache.webbeans.config.BeansDeployer.fireAfterDeploymentValidationEvent(BeansDeployer.java:670) at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:283) at org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication(AbstractLifeCycle.java:138) at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:104) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer$1.call(OpenWebBeansCdiContainer.java:98) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer$1.call(OpenWebBeansCdiContainer.java:92) at org.ops4j.pax.swissbox.core.ContextClassLoaderUtils.doWithClassLoader(ContextClassLoaderUtils.java:60) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer.createWebBeansContext(OpenWebBeansCdiContainer.java:92) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer.doStart(OpenWebBeansCdiContainer.java:111) at org.ops4j.pax.cdi.spi.AbstractCdiContainer.start(AbstractCdiContainer.java:87) at org.ops4j.pax.cdi.extender.impl.CdiExtender.createContainer(CdiExtender.java:184) at org.ops4j.pax.cdi.extender.impl.CdiExtender.addingBundle(CdiExtender.java:133) at org.ops4j.pax.cdi.extender.impl.CdiExtender.addingBundle(CdiExtender.java:64) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835) at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:517) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541) at org.apache.felix.framework.Felix.startBundle(Felix.java:2172) 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.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1189) at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:836) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079) at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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: org.apache.webbeans.exception.WebBeansException: java.lang.reflect.InvocationTargetException at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:318) at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:676) ... 35 more Caused by: java.lang.reflect.InvocationTargetException 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:497) at org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:347) at org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke(ContainerEventObserverMethodImpl.java:82) at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:312) ... 36 more Caused by: org.apache.webbeans.exception.ProxyGenerationException: java.lang.NoClassDefFoundError: org/apache/camel/support/ServiceSupport at org.apache.webbeans.proxy.AbstractProxyFactory.defineAndLoadClass(AbstractProxyFactory.java:361) at org.apache.webbeans.proxy.AbstractProxyFactory.createProxyClass(AbstractProxyFactory.java:240) at org.apache.webbeans.proxy.AbstractProxyFactory.createProxyClass(AbstractProxyFactory.java:214) at org.apache.webbeans.proxy.NormalScopeProxyFactory.createProxyClass(NormalScopeProxyFactory.java:269) at org.apache.webbeans.proxy.NormalScopeProxyFactory.createProxyClass(NormalScopeProxyFactory.java:200) at org.apache.webbeans.proxy.NormalScopeProxyFactory.createNormalScopeProxy(NormalScopeProxyFactory.java:149) at org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:767) at org.apache.webbeans.container.InjectableBeanManager.getReference(InjectableBeanManager.java:165) at org.apache.camel.cdi.BeanManagerHelper.getReference(BeanManagerHelper.java:54) at org.apache.camel.cdi.CdiCamelExtension.createCamelContexts(CdiCamelExtension.java:231) ... 43 more Caused by: java.lang.NoClassDefFoundError: org/apache/camel/support/ServiceSupport at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.apache.webbeans.proxy.AbstractProxyFactory.defineAndLoadClass(AbstractProxyFactory.java:356) ... 52 more Caused by: java.lang.ClassNotFoundException: org.apache.camel.support.ServiceSupport not found by io.astefanutti.camel.cdi.camel-cdi-sample-metrics [14] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 55 more
In another test case, the following exception is thrown:
org.apache.webbeans.exception.WebBeansDeploymentException: Error while sending SystemEvent to a CDI Extension! org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl@6968b558 at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:697) at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:485) at org.apache.webbeans.container.BeanManagerImpl.fireLifecycleEvent(BeanManagerImpl.java:480) at org.apache.webbeans.config.BeansDeployer.fireAfterDeploymentValidationEvent(BeansDeployer.java:670) at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:283) at org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication(AbstractLifeCycle.java:138) at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:104) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer$1.call(OpenWebBeansCdiContainer.java:98) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer$1.call(OpenWebBeansCdiContainer.java:92) at org.ops4j.pax.swissbox.core.ContextClassLoaderUtils.doWithClassLoader(ContextClassLoaderUtils.java:60) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer.createWebBeansContext(OpenWebBeansCdiContainer.java:92) at org.ops4j.pax.cdi.openwebbeans.impl.OpenWebBeansCdiContainer.doStart(OpenWebBeansCdiContainer.java:111) at org.ops4j.pax.cdi.spi.AbstractCdiContainer.start(AbstractCdiContainer.java:87) at org.ops4j.pax.cdi.extender.impl.CdiExtender.createContainer(CdiExtender.java:184) at org.ops4j.pax.cdi.extender.impl.CdiExtender.addingBundle(CdiExtender.java:133) at org.ops4j.pax.cdi.extender.impl.CdiExtender.addingBundle(CdiExtender.java:64) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)[org.osgi.core-6.0.0.jar:] at org.ops4j.pax.cdi.extender.impl.CdiExtender.activate(CdiExtender.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_66] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_66] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_66] at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_66] at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:302)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:113)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:866)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:833)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:724)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:954)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:915)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1215)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1136)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:945)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:881)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1167)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:120)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.Felix.registerService(Felix.java:3549)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:869)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:857)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:133)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:915)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:715)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:399)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:676)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:360)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.Activator.access$000(Activator.java:53)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:260)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)[32:org.apache.felix.scr:2.0.2] at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)[32:org.apache.felix.scr:2.0.2] at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)[org.osgi.core-6.0.0.jar:] at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:517)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.Felix.startBundle(Felix.java:2172)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.4.0.jar:] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)[org.apache.felix.framework-5.4.0.jar:] at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1189)[9:org.apache.karaf.features.core:4.0.3] at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:836)[9:org.apache.karaf.features.core:4.0.3] at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3] at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3] at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66] at java.lang.Thread.run(Thread.java:745)[:1.8.0_66] Caused by: org.apache.webbeans.exception.WebBeansException: java.lang.reflect.InvocationTargetException at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:318) at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:676) ... 81 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_66] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_66] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_66] at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_66] at org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:347) at org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke(ContainerEventObserverMethodImpl.java:82) at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:312) ... 82 more Caused by: org.apache.webbeans.exception.ProxyGenerationException: java.lang.reflect.InvocationTargetException at org.apache.webbeans.proxy.AbstractProxyFactory.defineAndLoadClass(AbstractProxyFactory.java:361) at org.apache.webbeans.proxy.AbstractProxyFactory.createProxyClass(AbstractProxyFactory.java:240) at org.apache.webbeans.proxy.AbstractProxyFactory.createProxyClass(AbstractProxyFactory.java:214) at org.apache.webbeans.proxy.NormalScopeProxyFactory.createProxyClass(NormalScopeProxyFactory.java:269) at org.apache.webbeans.proxy.NormalScopeProxyFactory.createProxyClass(NormalScopeProxyFactory.java:200) at org.apache.webbeans.proxy.NormalScopeProxyFactory.createNormalScopeProxy(NormalScopeProxyFactory.java:149) at org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:767) at org.apache.webbeans.container.InjectableBeanManager.getReference(InjectableBeanManager.java:165) at org.apache.camel.cdi.BeanManagerHelper.getReference(BeanManagerHelper.java:54) at org.apache.camel.cdi.CdiCamelExtension.createCamelContexts(CdiCamelExtension.java:231) ... 89 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_66] at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_66] at org.apache.webbeans.proxy.AbstractProxyFactory.defineAndLoadClass(AbstractProxyFactory.java:354) ... 98 more Caused by: java.lang.NoClassDefFoundError: org/apache/webbeans/proxy/OwbNormalScopeProxy at java.lang.ClassLoader.defineClass1(Native Method)[:1.8.0_66] at java.lang.ClassLoader.defineClass(ClassLoader.java:760)[:1.8.0_66] at java.lang.ClassLoader.defineClass(ClassLoader.java:642)[:1.8.0_66] ... 102 more Caused by: java.lang.ClassNotFoundException: org.apache.webbeans.proxy.OwbNormalScopeProxy not found by org.apache.camel.camel-core [30] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_66] ... 105 more
The reproducible test cases are available in: https://github.com/astefanutti/camel-cdi/tree/d3f1d0c9ca2c119d9df36c5f56b8078d9a4ee9c9/envs/osgi/src/test/java/org/apache/camel/cdi/osgi
by running:
mvn clean test -pl envs/osgi/ -Powb