Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}]: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 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/ file

[ $1 != "stop" ] && JAVA_OPTS=" \ \ \ $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

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


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:


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


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"
share|improve this answer
Dont see the difference between this and the original, all are in 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 Garcia Nov 30 '10 at 12:35

1) download jmxterm from: 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: 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:


You will something like:

rmi:// 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.


7) Check the attributes available from a given bean:

$>bean name_of_object from_output_above (,type=Config)

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


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

class name = net.lag.configgy.ConfigMap


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

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


%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


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.