java.rmi.server.hostname may be the missing piece On 10 Mar 2014 02:35, "Li Li" <[email protected]> wrote:
> I have successfully configure activemq to support jmx before. But in > the new server machine, I can't get jmx working now. > I follow all the instructions of http://activemq.apache.org/jmx.html > 1. <broker xmlns="http://activemq.apache.org/schema/core" > useJmx="true" brokerName="localhost" > dataDirectory="${activemq.data}"> > > 2. <managementContext> > <managementContext createConnector="false"/> > </managementContext> > > 3. modify conf/jmx.password and conf/jmx.access > chmod 400 jmx.* > 4. modify bin/activemq > ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=11099" > ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password" > ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access" > ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote.ssl=false" > ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START > -Dcom.sun.management.jmxremote" > > 5. after start activemq, I can see 11099 is listening. > > 6. I run jconsole in another client but failed. > > 7. using tcpdump, I can see client do connect to it. > > 8. using java jmx client, it throws exception: > ERROR main com.founder.taskscheduler.TaskScheduler Failed to retrieve > RMIServer stub: javax.naming.ServiceUnavailableException [Root > exception is java.rmi.ConnectException: Connection refused to host: > 192.168.11.169; nested exception is: > java.net.ConnectException: Connection refused] > java.io.IOException: Failed to retrieve RMIServer stub: > javax.naming.ServiceUnavailableException [Root exception is > java.rmi.ConnectException: Connection refused to host: 192.168.11.169; > nested exception is: > java.net.ConnectException: Connection refused] > at > javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369) > at > javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:268) > at > com.founder.taskscheduler.TaskScheduler.getQueueSize(TaskScheduler.java:160) > at > com.founder.taskscheduler.TaskScheduler.schedule(TaskScheduler.java:105) > at > com.founder.taskscheduler.TaskScheduler.main(TaskScheduler.java:559) > Caused by: javax.naming.ServiceUnavailableException [Root exception is > java.rmi.ConnectException: Connection refused to host: 192.168.11.169; > nested exception is: > java.net.ConnectException: Connection refused] > at > com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:118) > at > com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:203) > at javax.naming.InitialContext.lookup(InitialContext.java:411) > at > javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1936) > at > javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1903) > at > javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:286) > ... 4 more > Caused by: java.rmi.ConnectException: Connection refused to host: > 192.168.11.169; nested exception is: > java.net.ConnectException: Connection refused > at > sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) > at > sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) > at > sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) > at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:341) > at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) > at > com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:114) > ... 9 more > Caused by: java.net.ConnectException: Connection refused > at java.net.PlainSocketImpl.socketConnect(Native Method) > at > java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) > at > java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) > at > java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) > at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) > at java.net.Socket.connect(Socket.java:579) > at java.net.Socket.connect(Socket.java:528) > at java.net.Socket.<init>(Socket.java:425) > at java.net.Socket.<init>(Socket.java:208) > at > sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40) > at > sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:147) > at > sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613) > ... 14 more >
