JADE 代理未添加到代理列表

JADE Agent doesn't added to Agents list

我想在 JADE 环境中运行一个简单的代理(Mac OSX El Capitan,Jade 4.4.0),这是我的代理代码:

public class BookBuyerAgent extends Agent {
    protected void setup() {
        // Printout a welcome message
        System.out.println("Hello World! My name is "+getLocalName());

    }
}

我在 bash_profile 中这样设置 CLASSPATH:

export CLASSPATH=/Users/John/jade/lib/jade.jar:/Users/John/jade/lib/jadeExamples.jar:/Users/John/jade/lib/commons-codec/commons-codec-1.3.jar:/Users/John/jade/src/jade/:/Users/John/Desktop/

我运行我的代理人是这样的:

java  jade.Boot -gui -agents buyer:com.app.jade.BookBuyerAgent

但我收到此警告:

WARNING: Automatic main-detection mechanism initialization failed (Error setting up multicast socket - Caused by:  Can't assign requested address). Mechanism disabled!

然后出现此错误:

SEVERE: Cannot create agent buyer: Class com.app.jade.BookBuyerAgent for agent ( agent-identifier :name buyer@192.168.1.4:1099/JADE ) not found - Caused by:  com.app.jade.BookBuyerAgent

之后,出现了 Jade GUI,但我的代理没有添加到代理列表中,而且它不起作用。我检查了一切,但我不知道是什么问题。

这是我收到的完整消息:

Feb 27, 2016 4:14:59 PM jade.core.Runtime beginContainer
INFO: ----------------------------------
    This is JADE 4.4.0 - revision 6778 of 21-12-2015 12:24:43
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
----------------------------------------
Feb 27, 2016 4:14:59 PM jade.imtp.leap.LEAPIMTPManager initialize
INFO: Listening for intra-platform commands on address:
- jicp://192.168.1.4:1099

Feb 27, 2016 4:14:59 PM jade.core.AgentContainerImpl init
WARNING: Automatic main-detection mechanism initialization failed (Error setting up multicast socket - Caused by:  Can't assign requested address). Mechanism disabled!
Feb 27, 2016 4:15:01 PM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Feb 27, 2016 4:15:01 PM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Feb 27, 2016 4:15:01 PM jade.core.BaseService init
INFO: Service jade.core.resource.ResourceManagement initialized
Feb 27, 2016 4:15:01 PM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Feb 27, 2016 4:15:01 PM jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
Feb 27, 2016 4:15:31 PM jade.mtp.http.HTTPServer <init>
INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Feb 27, 2016 4:15:31 PM jade.core.messaging.MessagingService boot
INFO: MTP addresses:
http://192.168.1.4:7778/acc
Feb 27, 2016 4:15:31 PM jade.core.AgentContainerImpl startBootstrapAgents
SEVERE: Cannot create agent buyer: Class com.app.jade.BookBuyerAgent for agent ( agent-identifier :name buyer@192.168.1.4:1099/JADE ) not found - Caused by:  com.app.jade.BookBuyerAgent
Feb 27, 2016 4:15:31 PM jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Main-Container@192.168.1.4 is ready.

我不确定我是否理解这个问题,但是为了警告,我发现了以下内容: 此警告表明自动主检测机制(即外围容器能够自动发现主容器 运行 的位置的机制)被禁用,因为底层网络堆栈不支持 IP 多播(例如,当您在未连接到网络的 Windows XP PC 上工作时,情况总是如此)。 前提是,在启动外围容器时明确指定主容器的主机和端口(当与默认的不同时),则可以忽略此警告。

用于部署代理(假设部署了一个容器)

java  jade.Boot -container -host localhost -agents buyer:com.app.jade.BookBuyerAgent