openHAB Cloud "class org.json.JSONObject cannot be cast to class org.json.JSONObject"

Hi there,

I’m having trouble conneting to my openHAB instance remotely since a couple of days. It appears online, but connecting is not possible and also alexa is always telling me, that my devices are not responding. I did not change anything since then, as far as I know, and I can’t wrap my head around this error message:

2022-08-08 14:47:31.816 [ERROR] [io.socket.thread.EventThread        ] - Task threw exception

java.lang.ClassCastException: class org.json.JSONObject cannot be cast to class org.json.JSONObject (org.json.JSONObject is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @6dce91e4; org.json.JSONObject is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3d112869)

	at org.openhab.io.openhabcloud.internal.CloudClient$12.call(CloudClient.java:304) ~[?:?]

	at io.socket.emitter.Emitter.emit(Emitter.java:117) ~[bundleFile:?]

	at io.socket.client.Socket.onevent(Socket.java:338) ~[?:?]

	at io.socket.client.Socket.onpacket(Socket.java:289) ~[?:?]

	at io.socket.client.Socket.access$100(Socket.java:24) ~[?:?]

	at io.socket.client.Socket$2$2.call(Socket.java:120) ~[?:?]

	at io.socket.emitter.Emitter.emit(Emitter.java:117) ~[bundleFile:?]

	at io.socket.client.Manager.ondecoded(Manager.java:431) ~[?:?]

	at io.socket.client.Manager.access$1600(Manager.java:30) ~[?:?]

	at io.socket.client.Manager$7.call(Manager.java:407) ~[?:?]

	at io.socket.parser.IOParser$Decoder.add(IOParser.java:105) ~[?:?]

	at io.socket.client.Manager.ondata(Manager.java:423) ~[?:?]

	at io.socket.client.Manager.access$1000(Manager.java:30) ~[?:?]

	at io.socket.client.Manager$2.call(Manager.java:374) ~[?:?]

	at io.socket.emitter.Emitter.emit(Emitter.java:117) ~[bundleFile:?]

	at io.socket.engineio.client.Socket.onPacket(Socket.java:551) ~[bundleFile:?]

	at io.socket.engineio.client.Socket.access$1000(Socket.java:36) ~[bundleFile:?]

	at io.socket.engineio.client.Socket$5.call(Socket.java:335) ~[bundleFile:?]

	at io.socket.emitter.Emitter.emit(Emitter.java:117) ~[bundleFile:?]

	at io.socket.engineio.client.Transport.onPacket(Transport.java:126) ~[bundleFile:?]

	at io.socket.engineio.client.Transport.onData(Transport.java:118) ~[bundleFile:?]

	at io.socket.engineio.client.transports.WebSocket.access$100(WebSocket.java:24) ~[bundleFile:?]

	at io.socket.engineio.client.transports.WebSocket$1$2.run(WebSocket.java:71) ~[bundleFile:?]

	at io.socket.thread.EventThread$2.run(EventThread.java:80) [bundleFile:?]

	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) [?:?]

The error occurres every time I try to connect through myopenhab or sending a command through alexa. There is no other messages, although I set the logging to TRACE. I’m running openhab 3.3 in a docker container (latest-debian). I already cleared userdata, keeping only jsondbs and /conf folder and reinstalled the whole docker image without success.

Can anybody help me pin down the problem?

Thanks in advance,
Janis

Hi,
I can’t help but I have exactly the same problem a few days after updating from 3.2 to 3.3. I am running Openhabian on a raspberry pi. The logs showing the same errors.
Amazon binding also doesn’t work anymore.

Hope that someone can help here.

Hi,

I just solved it for my setup with a lot of trial and error. Turns out, I actually did change my setup recently. I installed the binding Solar Forecast PV. After uninstalling it, it started to work again. Do you have this binding installed? Or maybe some other binding, that communicates via json, is causing the issue for you?

Regards,
Janis

Hi,
you are right I have also installed the solar forecast PV binding. I will try it with uninstalling this binding when I’m back home.

Thanks in advance.

Hi,
thanks for the hint… uninstalling the bundle also resolved the problem immediately in my setup. I reported the issue to the Solar Forecast developer via the marketplace.

Looks like a version dependency issue which is fixed in v0.5 now.

I’m just curious why this doesn’t happend on my side. Running also OH3.3 with Cloud Connector which I use all the time. Maybe this issue appears only after updating but I cannot explain 100%.

Nevertheless the version fix is absolutely necessary so please give the new version a try.

1 Like

No more exceptions in log after installing v0.5 :+1:

1 Like