I have been trying to perform inter-plaform agent migration using Jade 4.5 along with IPMS add-on. The arguments I pass to run the program are:
-container -agents mob:pkg.MobileAgent -services jade.core.mobility.AgentMobilityService;jade.core.migration.InterPlatformMobilityService
The main class is set it jade.Boot. The code that I am using is:
package pkg;
import jade.core.AID;
import jade.core.Agent;
import jade.core.PlatformID;
import jade.core.behaviours.TickerBehaviour;
@SuppressWarnings("serial")
public class MobileAgent extends Agent {
@Override
protected void setup() {
super.setup();
addBehaviour(new MyTickerBehaviour(this, 1000));
System.out.println("Hello World. I am an agent!");
System.out.println("My LocalName: " + getAID().getLocalName());
System.out.println("My Name: " + getAID().getName());
//System.out.println("My Address: " + getAID().getAddressesArray()[0]);
}
private class MyTickerBehaviour extends TickerBehaviour {
Agent agent;
// long interval;
int counter;
public MyTickerBehaviour(Agent agent, long interval) {
super(agent, interval);
this.agent = agent;
// this.interval = interval;
}
@Override
protected void onTick() {
if (counter == 3) {
// move out
AID remoteAMS = new AID("ams@ali", AID.ISGUID);
remoteAMS.addAddresses("http://ali:7778/acc");
PlatformID destination = new PlatformID(remoteAMS);
agent.doMove(destination);
}
if (counter == 10) {
// move back
AID remoteAMS = new AID("ams@nauyan", AID.ISGUID);
remoteAMS.addAddresses("http://nauyan:7778/acc");
PlatformID destination = new PlatformID(remoteAMS);
agent.doMove(destination);
}
if (counter < 15)
System.out.println(counter++);
else
agent.doDelete();
}
}
}
TI have set hostnames in both the platfroms. I am also able to ping from both hostnames and IPs.
To run jade service I using the following command:
java -cp Jars/jade.jar:Jars/migration.jar:Jars/iiop.jar:Jars/jadeTools.jar:Jars/http.jar:Jars/commons-codec/commons-codec-1.3.jar jade.Boot -gui -platform-id [platform-name] -host [hostname] -local-host 127.0.01 -services jade.core.mobility.AgentMobilityService;jade.core.migration.InterPlatformMobilityService -accept-foreign-agents true
Once I run the jade agent migration code I run into the following error:
Dec 02, 2018 11:28:51 PM jade.core.Runtime beginContainer
INFO: ----------------------------------
This is JADE 4.5.0 - revision 6825 of 23-05-2017 10:06:04
downloaded in Open Source, under LGPL restrictions,
at http://jade.tilab.com/
----------------------------------------
Dec 02, 2018 11:28:51 PM jade.imtp.leap.LEAPIMTPManager initialize
INFO: Listening for intra-platform commands on address:
- jicp://192.168.164.1:35381
Dec 02, 2018 11:28:51 PM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Dec 02, 2018 11:28:51 PM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Dec 02, 2018 11:28:51 PM jade.core.BaseService init
INFO: Service jade.core.resource.ResourceManagement initialized
Dec 02, 2018 11:28:51 PM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Dec 02, 2018 11:28:51 PM jade.core.BaseService init
INFO: Service jade.core.migration.InterPlatformMobility initialized
Dec 02, 2018 11:28:51 PM jade.core.migration.InterPlatformMobilityService boot
INFO: IPMS: Agents JAR path set to /home/nauyan/eclipse-workspace/JADE/jarManager/nauyan/
Dec 02, 2018 11:28:51 PM jade.core.migration.InterPlatformMobilityService boot
INFO: IPMS: Agents JAR path directory successfully created
Dec 02, 2018 11:28:51 PM jade.core.migration.InterPlatformMobilityService boot
INFO: IPMS: Initialization completed
Dec 02, 2018 11:28:51 PM jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Container-7@192.168.164.1 is ready.
--------------------------------------------
Hello World. I am an agent!
My LocalName: mob
My Name: mob@nauyan
0
1
2
3
IPMS: Migrating agent mob to remote-platform ali at address http://ali:7778/acc
IPMS: Agent mob acquired
IPMS: Agent mob serialized
IPMS: Container code source for Agent mob is Container-7
Dec 02, 2018 11:28:55 PM jade.core.migration.InterPlatformMobilityService$CommandSourceSink handleInformMigrated
SEVERE: Source-Sink: handleInformMigrated: error while migrating:
java.lang.NullPointerException
at jade.core.migration.InterPlatformMobilityService$CommandSourceSink.handleInformMigrated(InterPlatformMobilityService.java:316)
at jade.core.migration.InterPlatformMobilityService$CommandSourceSink.consume(InterPlatformMobilityService.java:274)
at jade.core.CommandProcessor$SinksFilter.accept(CommandProcessor.java:253)
at jade.core.Filter.filter(Filter.java:89)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.CommandProcessor.processOutgoing(CommandProcessor.java:216)
at jade.core.BaseService.submit(BaseService.java:272)
at jade.core.migration.InterPlatformMobilityService$CommandOutgoingFilter.handleInformMoved(InterPlatformMobilityService.java:657)
at jade.core.migration.InterPlatformMobilityService$CommandOutgoingFilter.accept(InterPlatformMobilityService.java:527)
at jade.core.Filter.filter(Filter.java:89)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.CommandProcessor.processOutgoing(CommandProcessor.java:216)
at jade.core.BaseService.submit(BaseService.java:272)
at jade.core.mobility.AgentMobilityService$TransitLifeCycle.informMoved(AgentMobilityService.java:1539)
at jade.core.mobility.AgentMobilityService$TransitLifeCycle.execute(AgentMobilityService.java:1494)
at jade.core.Agent.run(Agent.java:1524)
at java.lang.Thread.run(Thread.java:748)
jade.core.IMTPException: Error while migrating - Caused by: java.lang.NullPointerException
at jade.core.migration.InterPlatformMobilityService$CommandOutgoingFilter.handleInformMoved(InterPlatformMobilityService.java:663)
at jade.core.migration.InterPlatformMobilityService$CommandOutgoingFilter.accept(InterPlatformMobilityService.java:527)
at jade.core.Filter.filter(Filter.java:89)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.CommandProcessor.processOutgoing(CommandProcessor.java:216)
at jade.core.BaseService.submit(BaseService.java:272)
at jade.core.mobility.AgentMobilityService$TransitLifeCycle.informMoved(AgentMobilityService.java:1539)
at jade.core.mobility.AgentMobilityService$TransitLifeCycle.execute(AgentMobilityService.java:1494)
at jade.core.Agent.run(Agent.java:1524)
at java.lang.Thread.run(Thread.java:748)
Nested Exception:
java.lang.NullPointerException
at jade.core.migration.InterPlatformMobilityService$CommandSourceSink.handleInformMigrated(InterPlatformMobilityService.java:316)
at jade.core.migration.InterPlatformMobilityService$CommandSourceSink.consume(InterPlatformMobilityService.java:274)
at jade.core.CommandProcessor$SinksFilter.accept(CommandProcessor.java:253)
at jade.core.Filter.filter(Filter.java:89)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.CommandProcessor.processOutgoing(CommandProcessor.java:216)
at jade.core.BaseService.submit(BaseService.java:272)
at jade.core.migration.InterPlatformMobilityService$CommandOutgoingFilter.handleInformMoved(InterPlatformMobilityService.java:657)
at jade.core.migration.InterPlatformMobilityService$CommandOutgoingFilter.accept(InterPlatformMobilityService.java:527)
at jade.core.Filter.filter(Filter.java:89)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.CommandProcessor.processOutgoing(CommandProcessor.java:216)
at jade.core.BaseService.submit(BaseService.java:272)
at jade.core.mobility.AgentMobilityService$TransitLifeCycle.informMoved(AgentMobilityService.java:1539)
at jade.core.mobility.AgentMobilityService$TransitLifeCycle.execute(AgentMobilityService.java:1494)
at jade.core.Agent.run(Agent.java:1524)
at java.lang.Thread.run(Thread.java:748)
4
5
6
7
8
9
10
Please suggest me a feasible solution to this problem