Hi everyone.
When trying to send a JSON-RPC request to the OpenEMS Backend, I get a ClassCastException. This happens not only when trying to make the request but also when opening any URL under localhost:8075, as can be seen here:
After running the Backend, I simply created a Backend2Backend.Rest component, which uses the port 8075 by default, and tried to send a Postman request. This issue occurred while running the latest Backend Docker image, but I also attempted to run the backend through the source code in Eclipse, and got the same Exception, shown below.
Exception log in Eclipse
2025-06-17T17:37:46,490 [00508-85] WARN [.eclipse.jetty.server.Response] writeError: status=500, message=java.lang.ClassCastException: class org.eclipse.jetty.server.internal.HttpChannelState$ChannelRequest cannot be cast to class jakarta.servlet.http.HttpServletRequest (org.eclipse.jetty.server.internal.HttpChannelState$ChannelRequest is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @7feb1d2e; jakarta.servlet.http.HttpServletRequest is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @43d4ef87), response=ErrorResponse@686e752e{500,GET@6c51fcfb http://localhost:8075/favicon.ico HTTP/1.1}
java.lang.ClassCastException: class org.eclipse.jetty.server.internal.HttpChannelState$ChannelRequest cannot be cast to class jakarta.servlet.http.HttpServletRequest (org.eclipse.jetty.server.internal.HttpChannelState$ChannelRequest is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @7feb1d2e; jakarta.servlet.http.HttpServletRequest is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @43d4ef87)
at io.openems.backend.b2brest.RestHandler.handle(RestHandler.java:44) ~[?:?]
at org.eclipse.jetty.server.Server.handle(Server.java:182) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.server.internal.HttpChannelState$HandlerInvoker.run(HttpChannelState.java:662) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.server.internal.HttpConnection.onFillable(HttpConnection.java:416) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:99) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:480) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:443) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:293) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:195) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:979) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1209) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1164) ~[org.apache.felix.http.jetty12-1.0.28.jar:?]
at java.lang.Thread.run(Thread.java:1583) [?:?]
The problematic line that is stated in the above log (RestHandler.java:44), contains the following code:
HttpServletRequest httpRequest = (HttpServletRequest) baseRequest;
I am unsure of what the exact issue might be, and would appreciate any help here.