Jade 框架(两个容器)

问题描述 投票:0回答:1

我拥有在同一主机(我的笔记本电脑)中使用 Jade 的专业知识,因为我可以处理代理之间的所有交互; 但我必须在笔记本电脑中运行

MainContainer
并在 Raspberry Pi 中运行第二个容器。 我开始尝试一个简单的示例,创建 2 个代理,第一个在主容器上,第二个在将在 Raspberry Pi 上运行的容器上。但这不起作用。

以下代码适用于包括agent1的主容器,它将向agent2发送消息

Runtime runtime = Runtime.instance();

Properties properties = new ExtendedProperties();
properties.setProperty(Profile.GUI, "true");
Profile profile = new ProfileImpl(properties);
AgentContainer agentContainer1=runtime.createMainContainer(profile);
Container.start();
AgentController agent1=agentContainer1.createNewAgent("Agent1","Connexion.Agent1",new Object[]{});    
agent1.start();

第二个容器的代码:

Runtime runtime=Runtime.instance();
Profile profile=new ProfileImpl();
profile.setParameter(profile.MAIN_HOST, "192.168.0.164"); //Raspberry Pi host
AgentContainer agentContainer1=runtime.createAgentContainer(profile);
AgentController agent2=agentContainer1.createNewAgent("Agent2","Connexion.Agent2",new Object[]{});
agent2.start();
agentContainer1.start();
  • agent1 每 15 秒向 agent2 发送一次消息。

主容器代码没有任何问题,但是当我使用

deployAndBrickPun
(
ev3dev-lang-java
) 运行树莓容器时,它显示以下错误:

> Task :deploy 
Host key checking is off. It may be vulnerable to man-in-the-middle attacks. 
ev3dev#1|Sep 20, 2021 1:27:00 PM jade.core.AgentContainerImpl joinPlatform 
ev3dev#1|SEVERE: Some problem occurred while joining agent platform.
ev3dev#1|jade.core.ProfileException: Can't get a proxy to the Platform Manager - Caused by: Dispatcher error - Caused by:  DispatcherException in remote site. No skeleton for object-id0
ev3dev#1|   at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:529)          
ev3dev#1|   at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:442)
ev3dev#1|   at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:456)          
ev3dev#1|   at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:347)              
ev3dev#1|   at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:495) 
ev3dev#1|   at jade.core.Runtime.createAgentContainer(Runtime.java:127) 
ev3dev#1|   at Connexion.Container1.main(Container1.java:17)

我需要解决这个错误,所以我请求你的帮助;

提前谢谢您。

java containers hosts agents-jade multi-agent
1个回答
1
投票

您的个人资料中缺少信息。

  1. 您需要在两者(主容器和远程容器)上定义IP、端口、主机名。不在 main-c 上执行此操作不会创建 pb 来运行,但您将无法从 pi 加入它。

  2. pi 容器上给出的 IP 应该是主容器的 IP。不确定您的示例是否属于这种情况。

您可以查看开源项目startJade,该项目旨在提供几个运行示例。 “平台创建”示例涵盖了这种情况。

© www.soinside.com 2019 - 2024. All rights reserved.