smarthome
smarthome copied to clipboard
An error occurred while calling the discovery listener (NPE)
Since installation of openhab 2.4.0 and reactivation of the digitalstrom binding my log is flooded with messages like this:
2019-01-10 08:03:14.086 [ERROR] [g.discovery.AbstractDiscoveryService] - An error occurred while calling the discovery listener org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.
java.lang.NullPointerException: null
at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.thingRemoved(DiscoveryServiceRegistryImpl.java:278) ~[100:org.eclipse.smarthome.config.discovery:0.10.0.oh240]
at org.eclipse.smarthome.config.discovery.AbstractDiscoveryService.thingRemoved(AbstractDiscoveryService.java:300) [100:org.eclipse.smarthome.config.discovery:0.10.0.oh240]
at org.eclipse.smarthome.binding.digitalstrom.internal.discovery.DeviceDiscoveryService.onDeviceRemoved(DeviceDiscoveryService.java:188) [248:org.eclipse.smarthome.binding.digitalstrom:0.10.0.oh240]
at org.eclipse.smarthome.binding.digitalstrom.internal.discovery.DiscoveryServiceManager.onDeviceRemoved(DiscoveryServiceManager.java:186) [248:org.eclipse.smarthome.binding.digitalstrom:0.10.0.oh240]
at org.eclipse.smarthome.binding.digitalstrom.internal.lib.manager.impl.DeviceStatusManagerImpl$PollingRunnable.run(DeviceStatusManagerImpl.java:384) [248:org.eclipse.smarthome.binding.digitalstrom:0.10.0.oh240]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
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-01-10 08:03:14.095 [ERROR] [g.discovery.AbstractDiscoveryService] - An error occurred while calling the discovery listener org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.
java.lang.NullPointerException: null
...
2019-01-10 08:03:14.104 [ERROR] [g.discovery.AbstractDiscoveryService] - An error occurred while calling the discovery listener org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.
java.lang.NullPointerException: null
...
2019-01-10 08:03:14.111 [ERROR] [g.discovery.AbstractDiscoveryService] - An error occurred while calling the discovery listener org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.
java.lang.NullPointerException: null
...
https://github.com/eclipse/smarthome/blob/a0e178825541c2ba4b0424cc554fefcf5e4bac35/bundles/config/org.eclipse.smarthome.config.discovery/src/main/java/org/eclipse/smarthome/config/discovery/internal/DiscoveryServiceRegistryImpl.java#L278
It would make sense store the returned reference of cachedResults.get(source)
to a local variable first and return immediately if null
has been returned. Otherwise continue calling iterator()
on that local variable...
Can you come up with a PR?
But perhaps it should be first analyzed why thingRemoved
is called with a not known discovery service.
But perhaps it should be first analyzed why
thingRemoved
is called with a not known discovery service.
As this is caused by the digitalstrom binding it would perhaps a good idea to involve one of the digitalstrom developers here.
Some more details from my side:
- I deleted all things and switched to a file based configuration - nothing changed
- Just after those exceptions all digitalstrom things (duplicates of those which are configured via files) appear once again in the inbox.
2019-01-18 09:45:25.667 [ERROR] [g.discovery.AbstractDiscoveryService] - An error occurred while calling the discovery listener org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.
java.lang.NullPointerException: null
...
2019-01-18 09:45:27.351 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx1' to inbox.
2019-01-18 09:45:27.368 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx2' to inbox.
2019-01-18 09:45:27.384 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx3' to inbox.
2019-01-18 09:45:27.399 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx4' to inbox.
2019-01-18 09:45:27.413 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx5' to inbox.
2019-01-18 09:45:27.434 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx6' to inbox.
2019-01-18 09:45:27.449 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx7' to inbox.
2019-01-18 09:45:27.465 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx8' to inbox.
2019-01-18 09:45:27.480 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'digitalstrom:GR:kasi:xxxxxx9' to inbox.
I am getting a similiar error but for the mqtt binding. Can't get the connection between mosquitto and openhab2 up and running.
2019-01-28 22:27:55.345 [ERROR] [g.discovery.AbstractDiscoveryService] - An error occurred while calling the discovery listener org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.java.lang.NullPointerException: null at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.thingRemoved(DiscoveryServiceRegistryImpl.java:278) ~[?:?] at org.eclipse.smarthome.config.discovery.AbstractDiscoveryService.thingRemoved(AbstractDiscoveryService.java:300) ~[?:?] at org.eclipse.smarthome.binding.mqtt.generic.internal.discovery.HomeAssistantDiscovery.receivedMessage(HomeAssistantDiscovery.java:164) ~[?:?] at org.eclipse.smarthome.binding.mqtt.discovery.TopicSubscribe.processMessage(TopicSubscribe.java:52) ~[?:?] at org.eclipse.smarthome.io.transport.mqtt.internal.ClientCallback.lambda$3(ClientCallback.java:90) ~[?:?] at java.util.ArrayList.forEach(ArrayList.java:1257) [?:?] at org.eclipse.smarthome.io.transport.mqtt.internal.ClientCallback.messageArrived(ClientCallback.java:90) [237:org.eclipse.smarthome.io.transport.mqtt:0.10.0.oh240] at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:499) [233:org.eclipse.paho.client.mqttv3:1.2.0] at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:402) [233:org.eclipse.paho.client.mqttv3:1.2.0] at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:206) [233:org.eclipse.paho.client.mqttv3:1.2.0] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?] 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) [?:?]