Cleber Jorge Amaral
Cleber Jorge Amaral

Reputation: 1442

Internal Action was not loaded Error: java.lang.ClassNotFoundException

I am trying to run an implementation a jason code that is using some Internal Actions. The interpreter is showing that it was not possible to find the "java" code of the internal action, as showed:

Server running on http://191.36.8.42:3272
[aslparser] [peleus.asl:29] warning: The internal action class for 'org.soton.peleus.act.plan(Goals)' was not loaded! Error:
java.lang.ClassNotFoundException: org.soton.peleus.act.plan
[aslparser] [peleus.asl:42] warning: The internal action class for 'org.soton.peleus.act.isTrue(H)' was not loaded! Error:
java.lang.ClassNotFoundException: org.soton.peleus.act.isTrue
[peleus] Could not finish intention: intention 1:  +des([on(b3,table),on(b2,b3),on(b1,b2)])[source(self)] <- ... org.soton.peleus.act.plan(Goals); !checkGoals(Goals); .print("Goals ",Goals," were satisfied") /
{Goals=[on(b3,table),on(b2,b3),on(b1,b2)]}Trigger: +des([on(b3,table),on(b2,b3),on(b1,b2)])[noenv,code(org.soton.peleus.act.plan([on(b3,table),on(b2,b3),on(b1,b2)])),code_line(29),code_src("peleus.asl"),error(action_failed),error_msg("no environment configured!"),source(self)]
[peleus] Adding belief clear(table)

This mas2j file is as following:

MAS peleus {
    infrastructure: Centralised
    agents: 
        peleus;            
}

Part of agent code (written by Felipe Meneguzzi) is showed bellow:

//The next line is line 28
+des(Goals) : true
     <- org.soton.peleus.act.plan(Goals);
         !checkGoals(Goals);
         .print("Goals ",Goals," were satisfied").

+!checkGoals([]) : true <- true.

//The next line is line 40
+!checkGoals([H|T]) : true
    <- .print("Checking ", H);
        org.soton.peleus.act.isTrue(H);
        !checkGoals(T).

I guess it is about the folder structure, how to set up Jason to search for java files in specific locations?

The folders structure is like this:

 Peleus\src\org\soton\peleus for java files
 Peleus\examples for mas2j and asl tested project

Upvotes: 2

Views: 328

Answers (1)

Jomi Hubner
Jomi Hubner

Reputation: 141

It all depends on how you are executing the application.

  • If you are using java, the CLASSPATH should be defined to include the missing classes.
  • if you are using jason script (that uses Ant), the .mas2j file should include the class path as well.

More on that in the FAQ. Notice that CLASSPATH is where .class files are found, not .java source code files. The error regards a missing class, not a missing source code.

Upvotes: 1

Related Questions