Logviewer Warning "EventHandler"

Hi all,

I hope you can help me with this Error I get on my RasPi3 running OH3:

2021-01-04 06:56:38.296 [WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: class org.openhab.core.items.GroupItem cannot be cast to class org.openhab.core.library.items.NumberItem (org.openhab.core.items.GroupItem and org.openhab.core.library.items.NumberItem are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @a2acfa)

java.lang.ClassCastException: class org.openhab.core.items.GroupItem cannot be cast to class org.openhab.core.library.items.NumberItem (org.openhab.core.items.GroupItem and org.openhab.core.library.items.NumberItem are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @a2acfa)

at org.openhab.core.thing.internal.CommunicationManager.convertToQuantityType(CommunicationManager.java:466) ~[?:?]

at org.openhab.core.thing.internal.CommunicationManager.toAcceptedType(CommunicationManager.java:394) ~[?:?]

at org.openhab.core.thing.internal.CommunicationManager.lambda$9(CommunicationManager.java:364) ~[?:?]

at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]

at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]

at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603) ~[?:?]

at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]

at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]

at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]

at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]

at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]

at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]

at org.openhab.core.thing.internal.CommunicationManager.handleEvent(CommunicationManager.java:357) ~[?:?]

at org.openhab.core.thing.internal.CommunicationManager.receiveUpdate(CommunicationManager.java:322) ~[?:?]

at org.openhab.core.thing.internal.CommunicationManager.receive(CommunicationManager.java:172) ~[?:?]

at org.openhab.core.internal.events.EventHandler.lambda$0(EventHandler.java:151) [bundleFile:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

at java.lang.Thread.run(Thread.java:834) [?:?]

Any idea?

Thanks in advance!

I got the same running on a virtual machine. How did you get the full stack trace? I’m only getting the first line written in the logs.

I just copied the full warning from my logviewer @ http://youropenhabdeviceip:9001
I have just installed logviewer but made no changes to the settings.

You have a Group Item that something in OH wants to treat as a Number Item. But that Group Item is not defined as a Group:Number so it can’t do that.

Thanks for the response!

Since I keep getting the same entries in my log I assume I’m having the same root cause.

Since I have a lot of groups, but none of them sticks out as “this must be the one that’s causing the problems” is there a possibility to find out which group is the culprit?

I keep getting the following entry every ~ 10 minutes:

20:54:34.518 [WARN ] [hab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: class org.openhab.core.items.GroupItem cannot be cast to class org.openhab.core.library.items.NumberItem (org.openhab.core.items.GroupItem and org.openhab.core.library.items.NumberItem are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @c27d33)
java.lang.ClassCastException: class org.openhab.core.items.GroupItem cannot be cast to class org.openhab.core.library.items.NumberItem (org.openhab.core.items.GroupItem and org.openhab.core.library.items.NumberItem are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @c27d33)
	at org.openhab.core.thing.internal.CommunicationManager.convertToQuantityType(CommunicationManager.java:482) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.toAcceptedType(CommunicationManager.java:410) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.lambda$9(CommunicationManager.java:380) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
	at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.handleEvent(CommunicationManager.java:373) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.receiveUpdate(CommunicationManager.java:338) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.receive(CommunicationManager.java:186) ~[?:?]
	at org.openhab.core.internal.events.EventHandler.lambda$0(EventHandler.java:151) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

Not a direct answer, but check for -
Groups with an aggregation function, but unsuitable type for it e.g. Group:String:COUNT(xx) MAX/MIN/AVG would be other suspects.
Groups with a label [state presentation] or metadata ‘pattern’ element specifying numeric formatting - %d or %.1f etc.
If you use sitemaps, check there also.

I managed to solve the problem in my case, though I was unable to reproduce the problem / identify the root cause. It probably did have to do with groups somehow, but I’m not 100% sure since I had to do a certain step multiple times. Here’s what helped me:

  1. I identified the culprit (had no idea where to start) by checking the log in the openHAB console via log:tail. The respecitve “EventHandler log entry” always (only) occured every ~10 minutes shortly before a specific device (floor heating thermostat) sent an update of its temperature and humidity, so I guessed it probably had to do with this item / group
  2. I deleted the items of the device (group) and the respectie group altogether. For some strange reason I had to do this multiple times, as the error either did not disappear or come back.

That’s it. Log is now free of EventHandler error.