---
title: "jade提示Can't get a proxy to the Platform Manager"
author: "turingfellow"
date: "2010-03-16T11:32:39Z"
tags: []
categories: ["编程语言"]
slug: "jade-can-t-get-a-proxy-to-the-platform-manager"
draft: false
lastmod: "2010-03-16T11:32:39Z"
id: 616855
url: "https://turingfellow.iteye.com/blog/616855"
---

操作情形：
在bookTrading例子中，开两个cmd，分别运行Seller和Buyer两个代理
>java jade.Boot -gui a1:examples.bookTrading.BookSellerAgent 
>java jade.Boot -gui a2:examples.bookTrading.BookBuyerAgent("book2")
具体出错：
 jade.core.ProfileException: Can't get a proxy to the Platform Manager ]
        at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:574)
        at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487)
        at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501)
        at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342)
        at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478
)
        at jade.core.Runtime.createMainContainer(Runtime.java:148)
        at jade.Boot.<init>(Boot.java:130)
        at jade.Boot.main(Boot.java:70)
Nested Exception:
jade.core.IMTPException: The Service Manager was already bound in the RMI Regist
ry 
        at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(RMIIMTPManager.jav
a:276)
        at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:563)
        at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487)
        at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501)
        at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342)
        at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478
)
        at jade.core.Runtime.createMainContainer(Runtime.java:148)
        at jade.Boot.<init>(Boot.java:130)
        at jade.Boot.main(Boot.java:70)
Nested Exception:
java.rmi.AlreadyBoundException: ServiceManager
        at sun.rmi.registry.RegistryImpl.bind(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
        at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
        at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
        at sun.rmi.transport.Transport$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Unknown Source)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Sou
rce)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
n Source)
        at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
        at sun.rmi.server.UnicastRef.invoke(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
        at java.rmi.Naming.bind(Unknown Source)
        at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(RMIIMTPManager.jav
a:224)
        at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:563)
        at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487)
        at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501)
        at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342)
        at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478
)
        at jade.core.Runtime.createMainContainer(Runtime.java:148)
        at jade.Boot.<init>(Boot.java:130)
        at jade.Boot.main(Boot.java:70)
2010-3-16 11:22:22 jade.core.Runtime$1 run
信息: JADE is closing down now.

出错原因：在同一台机子，同一个端口上启动两个Main Container ；或者同一个Container中有两个同名的Agent。
修正方法：一次同时运行两个agent
>java jade.Boot -gui a1:examples.bookTrading.BookSellerAgent a2:exam
ples.bookTrading.BookBuyerAgent("book2")
修正结果：成功