cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Connect Azure IoT Hub to ThingWorx - azure-iot.bat

Kaya
Emeritus

Connect Azure IoT Hub to ThingWorx - azure-iot.bat

Hi Developers,

 

I received this question from a user. Any recommendations? Thanks in advance.

---------------

I get another error when i run the next step azure-iot.bat...

 

14:57:01.520 [main] INFO c.t.f.i.AbstractManyPlatformWebSocketFabric - Many Platform WebSocket Fabric enabled without service discovery: endpoints=[ws://localhost:8080/Thingworx/WS]
14:57:01.555 [main] INFO c.t.s.i.transport.MuxingBytesChannel - Subchannel ws://localhost:8080/Thingworx/WS-1 in channel ws://localhost:8080/Thingworx/WS was no longer valid - unregistering 
it
14:57:01.555 [main] INFO c.t.s.i.transport.MuxingBytesChannel - Subchannel ws://localhost:8080/Thingworx/WS-2 in channel ws://localhost:8080/Thingworx/WS was no longer valid - unregistering 
it
14:57:01.555 [main] INFO c.t.s.i.transport.MuxingBytesChannel - Subchannel ws://localhost:8080/Thingworx/WS-3 in channel ws://localhost:8080/Thingworx/WS was no longer valid - unregistering 
it
14:57:01.555 [main] INFO c.t.s.i.transport.MuxingBytesChannel - Subchannel ws://localhost:8080/Thingworx/WS-4 in channel ws://localhost:8080/Thingworx/WS was no longer valid - unregistering 
it
14:57:01.555 [main] INFO c.t.s.i.transport.MuxingBytesChannel - Subchannel ws://localhost:8080/Thingworx/WS-5 in channel ws://localhost:8080/Thingworx/WS was no longer valid - unregistering 
it
14:57:01.555 [main] INFO c.t.s.i.transport.MuxingBytesChannel - Needed to reconnect subchannels on client endpoint [id: ws://localhost:8080/Thingworx/WS] : [active: 0, max: 5]
14:57:01.617 [main] INFO c.t.connectionserver.PlatformImpl - Starting ConnectionServer: UUID=092baf65-8a0e-41a4-be53-d0296d76662e, Platform protocol=V1, Platform transport=WEBSOCKETS
14:57:01.617 [main] INFO c.t.connectionserver.PlatformImpl - Waiting for connection to platform...
14:57:02.701 [NettyClient-NIO-4] ERROR c.t.s.i.t.netty.NettyBytesChannel - Error while establishing websocket connection on channel com.thingworx.sdk.impl.transport.netty.NettyBytesChannel$2@
4bc70f42.
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(SocketChannelImpl.java:717)
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(Thread.java:748)
14:57:02.701 [NettyClient-NIO-1] ERROR c.t.s.i.t.netty.NettyBytesChannel - Error while establishing websocket connection on channel com.thingworx.sdk.impl.transport.netty.NettyBytesChannel$2@
22a04d8a.
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(SocketChannelImpl.java:717)
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(Thread.java:748)
14:57:02.701 [NettyClient-NIO-2] ERROR c.t.s.i.t.netty.NettyBytesChannel - Error while establishing websocket connection on channel com.thingworx.sdk.impl.transport.netty.NettyBytesChannel$2@
168ff519.

11 REPLIES 11
PaiChung
22-Sapphire I
(To:Kaya)

I see a reference to 127.0.0.1:8080 which is where Tomcat/Thingworx would be, so I'm not sure if it is configured right. Are they running the connection server on the same box as Thingworx is running? There might be port conflicts potentially.

I'm not even sure if it is getting to the attempt to connect to Azure.

Sorry I am just going by what I read, I haven't done a ton with connection servers/iot hub connectors.

henok
9-Granite
(To:PaiChung)

Hi PaiChung, Thank you. I am a newbee here. I am just trying to follow the steps on this guide

'https://developer.thingworx.com/resources/guides/azure-iot-hub-connector-quickstart/install-iot-hub-connector'

I believe i have configured all except 

platform.extensions {
// Filesystem location of extension zips. This is needed for the connector to deploy extensions to the platform
location = "/opt/connector-bundle/extensions"
}

Because the guide didn't mention it.

I don't know what 'Tomcat/Thingworx' is yet and the guide didn't mention it. 

where should i start to debug this problem.

Thank you.

hgrewal
8-Gravel
(To:henok)

@henok were you able to resolve this issue. Seems like i am doing the same thing you are by using the connector  on the same pc where Thingworx in installed.

 

 

henok
9-Granite
(To:hgrewal)

Hi, Yes i did. One of the issues was that the database name in Azure has to be all small letters:-)

hgrewal
8-Gravel
(To:henok)

yep thats one of the things I learnt while browsing the issues faced by others. 

 

Did you end up using the same pc to run your connector and thingworx environment? if yes, how did work around the port issue that @PaiChung mentioned.

henok
9-Granite
(To:hgrewal)

Hi, I don't remember if that was a problem. I see now on the config that i am using "ws://localhost:80/Thingworx/WS". 

hgrewal
8-Gravel
(To:henok)

hmmm.. i've tried that too but not luck. Would you be open to sharing your conf file, without the keys ofcourse :-) 

henok
9-Granite
(To:hgrewal)

Hi, when i delete the keys and names there is no much left:-), but if you want you can send me your and i can compare the content.

cx-server {
protocol {

// You can find the configuration parameters for your IoT Hub by logging into portal.azure.com and following the hints below.
// If necessary, create a new IoT Hub: https://azure.microsoft.com/en-us/documentation/articles/iot-hub-java-java-getstarted/

// A policy name that is related to a key specified below. This policy is typically a built in, pre defined policy called "service",
// but it is possible to use a custom policy if you add it to your hub.
// All resources > your-hub > Settings > Shared access policies > service (or custom service with "service connect" permission
consumerPolicyName = "service"

// A key that supplies credentials to access services specified in the related policy.
// All resources > your-hub > Settings > Shared access policies > {consumerPolicyName} > Primary (or Secondary) key
consumerPolicyKey = "xxxxxxxxxxxxxxx"

// A policy name that is related to the key specified below. This policy is typically a built in, predefined policy called
// "registryReadWrite", but it is possible to use a custom policy if you add it to your hub.
// The shared access policy requires the registry read and registry write permissions.
registryPolicyName = "registryReadWrite"

// A key that supplies credentials to access services specified in the related policy.
registryPolicyKey= "xxxxxxxxxxxxxxxxxxxxxxxx"

// A name that defines the IoT Hub related to this adapter, which manages your things and their related messages.
// Hubs can be scaled via hub units at different price tiers per unit. Hubs are related to a resource group, which is
// related to a subscription Id and a cloud Location.
// *** If the hub name EXCEEDS 25 CHARACTERS in length, be sure to change the eventHubName below accordingly ***
hubName = "xxxxxxxxxxxxxxx"

// The Event Hub-compatible name utilized by SDKs and integrations that expect to read from Event Hubs. An Event Hub is an internal
// component of an IoT Hub that handles device to cloud events for related things. In many cases the IoT Hub name and
// Event Hub-compatible name are the same, so default to the IoT Hub name. Note that long hub names require special care here.
// All resources > your-hub > Messaging > Endpoints > Events(built-in endpoint) > Event Hub-compatible name
eventHubName = xxxxx

// A built-in endpoint (Name=Events) utilized by SDKs and integrations that expect to read from Event Hubs.
// All resources > your-hub > Messaging > Endpoints > Events(built-in endpoint) > Event Hub-compatible endpoint (hostname without ".servicebus.windows.net")
eventHubNamespace = "xxxxxxxxxxxxxxx"

// A consumer group name is required to pull data from the IoT Hub.
// All resources > your-hub > Settings > Message > Consumer groups
// null means to use the $Default consumer group
consumerGroup = null

// IoT Hubs have a hostname that is defined by the hubName, plus a domain name of Azure's choosing, normally azure-devices.net.
// All resources > your-hub > Overview > Essentials section > Hostname
hubHostname = "xxxxxxxxxxxxxxxxx"

// Settings for Azure blob storage. Used for device-export for an Azure IoT Hub.
// Create a "Storage Account" in the Azure portal, then use the navigation hints below.
blob-storage {
accounts {
default {
// <blob-store> > Settings > Access Keys > Storage account name
account-name = "thingworxtest"
// <blob-store> > Settings > Access Keys > key1 or key2
account-key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

}
event-processor-host {
container-name = "eph-storage-"${cx-server.protocol.eventHubName}
account = default
}
}
}

transport.websockets {
// ThingWorx platform application key
app-key = "xxxxxxxxxxxxxxxxxxxxxxxx"

// One or more platforms can be specified here, comma separated
platforms = "ws://localhost:80/Thingworx/WS"
}

platform.extensions {
// Filesystem location of extension zips. This is needed for the connector to deploy extensions to the platform
location = "/opt/connector-bundle/extensions"
}

}

hgrewal
8-Gravel
(To:henok)

Thanks for taking the time @henok . File attached for your reference. Thanks!

henok
9-Granite
(To:hgrewal)

Hi, The content is quite similar.

The differences as you can see it

*health-check {port = 9009} i don't have it .

*You are using https protocol, then url should be different, i think it will be wss: instead of ws

*platform.extensions commented out on yours, have you installed the azure extension? 

I hope it helps.

hgrewal
8-Gravel
(To:henok)

Thanks, @henok 

 

* health check was something that was in the PTC documentation. I dont see any difference in errors by removing it. 

*I switched the protocol couple times because i was getting protocol errors. Snippet below. Maybe you see something in the error that i cant. 

* I have installed the extensions manually

 

11:31:36.052 [FileUploadNotificationProcessor] WARN c.t.p.a.i.FileUploadNotificationProcessor - Error retrieving file-upload notification
org.apache.qpid.proton.engine.HandlerException: org.apache.qpid.proton.engine.TransportException: org.apache.qpid.proton.engine.TransportException: None of [TLS_DH_anon_WITH_AES_128_CBC_SHA, SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_DES_CBC_SHA, SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA] anonymous cipher suites are within the supported list [TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
at org.apache.qpid.proton.engine.impl.EventImpl.dispatch(EventImpl.java:112)
at org.apache.qpid.proton.reactor.impl.ReactorImpl.dispatch(ReactorImpl.java:309)
at org.apache.qpid.proton.reactor.impl.ReactorImpl.process(ReactorImpl.java:277)
at com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFileUploadNotificationReceive.receive(AmqpFileUploadNotificationReceive.java:121)
at com.microsoft.azure.sdk.iot.service.FileUploadNotificationReceiver.receive(FileUploadNotificationReceiver.java:103)
at com.microsoft.azure.sdk.iot.service.FileUploadNotificationReceiver.receive(FileUploadNotificationReceiver.java:85)
at com.thingworx.protocol.azure.iot.FileUploadNotificationProcessor.run(FileUploadNotificationProcessor.java:63)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.qpid.proton.engine.TransportException: org.apache.qpid.proton.engine.TransportException: None of [TLS_DH_anon_WITH_AES_128_CBC_SHA, SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_DES_CBC_SHA, SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA] anonymous cipher suites are within the supported list [TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
at org.apache.qpid.proton.engine.impl.ssl.SslImpl$UnsecureClientAwareTransportWrapper.pending(SslImpl.java:166)
at org.apache.qpid.proton.engine.impl.TransportImpl.pending(TransportImpl.java:1496)
at org.apache.qpid.proton.engine.impl.TransportImpl.isClosed(TransportImpl.java:1613)
at org.apache.qpid.proton.reactor.impl.IOHandler.capacity(IOHandler.java:174)
at org.apache.qpid.proton.reactor.impl.IOHandler.update(IOHandler.java:204)
at org.apache.qpid.proton.reactor.impl.IOHandler.selectableTransport(IOHandler.java:329)
at org.apache.qpid.proton.reactor.impl.IOHandler.handleBound(IOHandler.java:166)
at org.apache.qpid.proton.reactor.impl.IOHandler.onUnhandled(IOHandler.java:372)
at org.apache.qpid.proton.engine.BaseHandler.onConnectionBound(BaseHandler.java:58)
at org.apache.qpid.proton.engine.BaseHandler.handle(BaseHandler.java:131)
at org.apache.qpid.proton.engine.impl.EventImpl.dispatch(EventImpl.java:108)
... 7 common frames omitted

Announcements


Top Tags