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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Configuring Thingworx Azure IOT Hub Connector

tgarg1
1-Newbie

Configuring Thingworx Azure IOT Hub Connector

Hello All

I have installed Thingworx 8.1 war on 64 bit operating system. Now, I want to use Thingworx Azure IOT Hub Connector to connect the Thingworx to Azure IOT.

I am getting an error as follows whenever I am trying to run the azure-iot.bat file of Thingworx Azure IOT Hub Connector :

Error in custom provider, java.lang.RuntimeException: Error initializing azure cloud storage account

  at com.thingworx.protocol.azure.iot.AzureIotGuiceModule.getDeviceExportBlobStorageAccount(AzureIotGuiceModule.java:165)

  at com.thingworx.protocol.azure.iot.AzureIotGuiceModule.getDeviceExportBlobStorageAccount(AzureIotGuiceModule.java:165)

  while locating com.microsoft.azure.storage.blob.CloudBlobClient annotated with @com.google.inject.name.Named(value=DeviceExportBlobStorage)

Caused by: java.lang.RuntimeException: Error initializing azure cloud storage account

at com.thingworx.protocol.azure.iot.AzureIotGuiceModule.getBlobClient(AzureIotGuiceModule.java:186)

at com.thingworx.protocol.azure.iot.AzureIotGuiceModule.getDeviceExportBlobStorageAccount(AzureIotGuiceModule.java:165)

at com.thingworx.protocol.azure.iot.AzureIotGuiceModule$$FastClassByGuice$$cc5439e4.invoke(<generated>)

at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:264)

at com.google.inject.internal.ProviderMethod$Factory.provision(ProviderMethod.java:401)

at com.google.inject.internal.ProviderMethod$Factory.get(ProviderMethod.java:376)

at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)

at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)

at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)

at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)

at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)

at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)

at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)

at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)

at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:232)

at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:236)

at com.thingworx.connectionserver.ConnectionServer.instantiateProtocol(ConnectionServer.java:102)

at com.thingworx.connectionserver.ConnectionServer.startServer(ConnectionServer.java:71)

at com.thingworx.connectionserver.ConnectionServer.main(ConnectionServer.java:145)

Caused by: java.lang.IllegalArgumentException: Invalid connection string.

at com.microsoft.azure.storage.CloudStorageAccount.parse(CloudStorageAccount.java:249)

at com.thingworx.protocol.azure.iot.AzureIotGuiceModule.getBlobClient(AzureIotGuiceModule.java:182)

... 21 more

Now I am bit confused here . In the conf file of Thingworx Azure IOT Hub Connector we give the configuration for the azure blob storage account as follows:

blob-storage {

         

                    // <blob-store> > Settings > Access Keys > Storage account name

                    account-name = "<account-name>"

                    // <blob-store> > Settings > Access Keys > key1 or key2

                    account-key = "<account-key>"

          

        }

Here we are not giving the connection string anywhere then why does the error log say .... Invalid Connection String?.

Kindly help me solve this issue.

16 REPLIES 16
tgarg1
1-Newbie
(To:tgarg1)

Hello All

I would request the developer community to please take this issue on priority basis as I am really stuck here and not able to proceed further.

tgarg1
1-Newbie
(To:tgarg1)

Hello All

I am eagerly waiting for some help on this issue. Please give me some help on this issue.

supandey
19-Tanzanite
(To:tgarg1)

Hi Tarun, before asking anything else, reading your comments if you feel this is urgent issue related to PoC/Project, etc I'd highly recommend you to open a support case. Prioritising issues on community is challenging and may not get the required attention as you are looking for.

Could you clarify if you are attempting to use the Azure blob  or not? or simply trying without the blob storage?

Thanks for your response . I understand your point and will keep this in mind for future.

Coming to the issue,  I have created a blob storage account in my azure batch account and am passing it's account-key and account-name in the azure-iot.conf file of Thingworx Azure IOT Connector by following the directions given in the conf file.

blob-storage {

        

                    // <blob-store> > Settings > Access Keys > Storage account name

                    account-name = "<account-name>"

                    // <blob-store> > Settings > Access Keys > key1 or key2

                    account-key = "<account-key>"

         

        }

sharmon
12-Amethyst
(To:tgarg1)

I'm dealing with this issue right now. It appears Microsoft has made the naming conventions for event hubs stricter. Upper-case characters don't seem to be allowed in event hub names any more.

I fixed my issue by converting my hubName, eventHubName, and hubHostName entries in azure-iot.conf to all lower case, where applicable. For example, where I formerly had, "DemoIoTHub3", I substituted, "demoiothub3". This fixed my issue with the, "Error initializing azure cloud storage account," error.

Please give this a try. R&D is aware of the issue.

tgarg1
1-Newbie
(To:sharmon)

Hi Stephen, I have tried by substituting my hubName , eventHubName and hubHostName entries to lower case in the conf file. But I am still getting this error.

tgarg1
1-Newbie
(To:sharmon)

Stephen, I am bit doubtful about the eventHubNamespace field configuration in the conf file. According to help provided in the conf file we have to put the data from this field from IOT Hub-- All resources > your-hub >  Messaging > Endpoints > Events(built-in endpoint) > Event Hub-compatible endpoint (hostname without ".servicebus.windows.net").

I am configuring it like:

eventHubNamespace = "sb://iothub-ns-XXXXX/;SharedAccessKeyName=keyName;SharedAccessKey=sharedaccesskey"

without using .servicebus.windows.net in it. Can this be the cause of the error.

sharmon
12-Amethyst
(To:tgarg1)

Yes! That's probably it!

Let me show how mine is configured. The value from hub->messaging->endpoints->events->Event Hub-compatible endpoint is:

Endpoint=sb://iothub-ns-demotwxiot-12345-bb50502f9.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=foobarbas123456789==fdecs==

To get to the value I need, I first chop off, "Endpoint=sb://". I then remove everything from, ".servicebus...", forward. The value I end up with is:


iothub-ns-demotwxiot-12345-bb50502f9


Would you please try that, and let me know if it works?

tgarg1
1-Newbie
(To:sharmon)

Hi Stephen, I have tried correcting the endpoint value. But the error is still coming. I have also sent you the conf file , thought you would also like to see.

supandey
19-Tanzanite
(To:tgarg1)

Tarun Garg​ is it possible for you to share the config file with us? If you are uncomfortable putting here publicly, you can message me. Additionally, can you confirm if you did follow through all the steps that are mentioned on page 61 about Using the Azure Blob Storage in ThingWorx, in the

Azure IoT Hub Connector Installation and Operations Guide

Hi Sushant, I have created the Thing for my azure storage account in the Thingworx. The rest of the steps are for using Thingworx services to interact with the storage account after successful connection. I think I am first stuck at running the Thingworx Azure IOT Hub Connector successfully . The connector is not able to successfully establish a connection to IOT Hub , Storage Account. I have also messaged you the conf file .

Please correct my understanding if I am wrong.

Thanks

supandey
19-Tanzanite
(To:tgarg1)

Tarun Garg​ thanks for sharing i'll review that and will get back to you.

supandey
19-Tanzanite
(To:supandey)

Tarun Garg sorry removed the attachment here, sending you over message.

There is no change to the error, Sushant. It is still coming

Also Sushant,  for replacing the localhost by the system IP , I have the Thingworx war running on the same system on which I want to run the Connector.

So that is why I am using localhost here.

supandey
19-Tanzanite
(To:tgarg1)

Tarun Garg​ sent you PM

Top Tags