[WARN ] [eclipse.jetty.servlet.ServletHandler] after installing a DHT22

Hello guys,

I´m running Openhab 2.3.0, connected a DHT22 to my raspberry, installed RegEx Transformation and Exec Binding using PaperUI, added these two things:

Thing exec:command:temp_AZ [command="/usr/bin/python2  /home/openhabian/scripts/dht22temp.py", interval=900, autorun=true]
Thing exec:command:hum_AZ [command="/usr/bin/python2  /home/openhabian/scripts/dht22hum.py", interval=900, autorun=true]

and these two items:

String Temp_AZ "Temperature [%s °C]" <temperature> {channel="exec:command:temp_AZ:output"}
String Hum_AZ "Humidity [%s %%]" <humidity> {channel="exec:command:hum_AZ:output"}

Everything works fine, temperature and humidity are displayed correctly.

But now I get the following warning on every restart and shutdown:

2018-08-19 13:06:13.910 [WARN ] [eclipse.jetty.servlet.ServletHandler] - 
javax.servlet.ServletException: A MultiException has 1 exceptions.  They are:
1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_3,4,12273911) has been shut down
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) [15:com.eclipsesource.jaxrs.publisher:]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [82:org.eclipse.jetty.security:9.3.21.v20170918]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.Server.handle(Server.java:534) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [76:org.eclipse.jetty.io:9.3.21.v20170918]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [76:org.eclipse.jetty.io:9.3.21.v20170918]
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [76:org.eclipse.jetty.io:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at java.lang.Thread.run(Thread.java:748) [?:?]

and so on…

When I remove those two items and things, I get no error-message at all. I´ve deleted cache, but nothing has changed. It seems to me that everything else is working fine.

Any ideas what to do?

There is no RegEx in your thing file. Not sure what your script looks like but the regex will be something like:


You can try this just add a comma then the above to end of your thing.

This is my script for temperature:

#!/usr/bin/env python
import sys

import Adafruit_DHT
sensor = Adafruit_DHT.DHT22
pin = 4
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
    print('Failed to get reading. Try again!')

When adding


I get “null”.

So I changed it to


Now I´m getting the correct temperature - and the warning again…

I’m no REGEX expert. :grin: but I changed my script to {1:0:1f} for humid and {0:0:1f} for temp and used the REGEX I posted earlier.

In your things file try adding @@ in the command between python2 and /home so there are no spaces.

Thanks for your help. I´m not an REGEX expert nor an python expert either :see_no_evil:

But when adding @@ so there are no spaces I get an error-message:

Cannot run program "/usr/bin/python2@@/home/openhabian/scripts/dht22temp.py": error=2, No such file or directory

Take the @@'s back out and we can start from what we know works.

You get the temp but a warning, so maybe try to comment out your thing for humidity and see if the warning stops.

This morning I commented out the temperature thing and the humidity thing and items and the warning disapeared.

When I comment it out now, the warning stays on… I uninstalled the regex transformation and the exec-binding (step by step with a restart and cleand up cache and temp), but the warning still stays on.

So maybe this is a general problem. I think I will set up the whole system again and see what happens.

How did you install openhab?

I´ve installed openhabian 1.4.1 on a RPi3B+. I´m using only a few bindings and everything is working fine, apart from this warning-message .

How did you install openhab, did you flash the openhabian image to SD card, Did you install via package repos or did you manually install?

Here is a link to the doc’s if needed. https://www.openhab.org/docs/installation/linux.html#installation

I´ve carefully followed the " Hassle-free openHAB Setup" step by step https://www.openhab.org/docs/installation/openhabian.html. I´ve added a few things like TV, lights etc., created some rules and everything was fine.

Probably something went wrong when I added the DHT22. I´m not very familiar with linux and I couldn´t find an easy to follow step by step how-to. So I had to do a lot of testing, finally I did it this way: https://community.openhab.org/t/how-to-show-dht22-stats-on-hab-panel/39853/16. And then the warning occurred for the first time.

Anyway, I will set up a clean installation and report if the error continues to occur.

I’m thinking your issue is with the exec binding. The instructions from the link you posted were for a RPI that had openhab installed manually. Notice in the examples, the scripts were located in /opt/openhab2/scripts folder. A install with openhabian via the image or repo’s would have the scripts in /etc/openhab2/scripts folder. Looking over your things file the script is in /home/openhabian/scripts folder. So now I have to ask, do you have your permissions, PATH, groups, owners,etc…all set up correct? Something in the system has an issue at startup with what you currently have (i.e. You get a temp reading but errors when reboot/restart).

My advice would be, try a guide that uses the same install and setup, or read up on the linux operating system and solve the problem.

Sorry for being late. You were totally right. There was an issue with the permissions. I don´t know exactly what it was (the script was working and I got the results). But after I moved the scripts to /etc/openhab2/scripts folder the error-message disappeared.

So thanks a lot for your help. I will get more familiar with Linux