I got this exception starting my bundle:
java.lang.NoClassDefFoundError: gnu/io/SerialPortEventListener
My bundle is using this bundle:[1]enocean library the enocean library[1] is using the rxtx library that I added it as a bundle in my project, the rxtx contains the not found class: "SerialPortEventListener"
the EnOcean library[1] is declaring the package gnu.io as an imported package , and the bundle rxtx is exporting the package, the package version is the same.
I found out that the error NoClassDefFoundError is lanched if the class depends of another class that can't be found, but the SerialPortEventListener is an interface inhiriting from EventListener.
Can't find out why the equinox can't found it.
!ENTRY org.eclipse.equinox.ds 4 0 2015-06-22 12:55:02.616
!MESSAGE [SCR] Exception while activating instance org.eclipse.kura.binding.enocean.EnOcean@79d49d of component org.eclipse.kura.binding.enocean
!STACK 0
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:235)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:347)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473)
at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217)
at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816)
at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783)
at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)
Caused by: java.lang.NoClassDefFoundError: gnu/io/SerialPortEventListener
at org.eclipse.kura.binding.enocean.EnOcean.activate(EnOcean.java:27)
... 15 more
Caused by: java.lang.ClassNotFoundException: gnu.io.SerialPortEventListener
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 16 more
Root exception:
java.lang.NoClassDefFoundError: gnu/io/SerialPortEventListener
at org.eclipse.kura.binding.enocean.EnOcean.activate(EnOcean.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:235)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:347)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473)
at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217)
at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816)
at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783)
at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)
Caused by: java.lang.ClassNotFoundException: gnu.io.SerialPortEventListener
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 16 more
Updates: I tried a new approach, I copied the source file of the EnOcean library into my bundle, those sources uses the libary [2]Reflections
I warraped the library into a bundle (using eclipse: creating bundle from exiting archives) and I started it (the bundles starts with no error)
I imported the needed packages from the bundle Reflections but starting my bundle causes the same error but in the Reflections bundle
I started the bundle guava since it is the one causing the error but without success, I added the packages of the bundle guava[3] needed by the reflections as imported packages and again no success :( Here is the error:
Root exception:
java.lang.NoClassDefFoundError: com/google/common/collect/Lists
at org.reflections.util.FilterBuilder.<init>(FilterBuilder.java:24)
at org.reflections.scanners.SubTypesScanner.<init>(SubTypesScanner.java:19)
at org.reflections.scanners.SubTypesScanner.<init>(SubTypesScanner.java:12)
at org.reflections.util.ConfigurationBuilder.<init>(ConfigurationBuilder.java:53)
at EnOcean.EEP.EEPRegistry.<init>(EEPRegistry.java:26)
at EnOcean.EEP.EEPRegistry.getInstance(EEPRegistry.java:53)
at EnOceanLibrary.communication.EnJConnection.initCommon(EnJConnection.java:205)
at EnOceanLibrary.communication.EnJConnection.<init>(EnJConnection.java:154)
at org.eclipse.kura.binding.enocean.EnOcean.activate(EnOcean.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:235)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:347)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473)
at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217)
at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816)
at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783)
at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)
Thanks in advance for your help!
[1] https://github.com/dog-gateway/enj-library
[2] http://mvnrepository.com/artifact/org.reflections/reflections/0.9.9-RC2
[3] http://mvnrepository.com/artifact/com.google.guava/guava/15.0
The exception seems to be coming from the
org.eclipse.kura.binding.enocean
bundle, not from the EnJ-Library bundle.Does
org.eclipse.kura.binding.enocean
import the packagegnu.io
?