Skip to main content
5-Regular Member
November 6, 2017
Solved

Steam Sensor Java SDK

  • November 6, 2017
  • 3 replies
  • 3883 views

Hi,

While running the steam sensor example of Java SDK (latest one Java-SDK-6-0-4-595), I am getting below error:


Exception in thread "main" com.thingworx.communications.client.things.exceptions.DuplicateCharacteristicException: Service already defined: GetSteamSensorReadings

at com.thingworx.communications.client.things.VirtualThing.createServiceProcessorsFromThingShape(VirtualThing.java:717)

at com.thingworx.communications.client.things.VirtualThing.initializeFromAnnotations(VirtualThing.java:667)

at com.thingworx.sdk.steam.SteamThing.init(SteamThing.java:93)

at com.thingworx.sdk.steam.SteamThing.<init>(SteamThing.java:78)

at com.thingworx.sdk.steam.SteamSensorClient.main(SteamSensorClient.java:67)

In this example, I also passed the arguments as ws://localhost:80/Thingworx/WS 625807eb-43ef-40b0-b68f-9f5c6f308bbd 1000 1 10.


I tried to debug it but was not able to run this example through eclipse.

Can anyone have tried this example? I am using the latest Java SDK from PTC support site. and the Java SDK file name is MED-61061-CD-055_M030_Java-SDK-6-0-4-595.

Thanks,

Aditya

Best answer by adikumar

In the SteamThing.java class, where the initializeFromAnnotations() method was called twice.

Once in the creation of the constructor and then again later. So, I removed the 2nd instance of the initializeFromAnnotations() method, and then it started working after compiling the code.

3 replies

5-Regular Member
November 6, 2017

Hi Aditya, can you confirm if there are no two services of same name as noted in the error GetSteamSensorReadings

adikumar5-Regular MemberAuthor
5-Regular Member
November 6, 2017

Hi Sushant,

Thank you for the response.

There are no two services of the same name. Please find attached below the code too.

If I am commenting the GetSteamSensorReadings service, then the same error I am also getting for AddNumbers service too.

Regards,

Aditya

adikumar5-Regular MemberAuthor
5-Regular Member
November 6, 2017

It is the Java SDK Java-SDK-6-0-4-595. The latest one.

adikumar5-Regular MemberAuthorAnswer
5-Regular Member
November 8, 2017

In the SteamThing.java class, where the initializeFromAnnotations() method was called twice.

Once in the creation of the constructor and then again later. So, I removed the 2nd instance of the initializeFromAnnotations() method, and then it started working after compiling the code.