eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
862 stars 783 forks source link

SSE breaks due to BundleException in SseActivator.start() on first startup #6682

Closed wborn closed 4 years ago

wborn commented 5 years ago

When the runtime is started for the first time, sometimes the following exceptions occur:

18:16:48.496 [ERROR] [org.eclipse.smarthome.io.rest.sse    ] - FrameworkEvent ERROR - org.eclipse.smarthome.io.rest.sse
org.osgi.framework.BundleException: Exception in org.eclipse.smarthome.io.rest.sse.internal.SseActivator.start() of bundle org.eclipse.smarthome.io.rest.sse.
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:800) ~[?:?]
    at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:729) [?:?]
    at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:933) ~[?:?]
    at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309) ~[?:?]
    at org.eclipse.osgi.container.Module.doStart(Module.java:581) ~[?:?]
    at org.eclipse.osgi.container.Module.start(Module.java:449) ~[?:?]
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468) ~[?:?]
    at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:750) ~[?:?]
    at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:741) ~[?:?]
    at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:511) ~[?:?]
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:457) ~[?:?]
    at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:1001) ~[?:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1382) ~[?:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1) ~[?:?]
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]
Caused by: java.lang.LinkageError: ClassCastException: attempting to castbundleresource://31.fwk1468303011/javax/ws/rs/ext/RuntimeDelegate.class to bundleresource://31.fwk1468303011/javax/ws/rs/ext/RuntimeDelegate.class
    at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:146) ~[?:?]
    at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120) ~[?:?]
    at javax.ws.rs.core.MediaType.valueOf(MediaType.java:179) ~[?:?]
    at org.glassfish.jersey.media.sse.SseFeature.<clinit>(SseFeature.java:62) ~[?:?]
    at org.eclipse.smarthome.io.rest.sse.internal.SseActivator.start(SseActivator.java:49) ~[?:?]
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:779) ~[?:?]
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1) ~[?:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:772) ~[?:?]
    ... 15 more

...

org.apache.karaf.features.internal.util.MultiException: Error restarting bundles:
    Exception in org.eclipse.smarthome.io.rest.sse.internal.SseActivator.start() of bundle org.eclipse.smarthome.io.rest.sse.
    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1005)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    Suppressed: org.osgi.framework.BundleException: Exception in org.eclipse.smarthome.io.rest.sse.internal.SseActivator.start() of bundle org.eclipse.smarthome.io.rest.sse.
        at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:800)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:729)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:933)
        at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
        at org.eclipse.osgi.container.Module.doStart(Module.java:581)
        at org.eclipse.osgi.container.Module.start(Module.java:449)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
        at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.startBundle(BundleInstallSupportImpl.java:161)
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1116)
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:997)
        ... 6 more
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.glassfish.jersey.media.sse.SseFeature
        at org.eclipse.smarthome.io.rest.sse.internal.SseActivator.start(SseActivator.java:49)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:779)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:772)
        ... 16 more

As a result SSE doesn't work properly and updates aren't received by for instance Basic UI. When the runtime is restarted the exceptions no longer occur and SSE works properly.

This is an old issue and has been around since at least August 2016, see this community post. A community search shows similar issue reports.

Sometimes issues are opened for this in other repositories:

Here's a console.log with Karaf debug logging enabled while reproducing the issue with openHAB 2.4.0.RC1.