JADE in Eclipse ICP exception

删除回忆录丶 提交于 2019-12-10 10:35:28

问题


I want to start writing JADE in Eclipse. To do so I added the following script provided by Java Agent Development Framework - Eclipse and Maven integration.

I made an agent:

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.");
    }
}

And when I run my JadeBootThread.run() with the following parameters:

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

private final String GUI_args = "-gui";

I get the following error:

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.

I tried messing around with the private final String GUI_args = "-gui"; parameters and added "-local-port 1111" but this gave the exact same error (the port in the error also stayed 1099)


回答1:


Add the following while running your code as arguments in eclipse

-gui -host 192.168.2.9 -port 12344 
agentttt:com.DAO.test_agents.PingAgent

Then name main class as

jade.Boot

Then just run your code with all the external jar files added ,i guess this won't give any ICP error.




回答2:


Another way might be to check if a another program uses that port and thereby blocking JADE from starting correctly. You can find out which program is using which port by using netstat in windows

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

In my case it was Dropbox. I started Dropbox, closed it and started JADE again --> worked fine this way :)



来源:https://stackoverflow.com/questions/28211379/jade-in-eclipse-icp-exception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!