[SOLVED] Error on sendHttpGetRequest(): java.nio.channels.ClosedChannelException

I get the following error on a sendHttpGetRequest() in my rule on openHAB2.1.0 (build780):

2017-02-07 15:54:42.041 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException

RULE

rule triggerUDA_test

when
	Item Switch_UDA_Test changed 
then
	var String get_sessiontoken=sendHttpGetRequest('https://xxx.xxx.x.xx:8080/json/system/loginApplication?loginToken=xxx')
        logDebug("UDA_Test","SessionToken is " + get_sessiontoken)
end

The sessiontoken in the log is null of course.

Copying
https://xxx.xxx.x.xx:8080/json/system/loginApplication?loginToken=xxx
into my browser returns me with the expected JSON string.

Replacing the characters ? with %3F and the = with %3D in the string with didnā€™t help me either.

What am I doing wrong?

I donā€™t see a problem with your rule, but it might be that the server at xxx.xxx.x.xx and openHAB do not agree on SSL CA certificates, and the socket is being closed right after a failed SSL negotiation.

Thanks for the response @watou . Iā€™ve set Firefox to accept all SSL negotiation, since adding a certificate to digitalSTROM still canā€™t be done (as far as I know). Firefox isnā€™t asking for any SSL trust confirmation when executing the URL in Firefox.

Is there a way I can set openHAB to trust this server? Or is there another way to work around this?

There is probably an answer here on the forum, or Google. I know the issue pops up occasionally, but I donā€™t have steps myself to solve it. It used to be an issue for the Netatmo 1.x binding. Hope some of this helps!

Thank you so much, John!:grinning:

The solution was simular to your suggestion:

but I had to install the specific (by digitalSTROM.org) self-signed certificate in the Java environment. So I managed to download the certificate fromm the security options of my Firefox browser.

Steps to follow for digitalSTROM-users:

  1. read and understand the solution described in Netatmo Netatmo 1.x binding Do not download the Netatmo certificate, and do not install it. This must be done for the digitalSTROM server in the following steps:
  2. Approach your digitalSTROM server at port :8080 and trust it
  3. Open your options in Firefox, go Advanced options >> Certificates >> View Certificates:
  4. Go to the ā€˜Otherā€™ Tab >> Export the digitalSTROM certificate
  5. Now follow the instructions in Netatmo 1.x binding (skip downloading and installing the netatmo cert. because your using your digitialSTROM cert.) but replace the install instructions according to your own situation, e.g. in my case , in the Windows CMD environment, starting from my JDK Java-path on:
.\bin\keytool -import -keystore .\jre\lib\security\cacerts -alias digitalSTROM.org -file .\bin\digitalSTROMorg.crt

Make sure you have administrative permissions.

ā€œ6ā€. Restart your Karaf-console

Now the self-signed digitalSTROM-server certificate is trusted by your openHAB environment.

Hope this will help others when it popsup again occasionally.

1 Like