We have tomcat6 running in two different environments, both running CentOS 6.6 and OpenJDK 1.7. In one environment, I'm not able to stop tomcat6 when issuing
service tomcat6 stop
In the environment that this is failing, the only difference is that there are some additional options:
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=**8081**
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote=true
-Djava.rmi.server.hostname=172.19.13.211
When stopping, the following errors are recorded in catalina.out:
OpenJDK 64-Bit Server VM warning: Failed to reserve shared memory (errno = 1).
OpenJDK 64-Bit Server VM warning: Failed to reserve shared memory (errno = 1).
OpenJDK 64-Bit Server VM warning: Failed to reserve shared memory (errno = 1).
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: **8081**; nested exception is:
java.net.BindException: Address already in use
It looks like the jmx port is what is causing this issue, but without removing it altogether, is there a way to get tomcat6 to stop gracefully?
UPDATE 1
The link mentioned in my comment led me to a blog post that I followed. I created the /usr/share/tomcat6/bin/setenv.sh file, and made it readable with the following contents:
export CATALINA_OPTS="-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8081 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote=true -Djava.rmi.server.hostname=172.19.13.211"
However, when starting tomcat6 up, the jmx options are not being included. Any suggestions?