I'm currently trying to create agents with JADE platform in a Play 2.0 Java application. I use the basic java play template for this. My index method in the HomeController class goes like this :
public Result index() {
try {
Runtime rt = Runtime.instance();
Properties p = new ExtendedProperties();
p.setProperty("gui", "true");
ProfileImpl pc = new ProfileImpl(p);
ContainerController container = rt.createMainContainer(pc);
AgentController agentController1=container.createNewAgent("Agent1","controllers.BaseAgent",new Object[]{""});
agentController1.start();
} catch (Exception e){
e.printStackTrace();
}
return ok(index.render("Your new application is ready."));
}
The container's GUI appears when I go on localhost which is fine. However I get the following error in the console:
jade.core.IMTPException: Class controllers.BaseAgent for agent ( agent-identifier :name Agent1@10.32.6.48:1099/JADE ) not found - Caused by: controllers.BaseAgent
My BaseAgent class goes like this (and is indeed in the controllers package) :
package controllers;
import jade.core.Agent;
public class BaseAgent extends Agent {
@Override
protected void setup(){
System.out.println("I am the BaseAgent");
}
}
I thought the problem might be coming from the fact the container isn't initialized in a main method, but the application being a Play project there is no main method. It may also be related to a classpath problem, when I try to add an agent from the GUI I only get one option :
Classpath contains one classes that extends jade.core.Agent
Thank you very much from your help ! I'm having a lot of trouble trying to find what the problem is.