After upgrade from 3.1 to 3.2, I got this error in the logfile due to some rule (see below):
2021-12-27 10:06:55.917 [WARN ] [org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper ] - javax.ws.rs.ClientErrorException: HTTP 415 Unsupported Media Type
at org.apache.cxf.jaxrs.utils.SpecExceptions.toHttpException(SpecExceptions.java:117)
at org.apache.cxf.jaxrs.utils.ExceptionUtils.toHttpException(ExceptionUtils.java:168)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:565)
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:182)
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:79)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:234)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:82)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:386)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
at java.base/java.lang.Thread.run(Thread.java:829)
It getâs triggered because I restart some things via a rule file. (The binding doesnât always enable the things after openhab restart, so i check it and disable/enable the thing)
The way i do it is like this (i found it here on the forum):
val headers = newHashMap("Authorization" -> "Bearer oh.?????.xxxxxxxxxxxxxxxxxxxxxxxxxxxx", "WWW-Authenticate"-> "Basic")
var statusWoonkamer = getThingStatusInfo("plugwiseha:zone:adam:PW_Woonkamer_zone").getStatus()
var statusKantoor = getThingStatusInfo("plugwiseha:zone:adam:PW_Kantoor_zone").getStatus()
var statusVloerverwarming = getThingStatusInfo("plugwiseha:appliance_pump:adam:PW_Vloerverwarmingspomp").getStatus()
var statusTom = getThingStatusInfo("plugwiseha:appliance_valve:adam:PW_TomWoonkamer").getStatus()
var statusKetel = getThingStatusInfo("plugwiseha:appliance_boiler:adam:PW_Ketel").getStatus()
if (statusWoonkamer.toString != "ONLINE"){
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:zone:adam:PW_Woonkamer_zone/enable", "application/json", 'false', headers, 1000)
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:zone:adam:PW_Woonkamer_zone/enable", "application/json", 'true', headers, 1000)
}
if (statusKantoor.toString != "ONLINE"){
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:zone:adam:PW_Kantoor_zone/enable", "application/json", 'false', headers, 1000)
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:zone:adam:PW_Kantoor_zone/enable", "application/json", 'true', headers, 1000)
}
if (statusVloerverwarming.toString != "ONLINE"){
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:appliance_pump:adam:PW_Vloerverwarmingspomp/enable", "application/json", 'false', headers, 1000)
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:appliance_pump:adam:PW_Vloerverwarmingspomp/enable", "application/json", 'true', headers, 1000)
}
if (statusTom.toString != "ONLINE"){
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:appliance_valve:adam:PW_TomWoonkamer/enable", "application/json", 'false', headers, 1000)
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:appliance_valve:adam:PW_TomWoonkamer/enable", "application/json", 'true', headers, 1000)
}
if (statusKetel.toString != "ONLINE"){
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:appliance_boiler:adam:PW_Ketel/enable", "application/json", 'false', headers, 1000)
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:appliance_boiler:adam:PW_Ketel/enable", "application/json", 'true', headers, 1000)
}
I tested it and itâs this part where it goes wrong:
sendHttpPutRequest("http://192.168.0.145:8080/rest/things/plugwiseha:zone:adam:PW_Woonkamer_zone/enable", "application/json", 'false', headers, 1000)
Isnât it supported anymore in 3.2? Or did i use a flaw in earlier versions? Or is it just a bug in 3.2?
Hope someone knows!