Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
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
Solved! Go to Solution.
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.
Hi Aditya, can you confirm if there are no two services of same name as noted in the error GetSteamSensorReadings
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
It is the Java SDK Java-SDK-6-0-4-595. The latest one.
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.