Reputation: 394
I'm running maven unit test from windows console:
mvn -Dcom.sun.management.jmxremote ^
-Dcom.sun.management.jmxremote.authenticate=false ^
-Dcom.sun.management.jmxremote.ssl=false ^
-Dcom.sun.management.jmxremote.port=1100 ^
-Dtest=TimetableEngineTest test
However no open port 1100 is shown in netstat -a
and VisualVM cannot connect to: 127.0.0.1:1100
when choosing "Add JMX Connection" (I have tried it even with my external ip).
Am i doing something wrong?
Upvotes: 3
Views: 4154
Reputation: 112
When you run mvn this way, these parameters are being passed into the mvn batch file. That batch file launches java, but when doing so it doesn't pass the same arguments that were received.
For the JVM to load the JMX stuff, these '-D' system properties parameters need to be passed into the java command-line, but in this case the JVM is being launched without these parameters, and then the maven java classes parse the '-D' parameters and add them as system properties. That is fine for (non-JVM-startup) system properties, but it happens too late to be effective for loading JMX.
Instead, you should try setting the MAVEN_OPTS environment variable to contain
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1100"
before running mvn
.
(Note - if running on linux/unix, remember to export MAVEN_OPTS too.)
Upvotes: 2
Reputation: 394
I have resolved the problem by installing "JVM monitor" plugin into Eclipse. However I don't consider this to be proper solution.
Upvotes: 0