1、位置最好在执行前
# ----- Execute The Requested Command -----------------------------------------
这样可以保证里面的属性,如CATALINA_BASE 能正确获得
2、不能使用JAVA_OPTS,下面是二者区别
# 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.
# 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关服的时候会抛出异常:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: portNum; nested exception is:
java.net.BindException: Address already in use