java.rmi.NoSuchObjectException: no such object in table

时间:2021-10-14 02:17:42

jmx链接的时候,最简单的例子都行不通,郁闷,出现了:

参考:http://reiz6153.blog.163.com/blog/static/401089152009442723208/

代码:

MBeanServer mbs = MBeanServerFactory.createMBeanServer("HelloAgent");

JMXServiceURL url = new JMXServiceURL( "service:jmx:rmi://localhost:9092/jndi/rmi://localhost:9092/jmxrmi");
         Map<String, ?> map = new HashMap<String, String>();
   JMXConnectorServer connector = JMXConnectorServerFactory.newJMXConnectorServer(url, map , mbs);
         ObjectName connectorName = new ObjectName("JMXBookAgent:name=RMIConnector");
         mbs.registerMBean(connector, connectorName);
         connector.start();

异常:

二月 12, 2014 1:34:33 上午 sun.rmi.transport.Transport serviceCall
FINE: RMI TCP Connection(1)-127.0.0.1: [127.0.0.1] exception:

java.rmi.NoSuchObjectException: no such object in table  at sun.rmi.transport.Transport.serviceCall(Transport.java:153)  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  at java.lang.Thread.run(Thread.java:722)

java.io.IOException: Cannot bind to URL [rmi://localhost:9092/jmxrmi]: javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]  at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:827)  at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:432)  at jmx.HelloAgent.<init>(HelloAgent.java:51)  at jmx.HelloAgent.main(HelloAgent.java:65) Caused by: javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]  at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:143)  at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:226)  at javax.naming.InitialContext.bind(InitialContext.java:419)  at javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:644)  at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:427)  ... 2 more Caused by: java.rmi.NoSuchObjectException: no such object in table  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)  at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)  at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:137)  ... 6 more

网上搜索许久还是不行。。。

http://www.myexception.cn/j2se/java.rmi.NoSuchObjectException.html

http://blog.csdn.net/pengchang_1981/article/details/8069124 弱想关

http://*.com/questions/645208/java-rmi-nosuchobjectexception-no-such-object-in-table 看得晕。。。

待续。。。