ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Cannot use java classes to execute prolog predicates

asked 2014-10-30 14:33:51 -0500

olchandra gravatar image

Hi. I wanted to instantiate some classes from my owl file using the data received from sensor ROS node. So I defined some predicates to do that (very similar to the predicates given in knowron_perception_tutorial package) in a .pl file. I am loading this prolog file while launching json_prolog launcher. I also made a subscriber and knowledge_update functions/threads in java, following the same package. I am using a python node that publishes sensor data.

The problem is that when I try to query the knowledge base using a python script, I get the following error: Prolog query failed: PrologException: error(java_exception(@('J#00000000001832433860')), 'java.lang.NoClassDefFoundError')"

I am guessing that the java class files(generated using ROSMAKE) is not accessible. I have made the file path reference in java and CMakeList similar to the way done in knowledge_perception_tutorial. What am I missing? Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-11-08 03:55:30 -0500

moritz gravatar image

updated 2014-12-03 01:29:16 -0500

Do you export the bin folder of your package in the manifest.xml?

Please have a look at this file as an example: https://github.com/knowrob/knowrob/bl...

EDIT: The problem seems to be the launch file you are using that starts the json_prolog executable directly. Once this node has been started, the JVM is initialized and modifications of the CLASSPATH variable do not have any effect any more. There is a special script in the rosprolog package called run_with_prolog_env that exports the CLASSPATH before launching json_prolog. You can have a look at an example in the launch file of the ias_semantic_map package.

edit flag offensive delete link more

Comments

Yes, I have imported the bin folder in manifest.xml. Still the same error. I think it has to do with this issue https://github.com/knowrob/knowrob/issues/40

olchandra gravatar image olchandra  ( 2014-11-10 04:00:01 -0500 )edit

That issues applies only if the JVM has already been initialized, i.e. normally if you manually load a package after KnowRob has been started. If you load packages from within the init.pl, that usually does not apply.

moritz gravatar image moritz  ( 2014-11-10 04:23:54 -0500 )edit

Could you please post your CMakelists, manifest and init.pl and the command you use for launching?

moritz gravatar image moritz  ( 2014-11-10 04:24:15 -0500 )edit

Thanks Moritz. That solved the problem. There is another problem, different but related. I will ask it separately.

olchandra gravatar image olchandra  ( 2014-12-03 11:05:51 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2014-10-30 14:33:51 -0500

Seen: 256 times

Last updated: Dec 03 '14