eclipse-kura / kura

Eclipse Kura™ is a versatile framework to supercharge your edge devices, streamlining the process of configuring your gateway, connecting sensors, and IoT devices to seamlessly collect, process, and send data to the cloud.
https://eclipse.dev/kura/
Eclipse Public License 2.0
500 stars 309 forks source link

[Modem] NoClassDefFoundError: Could not initialize class org.eclipse.kura.linux.net.modem.SupportedUsbModems #640

Closed MMaiero closed 7 years ago

MMaiero commented 8 years ago

This issue is caused by commit 9f5870537e36afa6641dc6d3d237686e82407f02 Everything works right if the device has no internal modem, while, if the modem is available, the execution will stop at boot due to a NoClassDefFoundError on class org.eclipse.kura.linux.net.modem.SupportedUsbModems.

The issue is triggered by SupportedUsbModemsInfo.isSupported that tries to call SupportedUsbModems.isSupported. Before executing the isSupported method, the SupportedUsbModems static block will invoke getLsusbInfo that will call LinuxProcessUtil.startWithStats. The static block in LinuxProcessUtil modified by 9f5870537e36afa6641dc6d3d237686e82407f02 tries to get a service reference of the SystemService, but the result of this invocation is a null value. This is due to the fact that the SystemService component definition has a dependency on the NetworkService, but the network service needs the SystemService to execute: an indirect dependency loop is generated in this way, preventing the code to execute properly.

@ctron Could you take a look at this?

MMaiero commented 8 years ago

This is the stack trace:

!ENTRY org.eclipse.equinox.ds 4 0 2016-10-17 14:28:09.260 !MESSAGE [SCR] Exception while activating instance org.eclipse.kura.linux.net.NetworkServiceImpl@13b2f29 of component org.eclipse.kura.net.NetworkService !STACK 0 java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 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.getEligible(Resolver.java:343) at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry$1.run(ServiceRegistry.java:775) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:773) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451) at org.apache.felix.gogo.shell.Activator.startShell(Activator.java:114) at org.apache.felix.gogo.shell.Activator.access$000(Activator.java:35) at org.apache.felix.gogo.shell.Activator$1.addingService(Activator.java:135) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) at org.apache.felix.gogo.shell.Activator.processorTracker(Activator.java:150) at org.apache.felix.gogo.shell.Activator.start(Activator.java:47) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) at org.eclipse.equinox.console.command.adapter.Activator.startBundle(Activator.java:248) at org.eclipse.equinox.console.command.adapter.Activator.start(Activator.java:238) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:215) at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:297) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:151) Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.kura.linux.net.modem.SupportedUsbModems at org.eclipse.kura.linux.net.modem.SupportedUsbModemsInfo.isSupported(SupportedUsbModemsInfo.java:42) at org.eclipse.kura.linux.net.NetworkServiceImpl.activate(NetworkServiceImpl.java:177) ... 51 more Root exception: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.kura.linux.net.modem.SupportedUsbModems at org.eclipse.kura.linux.net.modem.SupportedUsbModemsInfo.isSupported(SupportedUsbModemsInfo.java:42) at org.eclipse.kura.linux.net.NetworkServiceImpl.activate(NetworkServiceImpl.java:177) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 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.getEligible(Resolver.java:343) at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry$1.run(ServiceRegistry.java:775) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:773) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451) at org.apache.felix.gogo.shell.Activator.startShell(Activator.java:114) at org.apache.felix.gogo.shell.Activator.access$000(Activator.java:35) at org.apache.felix.gogo.shell.Activator$1.addingService(Activator.java:135) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) at org.apache.felix.gogo.shell.Activator.processorTracker(Activator.java:150) at org.apache.felix.gogo.shell.Activator.start(Activator.java:47) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) at org.eclipse.equinox.console.command.adapter.Activator.startBundle(Activator.java:248) at org.eclipse.equinox.console.command.adapter.Activator.start(Activator.java:238) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:215) at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:297) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:151)

ctron commented 8 years ago

@MMaiero can you describe a reproducible case for this?

dwoodard1 commented 7 years ago

@ctron @MMaiero Can we close this with the #644 merge?

MMaiero commented 7 years ago

I think we can close. Eventually we can reopen it later.