Eclipse ICP异常中的JADE

时间:2015-01-29 09:42:36

标签: java agents-jade

我想开始在Eclipse中编写JADE。为此,我添加了Java Agent Development Framework - Eclipse and Maven integration提供的以下脚本。

我做了一个代理人:

public class Test extends Agent {

    private static final long serialVersionUID = 1L;

    String nickname = "Peter";
    AID id = new AID(nickname, AID.ISLOCALNAME);


    protected void setup() {
        // Printout a welcome message
        System.out.println("Hello! Buyer-agent " +getAID().getName()+ " is ready.");
    }
}

当我使用以下参数运行JadeBootThread.run()时:

private final String ACTOR_NAMES_args = "buyer:test.Test";

private final String GUI_args = "-gui";

我收到以下错误:



Jan 29, 2015 5:33:33 PM jade.core.Runtime beginContainer
INFO: ----------------------------------
    This is JADE 4.3.3 - revision 6726 of 2014/12/09 09:33:02
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
----------------------------------------
Jan 29, 2015 5:33:33 PM jade.imtp.leap.CommandDispatcher addICP
WARNING: Error adding ICP jade.imtp.leap.JICP.JICPPeer@71e070c0[Cannot bind server socket to localhost port 1099].
Jan 29, 2015 5:33:33 PM jade.core.AgentContainerImpl joinPlatform
SEVERE: Communication failure while joining agent platform: No ICP active
jade.core.IMTPException: No ICP active
	at jade.imtp.leap.LEAPIMTPManager.initialize(LEAPIMTPManager.java:138)
	at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:319)
	at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:492)
	at jade.core.Runtime.createMainContainer(Runtime.java:166)
	at jade.Boot.main(Boot.java:89)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at main.JadeBootThread.run(JadeBootThread.java:33)
	at main.Main.main(Main.java:7)
Jan 29, 2015 5:33:33 PM jade.core.Runtime$1 run
INFO: JADE is closing down now.




我尝试搞乱私人决赛String GUI_args =" -gui&#34 ;;参数并添加" -local-port 1111"但这给出了完全相同的错误(错误中的端口也保持1099)

2 个答案:

答案 0 :(得分:4)

在eclipse

中将代码作为参数运行时添加以下内容
-gui -host 192.168.2.9 -port 12344 
agentttt:com.DAO.test_agents.PingAgent

然后将主类命名为

jade.Boot

然后只需添加所有外部jar文件来运行你的代码,我想这不会给出任何ICP错误。

答案 1 :(得分:1)

另一种方法可能是检查另一个程序是否使用该端口,从而阻止JADE正确启动。 您可以在Windows

中使用netstat找出哪个程序正在使用哪个端口

How can you find out which process is listening on a port on Windows?

就我而言,它是Dropbox。我开始使用Dropbox,关闭它并再次启动JADE - >这样做得很好:))