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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Data livestream from raspberry pi to Thingworx

bhaunert
1-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

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.

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.

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

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.

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.

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

dupatel
19-Tanzanite
(To:bhaunert)

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

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.

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>

Thank you Durgesh Patel​, that was a good point, the connection is now successfull.

But now I get another error that it cannot find the python script which reads the sensor data. It is saved in the correct direction /home/pi.

Ravi Upadhyay​, it seems the javassist is not required to run the programme.

And I think it's build with eclipse. But that's the problem it is not my jar file and I'm not very familiar with java. I had a WebEx call with the PTC software engineer I mentioned before. In result to that he send me the jar file, the python script and a short tutorial word document. I tried since then to get a running script.

The error:

standard error.PNG

Top Tags