I am having an issue connecting to the Azure IoT Hub from ThingWorx 8.4.
- The Connector and Thingworx are on the same server
- The attached azure-iot.conf file was configured using direction from PTC Using this link
When run the azure-iot.bat file from cmd i get the following error. Any help with this issue is much appreciated! Thanks!
14:06:16.812 [NettyClient-NIO-5] ERROR c.t.s.i.t.netty.NettyBytesChannel - Error while establishing websocket connection on channel com.thingworx.sdk.impl.transport.netty.NettyBytesChannel$2@6069b8ae.
java.net.ConnectException: Connection refused: no further information: localhost/127.0.0.1:8080
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Solved! Go to Solution.
There are three possibilities I could imagine to cause this issue:
1. Not setting correct Connection server system variables.
Look here to know how to set it properly
2. Configure wrong AppKey or ThingWorx url in transport.websockets in your connector conf file. Please check again to make sure it's accessing the correct port;
3. if still not work for 1,2, try to use 127.0.0.1 instead of hostname, maybe there is some hostname resolving issue when accessing from same machine, but I'm not sure about this.
There is an article mentioning similar issue for your reference.
Hope it helps,
I double checked the recommendations you shared and everything looks good to me. Please refer the attached files that you requested.
FYI- if I disable ssl and try to connect to things using ws://localhost:8080 or 127.0.0.1 the cxserver log starts growing like crazy, many gb's in couple mins.
FYI- I am also using the same port (8080) for connection to KepServer
Appreciate you taking the time to help me out.
Are you running the Connector on the same machine as Thingworx itself? I assume so, but it's not clear from your problem description.
I see in ApplicationLog there is some thread deadlock occurred, and is it related to this issue?
Also I see you have used an ssl connection to ThingWorx platform in azure-iot.txt, and a secure websocket connection to ThingWorx was failed because of this. Could you try to restart ThingWorx and re-configure azure-iot.conf file to use http instead of https and see the issue is gone or not? if issue is still there, please send out the 4 files again.
Finally, I recommend you prepare a clean(better fresh installed with no data, no extension, no connection to other clients) ThingWorx on another machine and try to connect again.
Hi Anna - Thanks for your help. At this point i am able to connect to IoT hub, however, i am seeing the errors below in the logs. I have attached the conf and the log files for your reference. Thank-you!
2019-04-30 09:07:17.540-0400 [L: ERROR] [O: E.c.t.s.f.ValidatingHttpRequest] [I: ] [U: Administrator] [S: ] [T: http-nio-8080-exec-23] Error occurred while validating HTTP header: cookie. HTTP header value: cookie: Invalid input. Please conform to regex ^[a-zA-Z0-9()\-=\*\.\?;,+\/:&_|% ]*$ with a maximum length of 2000
2019-04-30 09:09:49.417-0400 [L: ERROR] [O: E.c.t.s.f.ValidatingHttpRequest] [I: ] [U: Administrator] [S: ] [T: http-nio-8080-exec-16] Error occurred while validating HTTP header: cookie. HTTP header value: cookie: Invalid input. Please conform to regex ^[a-zA-Z0-9()\-=\*\.\?;,+\/:&_|% ]*$ with a maximum length of 2000
cx-server: (this was registered after i tried to import the device in IoT Hub)
09:05:05.419 [AzureExportThread] ERROR c.t.p.azure.iot.HubImportHandler - Error exporting hub thing names
com.microsoft.azure.storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Hello @hgrewal ,
I'm having exactly same error. I changed my "HTTPRequestHeaderMaxLength": 5000. Still not working.
How did you solve your problem?