HomeKit - The unsetItemRegistry method has thrown an exception

Hi,

I’ve had my Homekit running for a week or so and after I had to restart all my equipment, it seemed to stop working. I did not realize immediately because i only use it for presence-detection. So one day I check my logs and see this entry:

2019-03-23 21:00:11.053 [ERROR] [org.openhab.io.homekit              ] - bundle org.openhab.io.homekit:2.5.0.201903042328 (265)[org.openhab.io.homekit.internal.HomekitImpl(308)] : The unsetItemRegistry method has thrown an exception
java.lang.NullPointerException: null
	at org.openhab.io.homekit.internal.HomekitChangeListener.setItemRegistry(HomekitChangeListener.java:82) ~[?:?]
	at org.openhab.io.homekit.internal.HomekitImpl.unsetItemRegistry(HomekitImpl.java:71) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	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.14]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) ~[42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod$NotResolved.invoke(BaseMethod.java:619) ~[42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.inject.methods.BindMethod.invoke(BindMethod.java:42) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.DependencyManager.invokeUnbindMethod(DependencyManager.java:1927) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.DependencyManager.close(DependencyManager.java:1682) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.disposeImplementationObject(SingleComponentManager.java:417) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.deleteComponent(SingleComponentManager.java:163) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.doDeactivate(AbstractComponentManager.java:831) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:805) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:584) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.disposeComponents(ConfigurableComponentHolder.java:716) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.BundleComponentActivator.dispose(BundleComponentActivator.java:511) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.Activator.disposeComponents(Activator.java:428) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.Activator.access$300(Activator.java:49) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.Activator$ScrExtension.destroy(Activator.java:291) [42:org.apache.felix.scr:2.1.14]
	at org.apache.felix.scr.impl.AbstractExtender$1.run(AbstractExtender.java:216) [42:org.apache.felix.scr:2.1.14]
	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.14]
	at org.apache.felix.scr.impl.AbstractExtender.bundleChanged(AbstractExtender.java:132) [42:org.apache.felix.scr:2.1.14]
	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$1.run(EquinoxEventPublisher.java:124) [?:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher$1.run(EquinoxEventPublisher.java:1) [?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:122) [?:?]
	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.internal.framework.EquinoxBundle.stop(EquinoxBundle.java:410) [?:?]
	at org.apache.karaf.bundle.command.Restart.doExecute(Restart.java:44) [45:org.apache.karaf.bundle.core:4.2.2]
	at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) [45:org.apache.karaf.bundle.core:4.2.2]
	at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [14:org.apache.karaf.shell.core:4.2.2]
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [14:org.apache.karaf.shell.core:4.2.2]
	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) [?:?]
2019-03-23 21:00:11.352 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory EternalHome
2019-03-23 21:00:11.388 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory Arbeitszimmer Osram B40 Farbtemperatur
2019-03-23 21:00:11.391 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2019-03-23 21:00:11.391 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory Arbeitszimmer Osram B40 Helligkeit
2019-03-23 21:00:11.392 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2019-03-23 21:00:11.392 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory Homekit Presence - 01 Switch Virtuell
2019-03-23 21:00:11.393 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2019-03-23 21:00:11.393 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory Arbeitszimmer Osram B40 Switch Virtuell
2019-03-23 21:00:11.394 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2019-03-23 21:00:11.394 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory HomeKit Presence  Gruppe - Virtuell
2019-03-23 21:00:11.395 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2019-03-23 21:00:11.397 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory Homekit Presence - 02 Switch Virtuell
2019-03-23 21:00:11.398 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections

This entry is from right now. I tried to restart the HomeKit with bundle:restart. Even tried to re-add the bridge via this post:

Unfortunately, it’s not helping. I have around 40+ Things in OpenHAB and approx. 160 Items right now. I read about the Hard Limit of 150 items in HomeKit but from my understanding it’s the limit of devices that are propagated to HomeKit - And I only tagged around 10 items for HomeKit.

I looked at a bunch of different topics that deal with the same “No Answer / Keine Antwort” in HomeKit from the bridge but they pointed to missing MAC in the jsondb etc. which is fine for me.
Any help is appreciated.

Thanks and cheers,

I am getting this exception too with the latest snapshot. It seems to possibly trace back to this earlier exception:

2019-04-07 13:27:15.543 [ERROR] [org.openhab.io.homekit              ] - bundle org.openhab.io.homekit:2.5.0.201904040140 (239)[org.openhab.io.homekit.internal.HomekitImpl(183)] : The activate method has thrown an exce
ption
java.lang.NoClassDefFoundError: javax/jmdns/JmDNS
        at com.beowulfe.hap.impl.jmdns.JmdnsHomekitAdvertiser.<init>(JmdnsHomekitAdvertiser.java:30) ~[?:?]
        at com.beowulfe.hap.HomekitRoot.<init>(HomekitRoot.java:38) ~[?:?]
        at com.beowulfe.hap.HomekitServer.createBridge(HomekitServer.java:105) ~[?:?]
        at org.openhab.io.homekit.internal.HomekitImpl.start(HomekitImpl.java:127) ~[?:?]
        at org.openhab.io.homekit.internal.HomekitImpl.modified(HomekitImpl.java:89) ~[?:?]
        at org.openhab.io.homekit.internal.HomekitImpl.activate(HomekitImpl.java:76) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        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) ~[43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) ~[43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:341) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:114) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:983) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:956) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:756) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:381) [43:org.apache.felix.scr:2.1.14]
        at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49) [43:org.apache.felix.scr:2.1.14]

Could this be related to the recent commit #4920? I notice that JMDNS seems to have been removed from the manifest in that commit.

@BlackEternity are you also seeing this other exception?

That might indeed be related. Please can someone open a bug report?

Sure, #5432

Hey - sorry for the late reply.
I only saw the message that I posted above.
After tinkering around with different solutions, I came back to HomeKit integration and tried to get it to work.
Unfortunately every couple of days it throws me out and does not respond anymore.
This is the messages I get right now:

2019-04-08 05:26:40.279 [ERROR] [impl.connections.SubscriptionManager] - Failed to create new event message
java.lang.NullPointerException: null
	at com.beowulfe.hap.impl.connections.SubscriptionManager.publish(SubscriptionManager.java:135) ~[?:?]
	at com.beowulfe.hap.impl.connections.SubscriptionManager.lambda$addSubscription$0(SubscriptionManager.java:41) ~[?:?]
	at org.openhab.io.homekit.internal.HomekitAccessoryUpdater.lambda$1(HomekitAccessoryUpdater.java:57) ~[?:?]
	at org.eclipse.smarthome.core.items.GenericItem$1.run(GenericItem.java:262) [134:org.openhab.core:2.5.0.201903021530]
	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) [?:?]

That message is thrown 3 times in a row and then it basically reverts to show “No answer / Keine Antwort” in HomeKit until I restart this exact bundle.
This is really, really sad because as of now, I haven’t found any other way to reliably and QUICKLY get a home presence. iCloud takes forever to get stuff sorted out (damn 5 minute refresh-timer) and I don’t know of another solution without pushing my location through some bogus cloud-connected third-party app :frowning:

So just to be clear, you are able to get the HomeKit binding to start and pair, but it fails after a while?

What build are you running btw?

Hi,

yes after uninstalling the binding and clean restarting it it worked. But it seems to fail after a while.
Currently I’m running openHAB 2.5.0 Build #1549

@BlackEternityhave you opened a ticket up for your issue? I am also seeing this.

Are you aware of the recent improvements of the HomeKit Binding? Maybe it’s worth to double check, if the issue is still present.

I am, I’m running openHAB nightly as of May 19th.

I have opened an issue for this