0

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?

1
  • 3
    You need to avoid setting the SNMP options on the JVM for the shutdown process.
    – bmargulies
    Oct 15, 2012 at 20:53

1 Answer 1

4

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).

2
  • 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, 2014 at 9:43
  • If SLES uses CATALINA_OPTS for Tomcat start then they have made a mistake: you should file a bug report. Jul 11, 2014 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .