Pulseaudio thing initialization during startup to early and therefore causing an exception?

Dear community,

After having configured the PulseAudio binding with an RTP sink, I realize the following exception thrown upon OpenHAB startup:

2022-03-30 10:21:05.189 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'pulseaudio:bridge:local' changed from UNINITIALIZED to INITIALIZING
2022-03-30 10:21:05.204 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'pulseaudio:sink:local:rtp' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2022-03-30 10:21:06.217 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'pulseaudio:bridge:local' changed from INITIALIZING to ONLINE
2022-03-30 10:21:06.218 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'pulseaudio:sink:local:rtp' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2022-03-30 10:21:06.218 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'pulseaudio:sink:local:rtp' changed from INITIALIZING to OFFLINE
==> /var/log/openhab/openhab.log <==
2022-03-30 10:21:06.218 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.pulseaudio.internal.handler.PulseaudioHandler@a8e1490': class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
	at org.openhab.binding.pulseaudio.internal.handler.PulseaudioHandler.initialize(PulseaudioHandler.java:106) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor80.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	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) [?:?]
2022-03-30 10:21:06.220 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'pulseaudio:sink:local:rtp': class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
	at org.openhab.binding.pulseaudio.internal.handler.PulseaudioHandler.initialize(PulseaudioHandler.java:106) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor80.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	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) [?:?]
==> /var/log/openhab/events.log <==
2022-03-30 10:21:06.223 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'pulseaudio:sink:local:rtp' changed from OFFLINE to UNINITIALIZED (HANDLER_INITIALIZING_ERROR): class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
2022-03-30 10:21:06.223 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'pulseaudio:sink:local:rtp' changed from UNINITIALIZED (HANDLER_INITIALIZING_ERROR): class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap') to ONLINE
==> /var/log/openhab/openhab.log <==
2022-03-30 10:21:06.224 [INFO ] [rnal.handler.PulseaudioBridgeHandler] - Established connection to Pulseaudio server on Host '127.0.0.1':'4712'.

I assume that, at the end, the sink is properly initialized as it goes online. Nevertheless, I wonder what the cause of this exception is or whether I need to adjust my system? Any guidance is appreciated as how to cope with this exception.

Best regards,
Peter

This is probably to do with some stricter config checking on Things recently added to OH. You need to file an issue.

Hello,

It seems that I made an error in the pulseaudio binding documentation.
It shoud be :

activateSimpleProtocolSink=true

WITHOUT the " character around the boolean true

I suppose that is the reason you get this exception.

Hope it will help. I will make a pull request to change the documentation accordingly.

2 Likes

Thanks a lot. Indeed, that helped!