<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: Remote JMX connector for AS7
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/bosschaert">David Bosschaert</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/568949#568949">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>In a similar context, I need to make a back connection from within AS to a VM that runs our test system. This VM exposes the following JMX url: service:jmx:rmi://192.168.153.133:1191/jndi/rmi://192.168.153.133:1190/arquillian-osgi-callback</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I can connect to that URLwithout problem from JConsole and from a standalone application that I wrote as an experiment, but when I run the following code inside AS7 it gives me the exception below.</p><p>Map&lt;String, Object&gt; env = new HashMap&lt;String, Object&gt;();env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");JMXServiceURL serviceURL = new JMXServiceURL("service:jmx:rmi://192.168.153.133:1191/jndi/rmi://192.168.153.133:1190/arquillian-osgi-callback");JMXConnector connector = JMXConnectorFactory.connect(serviceURL, env);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Anyone an idea why the above code doesn't work in AS7 (its the exact code that does work in my standalone app)? Why can't I connect to 192.168.153.133 from inside AS while it's no problem from a standalone application?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.153.133; nested exception is: </p><p>    java.net.ConnectException: Connection refused]</p><p>    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)</p><p>    at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)</p><p>    at org.jboss.arquillian.osgi.internal.RemoteOSGiContainer.getMBeanServerConnection(RemoteOSGiContainer.java:73)</p><p>    at org.jboss.arquillian.osgi.internal.AbstractOSGiContainer.getTestArchiveStream(AbstractOSGiContainer.java:165)</p><p>    at org.jboss.arquillian.osgi.internal.AbstractOSGiContainer.getTestArchive(AbstractOSGiContainer.java:143)</p><p>    at org.jboss.test.osgi.example.simple.SimpleArchiveProviderTestCase.testBundleInjection(SimpleArchiveProviderTestCase.java:54)</p><p>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p>    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>    at java.lang.reflect.Method.invoke(Method.java:597)</p><p>    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)</p><p>    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)</p><p>    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)</p><p>    at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:251)</p><p>    at org.jboss.arquillian.impl.handler.TestEventExecuter.callback(TestEventExecuter.java:44)</p><p>    at org.jboss.arquillian.impl.handler.TestEventExecuter.callback(TestEventExecuter.java:34)</p><p>    at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)</p><p>    at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)</p><p>    at org.jboss.arquillian.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:160)</p><p>    at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:244)</p><p>    at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:207)</p><p>    at org.jboss.arquillian.junit.Arquillian$5$1.evaluate(Arquillian.java:225)</p><p>    at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)</p><p>    at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:221)</p><p>    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)</p><p>    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)</p><p>    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)</p><p>    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)</p><p>    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)</p><p>    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)</p><p>    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)</p><p>    at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:163)</p><p>    at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)</p><p>    at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)</p><p>    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)</p><p>    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)</p><p>    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)</p><p>    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)</p><p>    at org.junit.runner.JUnitCore.run(JUnitCore.java:136)</p><p>    at org.jboss.arquillian.junit.JUnitTestRunner.execute(JUnitTestRunner.java:69)</p><p>    at org.jboss.arquillian.osgi.internal.JUnitBundleTestRunner.execute(JUnitBundleTestRunner.java:35)</p><p>    at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:135)</p><p>    at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:97)</p><p>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p>    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>    at java.lang.reflect.Method.invoke(Method.java:597)</p><p>    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)</p><p>    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)</p><p>    at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)</p><p>    at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)</p><p>    at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)</p><p>    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)</p><p>    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)</p><p>    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427)</p><p>    at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)</p><p>    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265)</p><p>    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360)</p><p>    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)</p><p>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p>    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>    at java.lang.reflect.Method.invoke(Method.java:597)</p><p>    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)</p><p>    at sun.rmi.transport.Transport$1.run(Transport.java:159)</p><p>    at java.security.AccessController.doPrivileged(Native Method)</p><p>    at sun.rmi.transport.Transport.serviceCall(Transport.java:155)</p><p>    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)</p><p>    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)</p><p>    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)</p><p>    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)</p><p>    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)</p><p>    at java.lang.Thread.run(Thread.java:619)</p><p>Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.153.133; nested exception is: </p><p>    java.net.ConnectException: Connection refused]</p><p>    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)</p><p>    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:107)</p><p>    at javax.naming.InitialContext.lookup(InitialContext.java:392)</p><p>    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)</p><p>    at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)</p><p>    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)</p><p>    ... 72 more</p><p>Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.153.133; nested exception is: </p><p>    java.net.ConnectException: Connection refused</p><p>    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)</p><p>    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)</p><p>    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)</p><p>    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)</p><p>    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)</p><p>    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)</p><p>    ... 77 more</p><p>Caused by: java.net.ConnectException: Connection refused</p><p>    at java.net.PlainSocketImpl.socketConnect(Native Method)</p><p>    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)</p><p>    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)</p><p>    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)</p><p>    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)</p><p>    at java.net.Socket.connect(Socket.java:529)</p><p>    at java.net.Socket.connect(Socket.java:478)</p><p>    at java.net.Socket.(Socket.java:189)</p><p>    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)</p><p>    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)</p><p>    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)</p><p>    ... 82 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/568949#568949">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>