views:

686

answers:

4

Hi,

What i'm trying to do, eventually, is to start TOMCAT with certain java system properties set (in this case jmx setup):

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9898 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false`

)

Problem is I don't think i'm doing it right. What I'm doing is, in the command prompt window (Working in Vista 64, BTW) I use:

set CATALINA_OPTS=-Dcom.sun.management.jmxremote...
set JAVA_OPTS=-Dcom.sun.management.jmxremote...
tomcat6.exe

This doesn't seem to work since tomcat6 is not behaving as if the properties were set. To test this I used the example Notepad.Jar that comes with the java jdk. Tried to run it the same way:

set JAVA_OPTS=-Dcom.sun.management.jmxremote...
java -jar Notepad.jar

which didn't work, but this did work:

java -Dcom.sun.management.jmxremote .... -jar Notepad.jar

Since the last attempt did work I concluded that the JAVA/CATALINA_OPTS setup is incorrect.

Could someone point out what i'm doing wrong? I hope I was clear enough.

Thanks!

A: 

Use the supplied startup.bat and catalina.bat files instead of calling tonmcat.exe directly. This has always worked for me...

Pablojim
Tnx. I don't have these batch files, are they installed separately?I'm using Tomcat 6.0, perhaps it's different here?
Ben
I downloaded tomcat in a different package and got those batch files. Thanks!
Ben
A: 

AFAIK, these variables are used by the tomcat startup script and not by Java directly. Here's a link that might help you:

CATALINA_OPTS v JAVA_OPTS - What is the difference?

Andreas_D
A: 

I managed to do this by running the server from bootstrap.jar in a similiar manner to the way I started notepad.jar.

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

Apparently catalina.bat and startup.bat do no exists in tomcat6.0. I haven't found proper documentation for the changes from 5.5 to 6.0 which describe the removal of these startup batch files, which is a shame because i'm still not sure i'm doing it the correct way. Although it works which is, I guess, a good start.

Ben
A: 

try;

set JAVA_OPTS=-Dcom.sun.management.jmxremote...
java %JAVA_OPTS% -jar Notepad.jar

take note of %JAVA_OPTS%

n002213f