Error: Failed to initialize Azure IoT Hub Connector due to invalid configuration (Azure Blob Thing)
When the Azure IoT Hub Connector is started, the fileRepositoryBlobThing must be set in the configuration of the AzureIotHubTemplate Thing. If the configuration setting for the fileRepositoryBlobThing on the AzureIotHubTemplate Thing, the Connector must be restarted in order to pick up the new configuration setting. The Connector loads and caches all configuration settings during startup. Any changes to the configuration are ignored until the Connector is restarted.
If the fileRepositoryBlobThing is not set, the following messages appear in the logs:
2019-08-05 15:55:52.132 [pool-2-thread-1]
INFO c.t.c.ConnectionServer - Initializing Protocol
java.lang.IllegalStateException: Failed to initialize
Azure IoT Hub Connector due to invalid configuration
at com.thingworx.protocol.azure.iot.AzureIotProtocolAdapter.
initialize(AzureIotProtocolAdapter.java:350)
2019-08-05 15:55:53.066 [pool-2-thread-1]
INFO c.t.c.ConnectionServer - Initializing HealthCheckService
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: com.thingworx.protocol.azure.iot.ConfigurationException:
Invalid Configuration specified. Please check the following
configuration fields on your AzureIotHub Thing:
[fileRepositoryBlobThing:accountName,
fileRepositoryBlobThing:connectionString]
at com.thingworx.protocol.azure.iot.AzureConfiguration.
<init>(AzureConfiguration.java:131)
at com.thingworx.protocol.azure.iot.AzureIotProtocolAdapter.
getHubConfiguration(AzureIotProtocolAdapter.java:391)
at com.thingworx.protocol.azure.iot.AzureIotProtocolAdapter.
initialize(AzureIotProtocolAdapter.java:342)
... 11 more
Solution
From ThingWorx Composer, check the configuration of the AzureIotHub Thing to be sure that the following properties are set correctly for the AzureBlobStorageTemplate Thing:
• The accountName of the AzureBlobStorageTemplate Thing
• The connection string of the AzureBlobStorageTemplate Thing
If you change the configuration, you MUST restart the Connector.