2 Replies Latest reply: Jul 17, 2010 6:09 PM by 843798 RSS

    Can't connect to remote rmiregistry

    843798
      When I am trying to connect to the JMX via rmi registry -"service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi", I am getting an error:
      I have included the stack trace below:



      Caused by: java.io.IOException: Cannot bind to URL [rmi://localhost:3000/jmxrmi]: javax.naming.NoPermissionException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
           java.rmi.AccessException: Cannot modify this registry]
           at javax.management.remote.rmi.RMIConnectorServer.newIOException(Unknown Source)
           at javax.management.remote.rmi.RMIConnectorServer.start(Unknown Source)
           at org.apache.solr.core.JmxMonitoredMap.<init>(JmxMonitoredMap.java:95)
           ... 20 more
      Caused by: javax.naming.NoPermissionException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
           java.rmi.AccessException: Cannot modify this registry]
           at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
           at com.sun.jndi.toolkit.url.GenericURLContext.bind(Unknown Source)
           at javax.naming.InitialContext.bind(Unknown Source)
           at javax.management.remote.rmi.RMIConnectorServer.bind(Unknown Source)
           ... 22 more
      Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
           java.rmi.AccessException: Cannot modify this registry
           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 Source)
           at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
           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(Unknown 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)
           ... 26 more
      Caused by: java.rmi.AccessException: Cannot modify this registry
           at sun.management.jmxremote.SingleEntryRegistry.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 Source)
           at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        • 1. Re: Can't connect to remote rmiregistry
          791266
          I would google on javax.naming.NoPermissionException
          • 2. Re: Can't connect to remote rmiregistry
            843798
            If you are trying to connect to the local MBeanserver (i am assuming this as you have mentioned localhost in the JMXService URL of your code snippet) you can use the ManagementFactory.getPlatformMBeanServer() method to get the local MBeanserver and you can iterate through the MBean hierarchy.

            If you want to want to access JMX remote port, your need to set the jmx port and authentication as false on the remote machine thorugh JVM startup options. Also you need to take care of firewall settings.