Many identical Null Pointer Exceptions when installing REST Documentation or when restarting OH2

For a while now I’m running nightly snapshots. They invariably throw many NullPointerExceptions when I restart OH2. And apparently as well when I attempt at installing the REST documentation.

Here’s one representative example exception:

2019-07-09 11:37:28.728 [ERROR] [org.openhab.core.io.rest.publisher ] - bundle org.openhab.core.io.rest.publisher:2.5.0.201907090319 (157)[org.openhab.core.io.rest.publisher.internal.ResourceRegistrator(348)] : The removeOhRESTResource method has thrown an exception
java.lang.NullPointerException: null
at org.openhab.core.thirdparty.com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.getPort(JAXRSConnector.java:175) ~[?:?]
at org.openhab.core.thirdparty.com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.doRemoveResource(JAXRSConnector.java:220) ~[?:?]
at org.openhab.core.thirdparty.com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.removeResource(JAXRSConnector.java:213) ~[?:?]
at org.openhab.core.io.rest.publisher.internal.ResourceRegistrator.removeOhRESTResource(ResourceRegistrator.java:72) ~[?:?]
at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228) ~[42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) ~[42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BindMethod.invoke(BindMethod.java:42) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.DependencyManager.invokeUnbindMethod(DependencyManager.java:1927) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.DependencyManager.close(DependencyManager.java:1682) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.SingleComponentManager.disposeImplementationObject(SingleComponentManager.java:416) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.SingleComponentManager.deleteComponent(SingleComponentManager.java:163) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.doDeactivate(AbstractComponentManager.java:831) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:805) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:584) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.disposeComponents(ConfigurableComponentHolder.java:716) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.BundleComponentActivator.dispose(BundleComponentActivator.java:510) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.Activator.disposeComponents(Activator.java:429) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.Activator.access$300(Activator.java:49) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.Activator$ScrExtension.destroy(Activator.java:292) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.AbstractExtender$1.run(AbstractExtender.java:216) [42:org.apache.felix.scr:2.1.16]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at org.apache.felix.scr.impl.AbstractExtender.destroyExtension(AbstractExtender.java:238) [42:org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.AbstractExtender.bundleChanged(AbstractExtender.java:132) [42:org.apache.felix.scr:2.1.16]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908) [?:?]
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.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168) [?:?]
at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) [?:?]
at org.eclipse.osgi.container.Module.doStop(Module.java:634) [?:?]
at org.eclipse.osgi.container.Module.stop(Module.java:498) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1675) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1594) [?:?]
at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:270) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:147) [?:?]
at org.eclipse.osgi.container.Module.doStop(Module.java:636) [?:?]
at org.eclipse.osgi.container.Module.stop(Module.java:498) [?:?]
at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

Is this a know issue?

I don’t recall if there is an open issue, but after clearing the cache OH gets a lot of errors. These include ones for org.openhab.core.io.rest.publisher, but this started recently. Restart again and the errors should be gone.

Hi all,

Yes, it is known. We are aware of it and working on it. But we did not open a related issue for it on GitHub. The NPEs will occurr every time the REST service will be shut down.