Hi, I am traying this simple example and i hav a null pointer exception , I can´t see where
@Agent
public class TestBDI {
@AgentFeature
protected IBDIAgentFeature bdi;
Stringf;@BeliefMap<String,String>frases;@AgentCreatedpublicvoidinit(){frases=newHashMap<String,String>();frases.put("Nombre","Alice");frases.put("Edad","40");frases.put("Cancer","No puede ser");frases.put("Buenas","Buen dia");frases.put("Nada","Gracias a Dios!");frases.put("Lo siento","Usted está equivocado. Adios");}@GoalclassResponder{protectedStringfrase;publicResponder(Stringf){frase=f;}publicvoidsetFrase(Stringf){frase=f;}publicStringgetFrase(){returnfrase;}}@Plan(trigger=@Trigger(goals=Responder.class))publicvoidResponder(Responderg){System.out.println(frases.get(g.frase));}@AgentBodypublicIFuture<Void>Do(){Scannerpreg=newScanner(System.in);f=preg.next();Responderresp=(Responder)bdi.dispatchTopLevelGoal(newResponder(f)).get();returnIFuture.DONE;}
Hi, I am traying this simple example and i hav a null pointer exception , I can´t see where
@Agent
public class TestBDI {
@AgentFeature
protected IBDIAgentFeature bdi;
}
The null pointer is on
Responder resp= (Responder) bdi.dispatchTopLevelGoal(new Responder(f)).get();
Thx
Hi, It run ok, whit JCC , but I want it run whit java debugger , because I need to see step by step the execution, How can I do this??
Thx, a lot
Last edit: yanet 2016-06-23
hello???
The same way as any other Java program. Use 'debug' in eclipse and use jadex.base.Starter as start class.
Hi, first , Thanks for helping me, I did , but I have the same error,
Open 'this' in variable view and check which fields are null. Is bdi null? Is f null? etc.
bdi,
Then injection does not work. Is the annotation in place?
I think so,
It works in JCC,
I can´t find the problem... Maybe I am doing somthing wrong, how do you debug this code in eclipse
thx
Last edit: yanet 2016-06-23