简体   繁体   English

Jade 框架(两个容器)

[英]Jade Framework (two containers)

I have expertise in using Jade in the same host (my laptop) as I can handle all interactions between agents;我有在同一台主机(我的笔记本电脑)上使用 Jade 的专业知识,因为我可以处理代理之间的所有交互; But I have to run the MainContainer in my laptop and the second container in a Raspberry Pi.但是我必须在笔记本电脑中运行MainContainer ,在 Raspberry Pi 中运行第二个容器。 I started to try a simple example by creating 2 agents, the first on the main container and the second on the container that will run on Raspberry Pi.我开始尝试一个简单的例子,创建 2 个代理,第一个在主容器上,第二个在将在 Raspberry Pi 上运行的容器上。 But it doesn't work.但它不起作用。

the following code is for the main container including agent1 which will send message to agent2以下代码用于包含 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();

Code of the second container:第二个容器的代码:

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 send message to agent2 every 15seconds. agent1 每 15 秒向 agent2 发送一次消息。

There isn't any problem with the main container code but when I run the raspberry container using deployAndBrickPun ( ev3dev-lang-java ), it show me the following error:主容器代码没有任何问题,但是当我使用deployAndBrickPun ( ev3dev-lang-java ) 运行deployAndBrickPun容器时,它显示以下错误:

> 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)

I need to solve this errors, so I asking for your help please;我需要解决这个错误,所以我请求你的帮助;

Thank you in advance.先感谢您。

you lack information within your profiles.您的个人资料中缺少信息。

  1. You need to defined IP,port, hostname on both (main-container and distant-containers).您需要在两者(主容器和远程容器)上定义 IP、端口、主机名。 Not doing it on the main-c will create pb for it to run, but you will not be able to join it from the pi.不在 main-c 上执行此操作将创建 pb 以供其运行,但您将无法从 pi 加入它。

  2. The IP given on the pi-container should be the one of the main-container. pi 容器上给出的 IP 应该是主容器之一。 Not sure if its the case in your example.不确定在您的示例中是否是这种情况。

You can give a look at the open-source project startJade that intends to offer several running examples.您可以查看打算提供几个运行示例的开源项目startJade The "Platform creation" example covers this case. “平台创建”示例涵盖了这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM