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.

We have an monitoring application using SNMP, I have enable SNMP in my tomcat server with following option in bin/setenv.sh file.

#
# SNMP for Tomcat
#
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.interface=10.101.21.31"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.port=1651"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.acl=false"

At tomcat startup no issue at all everything is clean. but when i am stopping tomcat i am getting this error.

[tomcat@webserver1 bin]$ ./catalina.sh stop
JAVA_OPTS: %JAVA_OPTS%
Using CATALINA_BASE:   /opt/tomcat7.1
Using CATALINA_HOME:   /opt/tomcat7.1
Using CATALINA_TMPDIR: /opt/tomcat7.1/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat7.1/bin/bootstrap.jar:/opt/tomcat7.1/bin/tomcat-juli.jar
Error: Failed to start SNMP adaptor with address: /10.101.21.31:1651 (Address already in use)

Anyway i can cleanly stop tomcat rather than kill it?

share|improve this question

migrated from stackoverflow.com Oct 16 '12 at 0:27

This question came from our site for professional and enthusiast programmers.

3  
You need to avoid setting the SNMP options on the JVM for the shutdown process. –  bmargulies Oct 15 '12 at 20:53

1 Answer 1

up vote 4 down vote accepted

You should be using CATALINA_OPTS instead of JAVA_OPTS. The catalina.sh script documents the difference quite well:

#   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
#                   "run" or "debug" command is executed.
#                   Include here and not in JAVA_OPTS all options, that should
#                   only be used by Tomcat itself, not by the stop process,
#                   the version command etc.
#                   Examples are heap size, GC logging, JMX ports etc.

The fact that JAVA_OPTS is set to %JAVA_OPTS% also indicates that you have something wrong (probably a script that's been written by a win32 admin).

share|improve this answer
    
Epic!!! Win, Thanks! –  Satish Oct 16 '12 at 14:07
    
This does not work on SLES 11 SP3 where the tomcat init script uses both CATALINA_OPTS and JAVA_OPTS for stop and start. –  L.R. Jul 11 at 9:43
    
If SLES uses CATALINA_OPTS for Tomcat start then they have made a mistake: you should file a bug report. –  Christopher Schultz Jul 11 at 15:27

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.