mmornati / springboot-osgi-sample

OSGi framework integrated into SpringBoot application
Apache License 2.0
38 stars 18 forks source link

java.lang.NoClassDefFoundError with bundle sample-bundle-scr #10

Closed jmini closed 3 years ago

jmini commented 3 years ago

To reproduce:

In the root folder of this repository:

I get this error:

INFO 91936 --- [stall-./plugins] c.m.s.c.plugins.AbstractPluginActivator  : Service registered: com.mornati.sample.plugin.psp.sample.Sample
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: javax/naming/NamingException
    at ch.qos.logback.classic.joran.JoranConfigurator.addInstanceRules(JoranConfigurator.java:48)
    at ch.qos.logback.core.joran.GenericConfigurator.buildInterpreter(GenericConfigurator.java:134)
    at ch.qos.logback.core.joran.JoranConfiguratorBase.buildInterpreter(JoranConfiguratorBase.java:95)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:162)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
    at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
    at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
    at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at com.mornati.sample.plugin.psp.scr.SampleScr.<clinit>(SampleScr.java:11)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at org.apache.felix.scr.impl.inject.internal.ComponentConstructorImpl.newInstance(ComponentConstructorImpl.java:312)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:286)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:1000)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:973)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:918)
    at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:349)
    at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:249)
    at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:362)
    at org.apache.felix.framework.Felix.getService(Felix.java:3984)
    at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:450)
    at com.mornati.sample.service.SpringAwareBundleListener.lambda$bundleChanged$0(SpringAwareBundleListener.java:39)
    at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4203)
    at com.mornati.sample.service.SpringAwareBundleListener.bundleChanged(SpringAwareBundleListener.java:39)
    at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
    at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
    at org.apache.felix.framework.EventDispatcher.run(EventDispatcher.java:1147)
    at org.apache.felix.framework.EventDispatcher.access$000(EventDispatcher.java:54)
    at org.apache.felix.framework.EventDispatcher$1.run(EventDispatcher.java:102)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.ClassNotFoundException: javax.naming.NamingException not found by sample-bundle-scr [6]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1585)
    at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1970)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 42 more
ERROR : bundle sample-bundle-scr:0.0.1.202102042016 (6)[com.mornati.sample.plugin.psp.scr.SampleScr(0)] : Error during instantiation of the implementation object
java.lang.NoClassDefFoundError: javax/naming/NamingException
    at ch.qos.logback.classic.joran.JoranConfigurator.addInstanceRules(JoranConfigurator.java:48)
    at ch.qos.logback.core.joran.GenericConfigurator.buildInterpreter(GenericConfigurator.java:134)
    at ch.qos.logback.core.joran.JoranConfiguratorBase.buildInterpreter(JoranConfiguratorBase.java:95)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:162)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
    at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
    at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
    at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at com.mornati.sample.plugin.psp.scr.SampleScr.<clinit>(SampleScr.java:11)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at org.apache.felix.scr.impl.inject.internal.ComponentConstructorImpl.newInstance(ComponentConstructorImpl.java:312)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:286)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:1000)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:973)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:918)
    at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:349)
    at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:249)
    at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:362)
    at org.apache.felix.framework.Felix.getService(Felix.java:3984)
    at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:450)
    at com.mornati.sample.service.SpringAwareBundleListener.lambda$bundleChanged$0(SpringAwareBundleListener.java:39)
    at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4203)
    at com.mornati.sample.service.SpringAwareBundleListener.bundleChanged(SpringAwareBundleListener.java:39)
    at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
    at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
    at org.apache.felix.framework.EventDispatcher.run(EventDispatcher.java:1147)
    at org.apache.felix.framework.EventDispatcher.access$000(EventDispatcher.java:54)
    at org.apache.felix.framework.EventDispatcher$1.run(EventDispatcher.java:102)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.ClassNotFoundException: javax.naming.NamingException not found by sample-bundle-scr [6]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1585)
    at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1970)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 42 more

INFO 91936 --- [ixDispatchQueue] c.m.s.service.SpringAwareBundleListener  : Bundle sample-bundle:0.0.1.SNAPSHOT changed state to Active - Type: Active
ERROR : bundle sample-bundle-scr:0.0.1.202102042016 (6)[com.mornati.sample.plugin.psp.scr.SampleScr(0)] : Error during instantiation of the implementation object
java.lang.NoClassDefFoundError: Could not initialize class com.mornati.sample.plugin.psp.scr.SampleScr
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at org.apache.felix.scr.impl.inject.internal.ComponentConstructorImpl.newInstance(ComponentConstructorImpl.java:312)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:286)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:1000)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:973)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:918)
    at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:349)
    at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:249)
    at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:362)
    at org.apache.felix.framework.Felix.getService(Felix.java:3984)
    at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:450)
    at com.mornati.sample.service.SpringAwareBundleListener.lambda$bundleChanged$0(SpringAwareBundleListener.java:39)
    at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4203)
    at com.mornati.sample.service.SpringAwareBundleListener.bundleChanged(SpringAwareBundleListener.java:39)
    at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
    at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
    at org.apache.felix.framework.EventDispatcher.run(EventDispatcher.java:1147)
    at org.apache.felix.framework.EventDispatcher.access$000(EventDispatcher.java:54)
    at org.apache.felix.framework.EventDispatcher$1.run(EventDispatcher.java:102)
    at java.base/java.lang.Thread.run(Thread.java:832)

INFO 91936 --- [ixDispatchQueue] c.m.s.service.SpringAwareBundleListener  : Bundle sample-bundle:0.0.1.SNAPSHOT changed state to Active - Type: Installed
ERROR : bundle sample-bundle-scr:0.0.1.202102042016 (6)[com.mornati.sample.plugin.psp.scr.SampleScr(0)] : Error during instantiation of the implementation object
java.lang.NoClassDefFoundError: Could not initialize class com.mornati.sample.plugin.psp.scr.SampleScr
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at org.apache.felix.scr.impl.inject.internal.ComponentConstructorImpl.newInstance(ComponentConstructorImpl.java:312)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:286)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:1000)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:973)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:918)
    at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:349)
    at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:249)
    at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:362)
    at org.apache.felix.framework.Felix.getService(Felix.java:3984)
    at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:450)
    at com.mornati.sample.service.SpringAwareBundleListener.lambda$bundleChanged$0(SpringAwareBundleListener.java:39)
    at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4203)
    at com.mornati.sample.service.SpringAwareBundleListener.bundleChanged(SpringAwareBundleListener.java:39)
    at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
    at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
    at org.apache.felix.framework.EventDispatcher.run(EventDispatcher.java:1147)
    at org.apache.felix.framework.EventDispatcher.access$000(EventDispatcher.java:54)
    at org.apache.felix.framework.EventDispatcher$1.run(EventDispatcher.java:102)
    at java.base/java.lang.Thread.run(Thread.java:832)