JADE IPMS:代理迁移失败

时间:2018-12-02 19:03:22

标签: java agents-jade

我一直在尝试使用Jade 4.5和IPMS插件执行平台间代理迁移。我为运行程序传递的参数为:

-container -agents mob:pkg.MobileAgent
-services jade.core.mobility.AgentMobilityService;jade.core.migration.InterPlatformMobilityService

主类设置为jade.Boot。我正在使用的代码是:

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在这两个平台中都设置了主机名。我还可以从主机名和IP ping通。

要运行玉器服务,请使用以下命令:

  

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   服务jade.core.mobility.AgentMobilityService; jade.core.migration.InterPlatformMobilityService -accept-foreign-agents true

一旦我运行了jade代理迁移代码,就会遇到以下错误:

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

请为我建议一个解决该问题的可行方法

0 个答案:

没有答案