Add JVM options in Tomcat

后端 未结 6 487
失恋的感觉
失恋的感觉 2020-11-27 18:40

How can I add jvm(Java virtual machine) options in Apache Tomcat 6?

Is there a administration console in tomcat? I tried http://localhost:8080/admin but I could not

6条回答
  •  迷失自我
    2020-11-27 19:08

    After checking catalina.sh (for windows use the .bat versions of everything mentioned below)

    #   Do not set the variables in this script. Instead put them into a script
    #   setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
    

    Also this

    #   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
    

    So create a setenv.sh under CATALINA_BASE/bin (same dir where the catalina.sh resides). Edit the file and set the arguments to CATALINA_OPTS

    For e.g. the file would look like this if you wanted to change the heap size

    CATALINA_OPTS=-Xmx512m
    

    Or in your case since you're using windows setenv.bat would be

    set CATALINA_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
    

    To clear the added options later just delete setenv.bat/sh

提交回复
热议问题