4

(I've copied this from Stack Overflow here, after someone suggested I post the question here)

I'm trying to setup Tomcat6 to work with JMX on Windows Vista 64.

To do that I need to pass the parameters below to Tomcat6.

What I do in command prompt. (that doesn't work)

set CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9898 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
tomcat6.exe

What I do that does work (but causes other problems)

java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9898 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar bootstrap.jar

It seems as if tomcat is just ignoring the environment variable CATALINA_OPTS. Am I doing something wrong?

I've also tried to edit catalina.bat and define the variable CATALINA_OPTS there. No success. (tried adding the parameters to JAVA_OPTS too, no success either)

Ben
  • 181
  • 1
  • 1
  • 8

4 Answers4

3

Silly me, I started tomcat with tomcat6.exe instead of startup.bat.

Now works. Thanks!

Ben
  • 181
  • 1
  • 1
  • 8
2

I had similar when a similar post pointed that I should not use quotes "" when settings CATALINA_OPTS

http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html

To quote

How to set java heap size in Tomcat? Stop Tomcat server, set environment variable CATALINA_OPTS, and then restart Tomcat. Look at the file tomcat-install/bin/catalina.sh or catalina.bat for how this variable is used. For example,

set CATALINA_OPTS=-Xms512m -Xmx512m  (Windows, no "" around the value)
export CATALINA_OPTS="-Xms512m -Xmx512m"  (ksh/bash, "" around the value)
setenv CATALINA_OPTS "-Xms512m -Xmx512m"  (tcsh/csh, "" around the value)

In catalina.bat or catallina.sh, you may have noticed CATALINA_OPTS, JAVA_OPTS, or both can be used to specify Tomcat JVM options. What is the difference between CATALINA_OPTS and JAVA_OPTS? The name CATALINA_OPTS is specific for Tomcat servlet container, whereas JAVA_OPTS may be used by other java applications (e.g., JBoss). Since environment variables are shared by all applications, we don't want Tomcat to inadvertently pick up the JVM options intended for other apps. I prefer to use CATALINA_OPTS.

cheers ET

1

If you are running Tomcat as a service, your options are more limited. You may have to open the Tomcat Properties dialog, flip to the Java tab, and add on to the end of the "Java Options" box.

EpicVoyage
  • 111
  • 3
0

Based on some of the previous answers, I was able to get over my problem with Tomcat installed as a Windows service.

I opened up Configure Tomcat (through All Programs menu in Windows, under Apache Tomcat), went to the Java tab and added my desired runtime startup properties.

Zorg
  • 1