Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was trying to configure JVM for remote monitoring but getting the below error on server

The configuration has not been set for this resource due to : Invalid configuration: Error contacting resource: Can't connect to MBeanServer [{jmx.username=system, jmx.url=service:jmx:rmi:///jndi/rmi://localhost:6969/jmxrmi}]: 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]

I want to monitor tomcat server, according to the doc I have add the remote monitoring Mbean Server connection string in /tomcat/bin/catalina.sh file

[ $1 != "stop" ] && JAVA_OPTS="-Dcom.sun.management.jmxremote \ 
-Dcom.sun.management.jmxremote.port=6969 \ 
-Dcom.sun.management.jmxremote.ssl=false \ 
-Dcom.sun.management.jmxremote.authenticate=false $JAVA_OPTS" 
export JAVA_OPTS

I have restarted the tomcat service after that. But not able to see port 6969 listening on the server. After restarting the tomcat i have checked it via "netstat -an | grep 696" I think this is the problem. Port 6969 is not used on this machine.

share|improve this question

4 Answers 4

You are saying you are trying to connect to remote jmx. Then how come

mx.url=service:jmx:rmi:///jndi/rmi://localhost:6969/jmxrmi

localhost on the machine will work ??. I think you should use the IP of the remote machine instead of localhost.

share|improve this answer
    
I am trying on the same machine –  Ramesh Kumar Nov 23 '10 at 7:11

Well, It seems correct at 100%. Here's what i use in my Windows enviroment:

set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=9988
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false

I think in 2 elements that can be the problem: The format. I see u put:

JAVA_OPTS="-Dcom.sun.ma...

Try giving a "space" to that first element, like i do in my configuration. U can also use a echo after generating the $JAVA_OPST variable, and check that the syntax is correct.

The other is the JVM Version. ¿1.5?¿1.6?¿JRE?¿JDK? Try using the most upgraded (or at least the 1.6) if ur installation is giving u problems.

share|improve this answer
up vote 0 down vote accepted

Finally I make it work. I added the setting in JAVA_OPTS variable in tomcat startup script as below:

JAVA_OPTS="-Djava.awt.headless=true -Xms256m -Xmx1024m -XX:PermSize=512m -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
share|improve this answer
    
Dont see the difference between this and the original, all are in catalina.sh how starts the server. ¿right? the only diff is that java.awt.headless... is that was prevented JMX to run? I dont use it and it works for me... ¿Maybe that $1 = Stop was the problem? –  Carlos Nov 30 '10 at 12:35

1) download jmxterm from: http://wiki.cyclopsgroup.org/jmxterm:download 2) copy the downloaded jar file to a test server

3) ssh to the test server

4) on the test server start the JMX shell:

$ java -jar jmxterm-1.0-alpha-4-uber.jar -l localhost:20051

(Note: port 20051 is the port your servers use for JMX. I looked at the data from one of your servers and saw the following on the javacommand line: -Dcom.sun.management.jmxremote.port=20051. If the test server is using a different java command line, you need to locate the same option and the port number if it's different)

5) Test that the shell connected correctly:

$>open

You will something like:

rmi://127.0.1.1 4,service:jmx:rmi:///jndi/rmi://localhost:3333/jmxrmi

6) List the available Mbeans, copy paste the output and send to me. We will review what is available and what is needed.

$>beans

7) Check the attributes available from a given bean:

$>bean name_of_object from_output_above (ex.net.lag.kestrel:name=queues.weather_updates,type=Config)

bean is set to net.lag.kestrel:name=queues.weather_updates,type=Config

$>info

mbean = net.lag.kestrel:name=queues.weather_updates,type=Config

class name = net.lag.configgy.ConfigMap

attributes

%0 - max_age (java.lang.String, rw)

%1 - max_items (java.lang.String, rw)

operations

%0 - void add_list(java.lang.String key,java.lang.String value)

%1 - void remove(java.lang.String key)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.