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

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

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

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

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

	at io.socket.client.Socket$2$ ~[?:?]

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

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

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

	at io.socket.client.Manager$ ~[?:?]

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

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

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

	at io.socket.client.Manager$ ~[?:?]

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

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

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

	at io.socket.engineio.client.Socket$ ~[bundleFile:?]

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

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

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

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

	at io.socket.engineio.client.transports.WebSocket$1$ ~[bundleFile:?]

	at io.socket.thread.EventThread$ [bundleFile:?]

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

	at java.util.concurrent.ThreadPoolExecutor$ [?:?]

	at [?:?]

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,

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.


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?


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.

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