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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Azure IoT hub connector unable to start

DJ_8712454
12-Amethyst

Azure IoT hub connector unable to start

Hello guys, 

 

I'm having issues when trying to start the Thingworx Azure IoT hub connector, after following the entire guide (Getting an Azure IoT Hub Connector Up and Running) I having the following error:

 

 

 

 

2020-09-04 19:26:57.478 ERROR Error refilling connections on [channel: null, endpoint ws://localhost:8080/Thingworx/WS, uri: ws://localhost:8080/Thingworx/WS] failed : com.thingworx.sdk.api.exception.AuthenticationException: Connection authentication/registration FAILED [channel: NettyBytesChannel [id=ws://localhost:8080/Thingworx/WS-2, closed=false], code: STATUS_UNAUTHORIZED, reason: Error [context: authenticating connection][cause: Missing application key!]]

 

 

 

 

The current setup I am using is the following:

 

Thingworx version:  ThingWorx 8.5.5-b103

Thingworx Azure IoT Hub connector version: Thingworx-Azure-IoT-Hub-Connector-3.0.0.20

Java version: 1.8.0_251

 

I'm installing the connector in the same server that we are using for Thingworx (as a development environment)

 

Attached a zip file with the azure-iot.con file and the log after executing 

 

 

 

azure-iot.bat > azure-iot.log

 

 

 

 

I looking forward to hearing from you guys,

 

Regads,

 

DJ

 

 

ACCEPTED SOLUTION

Accepted Solutions

Hi @DJ_8712454 ,

 

Are you using the encrypted configuration file (azure-iot.conf.encrypted) as the same is mentioned in AZURE_IOT_OPTS. If not please update the environment variable properly.

 

Details are provided in step 9 at the url http://support.ptc.com/help/thingworx_scm_azure/r3.0/en/#page/thingworx_scm_azure%2Fazure_connector%2Fc_azure_connector_set_environment_variable.html%23wwID0ER2HM

 

Also the error might be occurring because of Encryption key used by the ThingWorx Platform does not match the Encryption key used by the Azuire IoT Hub Connector

 

Please follow step 7 in the configuration guide to configure encryption/decryption and validate the issue after that.


You can also refer the following article for details: https://www.ptc.com/en/support/article/CS316173

 

Thanks,

Himanshu

 

View solution in original post

6 REPLIES 6

Hi @DJ_8712454 ,

 

The error message says authentication failed due to application key.

Make sure to use the valid application key (also check expiry date on twx composer) and restart connector again as an Administrator.

This should resolve the authentication issue.

 

Thanks,

Himanshu

Hello @hchanana  

 

The application key is valid and here is expricy date.

 

DJ_8712454_0-1599251800233.png

What else I can review?

 

Regards,

 

DJ

Hi @DJ_8712454 

 

Make sure that you had the AZURE_IOT_OPTS environment variable or it might be due to port conflict between iot hub connector port and tomcat port. If possible, change the tomcat port from 8080 to any other value.

 

Also validate all the steps mentioned in the article https://www.ptc.com/en/support/article/CS316161

 

Thanks,

Himanshu

Hello @hchanana,

 

I followed the advise from the article:

 

First I reviewed the AZURE_IOT_OPTS environment variable, as you can see below is properly created:

DJ_8712454_0-1599257932895.png

Then I modified the tomcat port to 9080 and update the azure-iot.conf files, now Ihaving the following error:

 

2020-09-04 22:14:36.736 ERROR Error while establishing websocket connection on channel NettyBytesChannel [id=ws://localhost:8080/Thingworx/WS-3, closed=true].
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:8080

 

Attached the azure-iot.con and the log file after starting the connector.

 

Looking forward to hearing from you,

 

Regards,

 

Diego

Hello @hchanana 

 

After reviewing carefully I was having problems with the AZURE_IOT_OPTS, now after set it up properly, I having a new error after executing : azure-iot.bat > azure-iot.log

 
C:\connector\bin>set AZURE_IOT_OPTS=-Dsecret.management.config.file=C:\security-common-cli-1.0.2.40\bin\encryption.conf -Dconfig.file=C:\connector\conf\azure-iot.conf.encrypted -Dlogback.configurationFile=C:\connector\conf\logback.xml

C:\connector\bin>echo %AZURE_IOT_OPTS%
-Dsecret.management.config.file=C:\security-common-cli-1.0.2.40\bin\encryption.conf -Dconfig.file=C:\connector\conf\azure-iot.conf.encrypted -Dlogback.configurationFile=C:\connector\conf\logback.xml

C:\connector\bin>azure-iot.bat > azure-iot.log
java.lang.IllegalStateException: Failed to get Azure IoT Hub configuration from the platform
        at com.thingworx.protocol.azure.iot.AzureIotProtocolAdapter.initialize(AzureIotProtocolAdapter.java:336)
        at com.thingworx.connectionserver.ConnectionServerDataPlane.initProtocol(ConnectionServerDataPlane.java:152)
        at com.thingworx.statemachine.DispatchingEventChannel.doEvent(DispatchingEventChannel.java:36)
        at com.thingworx.statemachine.AbstractEventChannel.apply(AbstractEventChannel.java:50)
        at rx.internal.util.ActionSubscriber.onNext(ActionSubscriber.java:39)
        at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134)
        at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:224)
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
        at rx.internal.schedulers.ExecutorScheduler$ExecutorSchedulerWorker.run(ExecutorScheduler.java:107)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Decryption key azure.connector.key not found
        at com.thingworx.protocol.azure.iot.util.SecurityUtils.getDecryptionKey(SecurityUtils.java:38)
        at com.thingworx.protocol.azure.iot.util.SecurityUtils.decryptWithKey(SecurityUtils.java:19)
        at com.thingworx.protocol.azure.iot.AzureConfiguration.<init>(AzureConfiguration.java:90)
        at com.thingworx.protocol.azure.iot.AzureIotProtocolAdapter.getHubConfiguration(AzureIotProtocolAdapter.java:375)
        at com.thingworx.protocol.azure.iot.AzureIotProtocolAdapter.initialize(AzureIotProtocolAdapter.java:326)
        ... 11 more
 

The weird thing is that the error is not getting logged within the execution log.

 

Attached my azure-iot.conf and the execution log, after starting the connector.

 

Regards,

 

DJ

 

 

 

Hi @DJ_8712454 ,

 

Are you using the encrypted configuration file (azure-iot.conf.encrypted) as the same is mentioned in AZURE_IOT_OPTS. If not please update the environment variable properly.

 

Details are provided in step 9 at the url http://support.ptc.com/help/thingworx_scm_azure/r3.0/en/#page/thingworx_scm_azure%2Fazure_connector%2Fc_azure_connector_set_environment_variable.html%23wwID0ER2HM

 

Also the error might be occurring because of Encryption key used by the ThingWorx Platform does not match the Encryption key used by the Azuire IoT Hub Connector

 

Please follow step 7 in the configuration guide to configure encryption/decryption and validate the issue after that.


You can also refer the following article for details: https://www.ptc.com/en/support/article/CS316173

 

Thanks,

Himanshu

 

Announcements


Top Tags