簡體   English   中英

Jade 框架(兩個容器)

[英]Jade Framework (two containers)

我有在同一台主機(我的筆記本電腦)上使用 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 ) 運行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)

我需要解決這個錯誤,所以我請求你的幫助;

先感謝您。

您的個人資料中缺少信息。

  1. 您需要在兩者(主容器和遠程容器)上定義 IP、端口、主機名。 不在 main-c 上執行此操作將創建 pb 以供其運行,但您將無法從 pi 加入它。

  2. pi 容器上給出的 IP 應該是主容器之一。 不確定在您的示例中是否是這種情況。

您可以查看打算提供幾個運行示例的開源項目startJade “平台創建”示例涵蓋了這種情況。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM