作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想注册几个代理。
为此,我使用以下代码
类(class)
public class Main {
public static void main(String[] args) {
String[] services = {"-gui"};
Boot.main(services);
Agent1 = new Agent1(0,0,"a");
}
}
public class Agent1 extends Agent{
public Agent1(int x, int y, String name) {
super(x, y, name);
setup();
}
protected void setup(){
System.out.println("hi");
ServiceDescription sd = new ServiceDescription();
sd.setType( "buyer" );
sd.setName( "asa" );
register( sd );
}
void register( ServiceDescription sd){
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
dfd.addServices(sd);
try {
DFService.register(this, dfd );
}
catch (FIPAException fe) { fe.printStackTrace(); }
}
protected void takeDown(){
System.out.println("bye");
}
}
但我收到以下错误:
jade.domain.FIPAAgentManagement.MissingParameter: (missing-parameter df-agent-description name)
如何修复该错误?
谢谢
最佳答案
您没有正确创建代理。 getAID()
将返回 null,并且 DFAgentDescription
变得无效。
您应该将 -agents
传递给 jade.Boot
,它将为您创建代理。
public static void main(String[] args) {
// the agent's name is agent1, change xy.zy to your package
String[] services = {"-gui", "-agents", "agent1:xy.zy.Agent1"};
Boot.main(services);
}
您不需要 Agent1 = new Agent1(0,0,"a");
并且您不需要 Agent1
中的构造函数。 setup()
方法会自动调用。
关于java - 为什么注册代理会返回此错误 : FIPAAgentManagement. MissingParameter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26695358/
我想注册几个代理。 为此,我使用以下代码 类(class) public class Main { public static void main(String[] args) { Strin
我是一名优秀的程序员,十分优秀!