views:

368

answers:

2

I am trying to run a java process and enable remote connections using jconsole. I add the following parameters to the command line (before the main class):

-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote. authenticate=false

using netstat, I see that the jvm is listening on port 9999:

tcp6       0      0 :::9999                 :::*                    LISTEN      16971/java

however, when I try to connect with jconsole localhost:9999 I get an error message saying that the connection has failed.

any idea?

+1  A: 

Are you sure, that you're using IPv6? Otherwise, you should prefer IPv4 for your service.

-Djava.net.preferIPv4Stack=true

oeogijjowefi
well, that's odd.now I get a new error (with and without the ipv4 parameter) :Error: Password file read access must be restricted: /usr/lib/jvm/java-6-sun-1.6.0.12/jre/lib/management/jmxremote.password
Omry
The user running the java process must have read access to the JMX password file. chmod 0600 /usr/lib/jvm/java-6-sun-1.6.0.12/jre/lib/management/jmxremote.password
oeogijjowefi
ipv4 was not the problem, see answer below.
Omry
Haha, a typo ... could have used my time for something else Grrrr ;)
oeogijjowefi
actually the typo was not the only problem, so you may have learned something too :)
Omry
+3  A: 

There's a space between "...jmxremote." and "authenticate" in what you entered above. If that's a copy/paste, maybe make sure it's not there on your command line.

Also, you could simplify by disabling SSL: -Dcom.sun.management.jmxremote.ssl=false

right on, on both things. the space messed up things, and I needed to disable ssl to get it to work. thanks.
Omry