Jade框架跨笔记本与树莓派部署双容器连接报错求助
问题原因与解决方案
核心报错原因
你遇到的No skeleton for object-id0报错本质是树莓派上的子容器无法与笔记本上的主容器建立RMI通信,由以下几个配置错误导致:
- 子容器的
MAIN_HOST配置错误,误填了树莓派自身IP,应该填写主容器所在的笔记本的局域网IP - 主容器默认仅绑定本地回环地址127.0.0.1,未开放局域网访问权限
- 容器与Agent的启动顺序错误,未先启动容器就启动Agent
- 可能存在端口拦截、Jade版本不一致的问题
修正后的代码
主容器(笔记本端)代码
// 替换为你笔记本实际的局域网IP,可通过ipconfig/ifconfig查看 private static final String MAIN_HOST_IP = "192.168.0.xxx"; private static final String MAIN_PORT = "1099"; Runtime runtime = Runtime.instance(); Properties properties = new ExtendedProperties(); properties.setProperty(Profile.GUI, "true"); // 绑定主容器到局域网IP,允许外部设备访问 properties.setProperty(Profile.HOST, MAIN_HOST_IP); properties.setProperty(Profile.PORT, MAIN_PORT); Profile profile = new ProfileImpl(properties); AgentContainer mainContainer = runtime.createMainContainer(profile); // 先启动主容器 mainContainer.start(); // 再创建启动Agent AgentController agent1 = mainContainer.createNewAgent("Agent1","Connexion.Agent1",new Object[]{}); agent1.start();
子容器(树莓派端)代码
// 填写笔记本的局域网IP,和主容器配置的IP一致 private static final String MAIN_HOST_IP = "192.168.0.xxx"; private static final String MAIN_PORT = "1099"; Runtime runtime = Runtime.instance(); Profile profile = new ProfileImpl(); // 指定要连接的主容器地址 profile.setParameter(Profile.MAIN_HOST, MAIN_HOST_IP); profile.setParameter(Profile.MAIN_PORT, MAIN_PORT); AgentContainer subContainer = runtime.createAgentContainer(profile); // 先启动子容器,完成和主容器的注册 subContainer.start(); // 再创建启动Agent AgentController agent2 = subContainer.createNewAgent("Agent2","Connexion.Agent2",new Object[]{}); agent2.start();
验证检查项
- 先启动主容器,再启动子容器,启动顺序不能颠倒
- 确认两台设备在同一局域网,树莓派可ping通笔记本的IP
- 关闭笔记本的防火墙,或放开1099端口的入站规则
- 确认笔记本和树莓派上使用的Jade依赖版本完全一致
- 确认两端的Agent类包名、类名完全匹配,代码同步更新
内容的提问来源于stack exchange,提问作者Hichem
相关产品推荐
相关产品推荐

