Wie kann ich jvm-Optionen (Java Virtual Machine) in Apache Tomcat 6 hinzufügen?
Gibt es eine Verwaltungskonsole in Tomcat? Ich habe http://localhost:8080/admin ausprobiert, aber ich konnte nichts damit anfangen.
Ich möchte die folgenden jvm-Optionen hinzufügen:
-agentpath:C:\calltracer\jvmti\calltracer5.dll=traceFile-C:\calltracer\call.trace,filterFile-C:\calltracer\filters.txt,outputType-xml,usage-uncontrolled -Djava.library.path=C:\calltracer\jvmti -Dcalltracerlib=calltracer5
Wie Bhavik Shah sagt, können Sie dies in JAVA_OPTS tun, aber der empfohlene Weg (laut catalina.sh) ist es, CATALINA_OPTS zu verwenden:
# 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.
# JAVA_OPTS (Optional) Java runtime options used when any command
# is executed.
# Include here and not in CATALINA_OPTS all options, that
# should be used by Tomcat and also by the stop process,
# the version command etc.
# Most options should go into CATALINA_OPTS.
Setzen Sie sie in der Variablen JAVA_OPTS
in [Pfad zum Tomcat]/bin/catalina.sh. Unter Windows gibt es eine Konsole, in der Sie die Einstellungen vornehmen können, oder Sie verwenden die Datei catalina.bat.
JAVA_OPTS=-agentpath:C:\calltracer\jvmti\calltracer5.dll=traceFile-C:\calltracer\call.trace,filterFile-C:\calltracer\filters.txt,outputType-xml,usage-uncontrolled -Djava.library.path=C:\calltracer\jvmti -Dcalltracerlib=calltracer5
Dazu müssen Sie die Anwendung "tomcat6w", die Teil der Standard-Tomcat-Distribution ist, im Verzeichnis "bin" ausführen. Für Windows lautet die Vorgabe z.B. "C:\Programme\Apache Software Foundation\Tomcat 6.0\bin\tomcat6w.exe". Die Anwendung "tomcat6w" startet eine grafische Benutzeroberfläche. Wenn Sie die Registerkarte "Java" auswählen, können Sie alle Java-Optionen eingeben.
Es ist auch möglich, JVM-Optionen über die Kommandozeile an tomcat zu übergeben. Dazu müssen Sie den Befehl verwenden:
<tomcatexecutable> //US//<tomcatservicename> ++JvmOptions="<JVMoptions>"
wobei "tomcatexecutable" sich auf Ihre Tomcat-Anwendung bezieht, "tomcatservicename" der von Ihnen verwendete Tomcat-Dienstname ist und "JVMoptions" Ihre JVM-Optionen sind. Zum Beispiel:
"tomcat6.exe" //US//tomcat6 ++JvmOptions="-XX:MaxPermSize=128m"