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

Data livestream from raspberry pi to Thingworx

Newbie

Data livestream from raspberry pi to Thingworx

We tried to get livestream data from an ultrasonic sensor connected to the raspberry pi 3 to Thingworx. But when we try to execute the java archive, we get an error message that the -jar main class could not be loaded or found. You find this error message attached.

Thanks in advance for every answer.

10 REPLIES 10

Re: Data livestream from raspberry pi to Thingworx

It seems like you have not specified the class-path correctly.

Read the Article to understand and setting of class path.


http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

Since it's well know issue which anyone faces if classpath and classnames are not mentioned   , I would suggesting looking for “Could not find or load main class” Error while running java program using cmd prompt" online to know more about this.

Re: Data livestream from raspberry pi to Thingworx

Thank you. I set the classpath right and it worked. But the output of the command does not look like it should. It appears an error that shuts down the EMS. Any further ideas to solve this issue? You can again find a screenshot attached.

Error_EMS_shutdown.PNG

Thanks in advance.

Re: Data livestream from raspberry pi to Thingworx

Again it throwing exception java.lang.NumberFormatException for Input String  as shown in screenshot , is this input string is appkey ? Did you copied it correctly , does it have white spaces.

Also , let me know what other changes you made before running the jar on RPI

Highlighted

Re: Data livestream from raspberry pi to Thingworx

Yes, this input string is the appkey. I'm relatively sure that I copied it correctly and there aren't any white spaces.

There aren't many changes I do before. I only installed java jdk7, used chmod +x on ultrasonic.py and set the correct classpath.

The command should look like this: java –jar ultrasonic.jar ws://yourInstanceURL:80/Thingworx/WS YourAppKey pinIn pinout

and the output should look like this:

I got this from a PTC software engineer, but his mail account apparently doesn't exist anymore.

Re: Data livestream from raspberry pi to Thingworx

Try to use IP of the Thingworx server rather than Hostname. Not sure if this will resolve the problem here , but it resolved the similar kind of issue once for Debanjan Bose​ .

Also , I would suggest using same version (i.jdk1.8) while making the jar and also while running the jar from RPI.

Re: Data livestream from raspberry pi to Thingworx

Thanks Ravi, you already helped me a lot.

I put the IP in for the host name, but the connection was unsuccessfull. The jdk version installed on the pi should be the correct one.

Any further ideas?

command_output.PNG

Re: Data livestream from raspberry pi to Thingworx

Benno Haunert​ - I believe issue is occurring due to putting http along with ws. Can you try removing http:// in your command similar as below -

java -jar ultrasonic.jar ws://52.6.147.116:80/Thingworx/WS YourAppKey pinIn pinout

Re: Data livestream from raspberry pi to Thingworx

The error which you are getting now is again related to classpath and/or missing jars: "you dont have java assist in your classpath or you have dont  have enough permission to dynamically load classes"

Javassist is a library for byte code manipulation.

Seems , more like environment issue or issue related with compilations and adding third party jars while making the build .

Which build tool are u using to make the jars ? if maven is being used , Please add the following lines in pom.xml and then make the jar again.

<dependency>

    <groupId>org.javassist</groupId>

    <artifactId>javassist</artifactId>

    <version>3.18.1-GA</version>

</dependency>

Re: Data livestream from raspberry pi to Thingworx

Good catch Durgesh Patel​, http should not be used .

Benno Haunert​ Please also let us know which document are you following to create and execute the jar.