Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi All
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 io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:289)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
at java.lang.Thread.run(Unknown Source)
Solved! Go to Solution.
Hello,
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,
Thanks,
Br,
Anna
Hi Anna,
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.
Thanks
Harry
Are you running the Connector on the same machine as Thingworx itself? I assume so, but it's not clear from your problem description.
-Chris Kaminski
yes on the same machine..So is KepServer that is connecting on the same port (8080)
Hi Harry,
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.
Thanks,
Br,
Anna
Br,
Anna
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!
Application log:
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
Error Log:
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.
at com.microsoft.azure.storage.StorageException.translateFromHttpStatus(StorageException.java:175)
at com.microsoft.azure.storage.StorageException.translateException(StorageException.java:94)
at com.microsoft.azure.storage.core.StorageRequest.materializeException(StorageRequest.java:305)
at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:175)
at com.microsoft.azure.storage.blob.CloudBlobContainer.exists(CloudBlobContainer.java:769)
at com.microsoft.azure.storage.blob.CloudBlobContainer.createIfNotExists(CloudBlobContainer.java:379)
at com.microsoft.azure.storage.blob.CloudBlobContainer.createIfNotExists(CloudBlobContainer.java:326)
at com.thingworx.protocol.azure.iot.HubImportHandler$AzureExportJob.run(HubImportHandler.java:211)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Hello @hgrewal ,
I'm having exactly same error. I changed my "HTTPRequestHeaderMaxLength": 5000. Still not working.
How did you solve your problem?
thanks!!