Subject: RE: [jade-develop] Misterious Behaviour... and moody sniffer
From: Bellifemine Fabio (Fabio.Bellifemine@TILAB.COM)
Date: Wed Oct 02 2002 - 15:43:29 MET DST
Francesco,
1. Looking at the stack trace the problem seems to be in the class
MyMAS.LPA$RequestBehaviour
method prepareRequest
line 279
2. The sniffer problem is not completely clear to me but the most probable ipotheses is that the messages are not being sent and, as a consequence, the sniffer is not sniffing them. I recommend you to use the Introspector Agent that, in particular after JADE 2.61, is a very powerfull debugger because it includes also a step-by-step facility.
ciao, Fabio.
-----Original Message-----
From: Francesco Ricca [mailto:ciccio@magicocosenza.it]
Sent: 23 September 2002 11:29
To: Bellifemine Fabio
Cc: jade-develop@sharon.cselt.it
Subject: Re: [jade-develop] Misterious Behaviour... and moody sniffer
Tank you in advance.
Luned́, Settembre 23, 2002, alle 10:23 AM, Bellifemine Fabio ha scritto:
1. SimpleAchieveREInitiator problem
are you using the snapshot of 2nd August or the JADE 2.6 release?
In the snapshot we already fixed such a type of bug.
Eventually, send me the stack trace of the nullpointer exception you get.
This error happens with JADE 2.6 release and also with the snapshot of 2nd August.
This is the case of the release. (but with the snapshot NullPointerException is thorown at the same row!)
java.lang.NullPointerException
at MyMAS.LPA$RequestBehaviour.prepareRequest(LPA.java:279)
at jade.proto.SimpleAchieveREInitiator.action(SimpleAchieveREInitiator.java:169)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.Agent.mainLoop(Agent.java:1690)
at jade.core.Agent.run(Agent.java:1511)
at java.lang.Thread.run(Thread.java:496)
java.lang.NullPointerException
at MyMAS.LPA$RequestBehaviour.prepareRequest(LPA.java:279)
at jade.proto.SimpleAchieveREInitiator.action(SimpleAchieveREInitiator.java:169)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.Agent.mainLoop(Agent.java:1690)
at jade.core.Agent.run(Agent.java:1511)
at java.lang.Thread.run(Thread.java:496)
java.lang.NullPointerException
at MyMAS.LPA$RequestBehaviour.prepareRequest(LPA.java:279)
at jade.proto.SimpleAchieveREInitiator.action(SimpleAchieveREInitiator.java:169)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.Agent.mainLoop(Agent.java:1690)
at jade.core.Agent.run(Agent.java:1511)
at java.lang.Thread.run(Thread.java:496)
jade.content.onto.OntologyException: Missing value for mandatory slot URI. Schema is jade.content.schema.ConceptSchema-SelectedLO
at jade.content.schema.ObjectSchemaImpl.validate(ObjectSchemaImpl.java:360)
at jade.content.schema.ObjectSchemaImpl.validateSlots(ObjectSchemaImpl.java:327)
at jade.content.schema.ConceptSchema.validate(ConceptSchema.java:151)
at jade.content.schema.ObjectSchemaImpl.validate(ObjectSchemaImpl.java:382)
at jade.content.schema.ObjectSchemaImpl.validateSlots(ObjectSchemaImpl.java:327)
at jade.content.schema.PredicateSchema.validate(PredicateSchema.java:137)
at jade.content.ContentManager.validate(ContentManager.java:322)
at jade.content.ContentManager.fillContent(ContentManager.java:201)
at MyMAS.LPA$PrepareResultNotificationBehaviour.action(LPA.java:487)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)
at jade.core.Agent.mainLoop(Agent.java:1690)
at jade.core.Agent.run(Agent.java:1511)
at java.lang.Thread.run(Thread.java:496)
2. Sniffer.
Probably, the messages that are not sniffed by the sniffer are syntactically not valid.
Can you send me one of these not-sniffed messages?
With the release the sniffer is totally blind.
With the snapshot is moody.
Classes and example message below:
package MyMAS.MASELOntology;
import jade.content.AgentAction;
import java.util.*;
import jade.util.leap.List;
public class BuildCourse implements AgentAction {
private String username;
private String competenceName;
private List queryParameters;
public String getUsername() {
return username;
}
public void setUsername(String _username) {
username = _username;
}
public String getCompetenceName() {
return competenceName;
}
public void setCompetenceName(String _competenceName) {
competenceName = _competenceName;
}
public List getQueryParameters() {
return queryParameters;
}
public void setQueryParameters(List _queryParameters) {
queryParameters = _queryParameters;
}
}
in Ontology:
// -----------------------------------------------------BUILD_COURSE
add(new AgentActionSchema(BUILD_COURSE), BuildCourse.class);
as=(AgentActionSchema)getSchema(BUILD_COURSE);
as.add(USERNAME, (PrimitiveSchema)getSchema(BasicOntology.STRING),ObjectSchema.MANDATORY);
as.add(COMPETENCE_NAME, (PrimitiveSchema)getSchema(BasicOntology.STRING),ObjectSchema.MANDATORY);
as.add(QUERY_PARAMETERS_ITEM, (ConceptSchema)getSchema(QUERY_PARAMETER),0,ObjectSchema.UNLIMITED);
in prepareRequest
Action a=new Action();
BuildCourse bc=new BuildCourse();
bc.setCompetenceName("competence name");
bc.setUsername("ciccio");
a.setActor(new AID("LPA", AID.ISLOCALNAME));
a.setAction(bc);
msg.clearAllReceiver();
msg.addReceiver(new AID("LPA", AID.ISLOCALNAME));
break;
What is my mistake?
(REQUEST
:sender ( agent-identifier :name SAA@localhost:1099/JADE :addresses (sequence IOR:000000000000001149444C3A464950412F4D54533A312E3000000000000000010000000000000050000101000000000A3132372E302E302E3100C05000000018AFABCAFF000000020BCDC83F0000000800000000000000000000000100000001000000140000000000010020000000000001010000000000 IOR:000000000000001149444C3A464950412F4D54533A312E3000000000000000010000000000000050000101000000000A3132372E302E302E3100C05600000018AFABCAFF000000020BCDCDDD0000000800000000000000000000000100000001000000140000000000010020000000000001010000000000 ))
:receiver (set ( agent-identifier :name LPA@localhost:1099/JADE) )
:content "((action (agent-identifier :name LPA@localhost:1099/JADE :addresses (sequence) :resolvers (sequence)) (BuildCourse :username ciccio :competenceName \"competence name\")))"
:language FIPA-SL
:ontology MASELOntology
:protocol fipa-request
:conversation-id C6578082_1032772523076
)
-----Original Message-----
From: Francesco Ricca [mailto:ciccio@magicocosenza.it]
Sent: 23 September 2002 00:53
To: jade-develop@sharon.cselt.it
Subject: [jade-develop] Misterious Behaviour... and moody sniffer
Please help me.
I've seen a strange behavior of SimpleAchieveREInitiator class and a
moody...a bit crazy sniffer behavior.
1) SimpleAchieveREInitiator problem
When I use a SimpleAchieveREInitiator class XX, the former time it runs
no exception are thrown.
But if I reset XX and next add XX behavior to may agent a
NullPointerException in throws.
(It seem that the ACLMessage passed in the reset method isn't properly
userd).
A bit of code:
class RequestBehaviour extends SimpleAchieveREInitiator
{
......
protected ACLMessage prepareRequest(ACLMessage msg)
{
try
{
//msg=new ACLMessage(ACLMessage.REQUEST); // if I use this line
the NullPointerException is thrown in handleAllResultNotification method
(I was only an attempt to understand the problem)
msg.setProtocol(FIPAProtocolNames.FIPA_REQUEST); // msg here
causes NullPointerException (the second time I use my RequestB..)
msg.setOntology(ontology.getName());
msg.setLanguage(codec.getName());
Action a=new Action();
...........
At the end of my interaction I call
void resetSubBehaviour()
{
jade.util.leap.Collection c=getChildren();
jade.util.leap.Iterator iter=c.iterator();
while(iter.hasNext())
{
Behaviour tmpB=(Behaviour)iter.next();
if(tmpB instanceof RequestBehaviour)
{
((RequestBehaviour)tmpB).reset(new
ACLMessage(ACLMessage.REQUEST)); //here my RequestBehaviour is reset
}
else tmpB.reset();
}
reset();
}
Now I'm forced to recreate and re-add my RequestBehaviour classes before
re-execute it.
This causes memory and execution time waste.
How to solve this problem? Forget I something when I reset
RequestBehaviour's?
2) moody sniffer
Some days ago I've signaled that my sniffer doesn't "sniff".
Today I've compiled the last snapshot (built on 2002/08/22 13:02:04) and
tried the sniffer on my AP.
It seems that the sniffer is very moody because it sniffs only some
messages.
For ex. Request messages are neglected always!
In my previous mail I sustained that the problem was in the visibility
of my ontological classes.
Today my moody sniffer is able to see also messages where I use my
ontological classes...
...but IT DECIDE if a message is "good" or not!
Messages are sent because I'm debugging my code using
System.out.printl(receivedMessage.toString()) calls on receiver
behaviours.
Please help me, because this type of debugging is very annoying.
Forgive my english.
Francesco
_______________________________________________
jade-develop mailing list
jade-develop@sharon.cselt.it
http://sharon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT http://jade.cselt.it/mailing.htm#unsubscribe
====================================================================
CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to MailAdmin@tilab.com. Thank you
====================================================================
====================================================================
CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to MailAdmin@tilab.com. Thank you
====================================================================
Tank you in advance.
Luned́, Settembre 23, 2002, alle 10:23 AM, Bellifemine Fabio ha scritto:
1. SimpleAchieveREInitiator problemare you using the snapshot of 2nd August or the JADE 2.6 release?In the snapshot we already fixed such a type of bug.Eventually, send me the stack trace of the nullpointer exception you get.
This error happens with JADE 2.6 release and also with the snapshot of 2nd August.
This is the case of the release. (but with the snapshot NullPointerException is thorown at the same row!)
java.lang.NullPointerExceptionat MyMAS.LPA$RequestBehaviour.prepareRequest(LPA.java:279)at jade.proto.SimpleAchieveREInitiator.action(SimpleAchieveREInitiator.java:169)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.Agent.mainLoop(Agent.java:1690)at jade.core.Agent.run(Agent.java:1511)at java.lang.Thread.run(Thread.java:496)java.lang.NullPointerExceptionat MyMAS.LPA$RequestBehaviour.prepareRequest(LPA.java:279)at jade.proto.SimpleAchieveREInitiator.action(SimpleAchieveREInitiator.java:169)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.Agent.mainLoop(Agent.java:1690)at jade.core.Agent.run(Agent.java:1511)at java.lang.Thread.run(Thread.java:496)java.lang.NullPointerExceptionat MyMAS.LPA$RequestBehaviour.prepareRequest(LPA.java:279)at jade.proto.SimpleAchieveREInitiator.action(SimpleAchieveREInitiator.java:169)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.Agent.mainLoop(Agent.java:1690)at jade.core.Agent.run(Agent.java:1511)at java.lang.Thread.run(Thread.java:496)jade.content.onto.OntologyException: Missing value for mandatory slot URI. Schema is jade.content.schema.ConceptSchema-SelectedLOat jade.content.schema.ObjectSchemaImpl.validate(ObjectSchemaImpl.java:360)at jade.content.schema.ObjectSchemaImpl.validateSlots(ObjectSchemaImpl.java:327)at jade.content.schema.ConceptSchema.validate(ConceptSchema.java:151)at jade.content.schema.ObjectSchemaImpl.validate(ObjectSchemaImpl.java:382)at jade.content.schema.ObjectSchemaImpl.validateSlots(ObjectSchemaImpl.java:327)at jade.content.schema.PredicateSchema.validate(PredicateSchema.java:137)at jade.content.ContentManager.validate(ContentManager.java:322)at jade.content.ContentManager.fillContent(ContentManager.java:201)at MyMAS.LPA$PrepareResultNotificationBehaviour.action(LPA.java:487)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:104)at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:258)at jade.core.Agent.mainLoop(Agent.java:1690)at jade.core.Agent.run(Agent.java:1511)at java.lang.Thread.run(Thread.java:496)
2. Sniffer.Probably, the messages that are not sniffed by the sniffer are syntactically not valid.Can you send me one of these not-sniffed messages?
With the release the sniffer is totally blind.With the snapshot is moody.
Classes and example message below:
package MyMAS.MASELOntology;import jade.content.AgentAction;import java.util.*;import jade.util.leap.List;public class BuildCourse implements AgentAction {
private String username;private String competenceName;private List queryParameters;
public String getUsername() {return username;}public void setUsername(String _username) {username = _username;}public String getCompetenceName() {return competenceName;}public void setCompetenceName(String _competenceName) {competenceName = _competenceName;}public List getQueryParameters() {return queryParameters;}public void setQueryParameters(List _queryParameters) {queryParameters = _queryParameters;}}
in Ontology:
// -----------------------------------------------------BUILD_COURSEadd(new AgentActionSchema(BUILD_COURSE), BuildCourse.class);as=(AgentActionSchema)getSchema(BUILD_COURSE);as.add(USERNAME, (PrimitiveSchema)getSchema(BasicOntology.STRING),ObjectSchema.MANDATORY);as.add(COMPETENCE_NAME, (PrimitiveSchema)getSchema(BasicOntology.STRING),ObjectSchema.MANDATORY);as.add(QUERY_PARAMETERS_ITEM, (ConceptSchema)getSchema(QUERY_PARAMETER),0,ObjectSchema.UNLIMITED);
in prepareRequest
Action a=new Action();BuildCourse bc=new BuildCourse();bc.setCompetenceName("competence name");bc.setUsername("ciccio");a.setActor(new AID("LPA", AID.ISLOCALNAME));a.setAction(bc);msg.clearAllReceiver();msg.addReceiver(new AID("LPA", AID.ISLOCALNAME));break;
What is my mistake?
(REQUEST:sender ( agent-identifier :name SAA@localhost:1099/JADE :addresses (sequence IOR:000000000000001149444C3A464950412F4D54533A312E3000000000000000010000000000000050000101000000000A3132372E302E302E3100C05000000018AFABCAFF000000020BCDC83F0000000800000000000000000000000100000001000000140000000000010020000000000001010000000000 IOR:000000000000001149444C3A464950412F4D54533A312E3000000000000000010000000000000050000101000000000A3132372E302E302E3100C05600000018AFABCAFF000000020BCDCDDD0000000800000000000000000000000100000001000000140000000000010020000000000001010000000000 )):receiver (set ( agent-identifier :name LPA@localhost:1099/JADE) ):content "((action (agent-identifier :name LPA@localhost:1099/JADE :addresses (sequence) :resolvers (sequence)) (BuildCourse :username ciccio :competenceName \"competence name\")))":language FIPA-SL:ontology MASELOntology:protocol fipa-request:conversation-id C6578082_1032772523076)
-----Original Message-----From: Francesco Ricca [mailto:ciccio@magicocosenza.it]Sent: 23 September 2002 00:53To: jade-develop@sharon.cselt.itSubject: [jade-develop] Misterious Behaviour... and moody sniffer
Please help me.
I've seen a strange behavior of SimpleAchieveREInitiator class and amoody...a bit crazy sniffer behavior.
1) SimpleAchieveREInitiator problem
When I use a SimpleAchieveREInitiator class XX, the former time it runsno exception are thrown.But if I reset XX and next add XX behavior to may agent aNullPointerException in throws.(It seem that the ACLMessage passed in the reset method isn't properlyuserd).
A bit of code:
class RequestBehaviour extends SimpleAchieveREInitiator{......
protected ACLMessage prepareRequest(ACLMessage msg){try{//msg=new ACLMessage(ACLMessage.REQUEST); // if I use this linethe NullPointerException is thrown in handleAllResultNotification method(I was only an attempt to understand the problem)
msg.setProtocol(FIPAProtocolNames.FIPA_REQUEST); // msg herecauses NullPointerException (the second time I use my RequestB..)msg.setOntology(ontology.getName());msg.setLanguage(codec.getName());Action a=new Action();...........
At the end of my interaction I call
void resetSubBehaviour(){jade.util.leap.Collection c=getChildren();jade.util.leap.Iterator iter=c.iterator();while(iter.hasNext()){Behaviour tmpB=(Behaviour)iter.next();if(tmpB instanceof RequestBehaviour){((RequestBehaviour)tmpB).reset(newACLMessage(ACLMessage.REQUEST)); //here my RequestBehaviour is reset}else tmpB.reset();}reset();}
Now I'm forced to recreate and re-add my RequestBehaviour classes beforere-execute it.This causes memory and execution time waste.
How to solve this problem? Forget I something when I resetRequestBehaviour's?
2) moody sniffer
Some days ago I've signaled that my sniffer doesn't "sniff".Today I've compiled the last snapshot (built on 2002/08/22 13:02:04) andtried the sniffer on my AP.It seems that the sniffer is very moody because it sniffs only somemessages.
For ex. Request messages are neglected always!
In my previous mail I sustained that the problem was in the visibilityof my ontological classes.Today my moody sniffer is able to see also messages where I use myontological classes......but IT DECIDE if a message is "good" or not!
Messages are sent because I'm debugging my code usingSystem.out.printl(receivedMessage.toString()) calls on receiverbehaviours.
Please help me, because this type of debugging is very annoying.
Forgive my english.
Francesco
_______________________________________________jade-develop mailing listjade-develop@sharon.cselt.ithttp://sharon.cselt.it/mailman/listinfo/jade-developUNSUBSCRIBE INSTRUCTIONS AT http://jade.cselt.it/mailing.htm#unsubscribe
====================================================================CONFIDENTIALITY NOTICEThis message and its attachments are addressed solely to the personsabove and may contain confidential information. If you have receivedthe message in error, be informed that any use of the content hereofis prohibited. Please return it immediately to the sender and deletethe message. Should you have any questions, please contact us byreplying to MailAdmin@tilab.com. Thank you====================================================================
====================================================================
CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to MailAdmin@tilab.com. Thank you
====================================================================
This archive was generated by hypermail 2a22 : Wed Oct 02 2002 - 15:43:40 MET DST