Repository: eclipse-openj9/openj9

Issue #301: Failed to connect to a java application on remote server using jconsole
Created: 2017-10-12T07:41:22Z
Failed to connect to a java application running on a remote server using jconsole with openjdk9-openj9 build, it works fine with openjdk9-hotspot build
$ ./openjdk9-openj9/jdk-9+181/bin/java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-adhoc.jenkins.openjdk)
Eclipse OpenJ9 VM (build 2.9, JRE 9 Linux amd64-64 Compressed References 20171011_24 (JIT enabled, AOT enabled)
OpenJ9   - 3913752
OMR      - 5d625a3
OpenJDK  - a4765a5 based on )

$ ./openjdk9-openj9/jdk-9+181/bin/java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9000  -Dcom.sun.management.jmxremote.rmi.port=9000 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=9.109.121.179 -Dcom.sun.management.jmxremote.local.only=false InfiniteLoop

Failed with the below exception when connected from a Windows machine using jconsole with *"service:jmx:rmi:///jndi/rmi://9.109.121.179:9000/jmxrmi"*

FINER: [javax.management.remote.rmi.RMIConnector: jmxServiceURL=service:jmx:rmi:///jndi/rmi://9.109.121.179:9000/jmxrmi] finding stub...
Oct 12, 2017 12:30:22 PM javax.management.remote.rmi.RMIConnector connect
FINER: [javax.management.remote.rmi.RMIConnector: jmxServiceURL=service:jmx:rmi:///jndi/rmi://9.109.121.179:9000/jmxrmi] Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 9.109.121.179; nested exception is: 
	java.net.ConnectException: Connection refused: connect]


Worked fine with openjdk9-hotspot build
$ ./openjdk9-hotspot/jdk-9+181/bin/java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-adhoc.jenkins.openjdk)
OpenJDK 64-Bit Server VM (build 9-internal+0-adhoc.jenkins.openjdk, mixed mode)

Duplicate issue #480: j9vm.test.softmx.SoftmxRemoteTest.setUp server is not ready after 120 seconds
Created: 2017-10-30T12:07:05Z
New test, never passed.
https://ci.eclipse.org/openj9/view/Test/job/Test-Extended-linux_390-64_cmprssptrs/lastBuild/testReport/junit/j9vm.test.softmx/SoftmxRemoteTest/setUp/
Failed
j9vm.test.softmx.SoftmxRemoteTest.setUp
Failing for the past 38 builds (Since Unstable#2 )
Took 0 ms.
Error Message
The server is not ready after 120 seconds!!!
Stacktrace
  java.lang.AssertionError: The server is not ready after 120 seconds!!!
at org.testng.Assert.fail(Assert.java:94)
at j9vm.test.softmx.SoftmxRemoteTest.waitRemoteServer(SoftmxRemoteTest.java:344)
at j9vm.test.softmx.SoftmxRemoteTest.setUp(SoftmxRemoteTest.java:71)

Closing comment (2017-10-31T21:39:20Z): This test failed with different issue on java8-openj9 and java9-openj9
On java9-openj9
The test was failed due to the failure of creating remote server.
This cmd
/java9-openj9/bin/java -classpath /test/TestConfig/../../jvmtest/TestConfig/resources:/test/TestConfig/../../jvmtest/TestConfig/lib/testng.jar:/test/TestConfig/../../jvmtest/TestConfig/lib/jcommander.jar:/test/TestConfig/../../jvmtest/JLM_Tests/jlm_tests.jar  -Xcompressedrefs -Xcompressedrefs -Xjit -Xgcpolicy:optthruput  -Xmx1024m -Xsoftmx512m -Xmn1m -Xdump:none -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.rmi.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost j9vm.test.softmx.RemoteTestServer
can run the java program but the remote server were not initialized (checked with netstat -l). In comparison, the same cmd can run the program successfully and initialize a remote server with port 9999 on java8-openj9, openjdk8 and openjdk9.
On java8-openj9
This test is failure due to an unexpected exception thrown.
full stacktrace:
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
	java.net.ConnectException: Connection refused (Connection refused)]
	at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:380)
	at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:281)
	at j9vm.test.softmx.SoftmxRemoteTest.setUp(SoftmxRemoteTest.java:88)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:508)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:590)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:756)
	at org.testng.TestRunner.run(TestRunner.java:610)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
	at org.testng.TestNG.runSuites(TestNG.java:1133)
	at org.testng.TestNG.run(TestNG.java:1104)
	at org.testng.TestNG.privateMain(TestNG.java:1434)
	at org.testng.TestNG.main(TestNG.java:1403)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
	java.net.ConnectException: Connection refused (Connection refused)]
	at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:148)
	at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:217)
	at javax.naming.InitialContext.lookup(InitialContext.java:428)
	at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1966)
	at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1933)
	at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:298)
	... 28 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
	java.net.ConnectException: Connection refused (Connection refused)
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:631)
	at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:228)
	at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:214)
	at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:351)
	at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:112)
	at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:144)
	... 33 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:380)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:236)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:218)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.net.Socket.connect(Socket.java:666)
	at java.net.Socket.connect(Socket.java:606)
	at java.net.Socket.<init>(Socket.java:469)
	at java.net.Socket.<init>(Socket.java:239)
	at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:52)
	at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:160)
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:625)
	... 38 more

I think this exception may be related to #301