我想在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.
答案 0 :(得分:1)
我不确定我是否理解这个问题,但是对于警告,我在这里找到了: 此警告告诉自动主检测机制(即外围容器能够自动发现主容器运行位置的机制)被禁用,因为底层网络堆栈不支持IP多播(这始终是例如,当您使用未连接到网络的Windows XP PC时。 前提是,在启动外围容器时,您明确指定主容器的主机和端口(与默认容器不同),您可以忘记此警告。
用于部署代理(假设已部署容器)
java jade.Boot -container -host localhost -agents buyer:com.app.jade.BookBuyerAgent