tomcat升级为7.0.85
diff --git a/tomcat-7/bin/bootstrap.jar b/tomcat-7/bin/bootstrap.jar
index 1ca4e9f..31a10e2 100644
--- a/tomcat-7/bin/bootstrap.jar
+++ b/tomcat-7/bin/bootstrap.jar
Binary files differ
diff --git a/tomcat-7/bin/catalina.bat b/tomcat-7/bin/catalina.bat
index 30e147b..e70c14a 100644
--- a/tomcat-7/bin/catalina.bat
+++ b/tomcat-7/bin/catalina.bat
@@ -22,6 +22,16 @@
 rem   Do not set the variables in this script. Instead put them into a script

 rem   setenv.bat in CATALINA_BASE/bin to keep your customizations separate.

 rem

+rem   WHEN RUNNING TOMCAT AS A WINDOWS SERVICE:

+rem   Note that the environment variables that affect the behavior of this

+rem   script will have no effect at all on Windows Services. As such, any

+rem   local customizations made in a CATALINA_BASE/bin/setenv.bat script

+rem   will also have no effect on Tomcat when launched as a Windows Service.

+rem   The configuration that controls Windows Services is stored in the Windows

+rem   Registry, and is most conveniently maintained using the "tomcatXw.exe"

+rem   maintenance utility, where "X" is the major version of Tomcat you are

+rem   running.

+rem

 rem   CATALINA_HOME   May point at your Catalina "build" directory.

 rem

 rem   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions

@@ -57,6 +67,7 @@
 rem                   containing some jars in order to allow replacement of APIs

 rem                   created outside of the JCP (i.e. DOM and SAX from W3C).

 rem                   It can also be used to update the XML parser implementation.

+rem                   Note that Java 9 no longer supports this feature.

 rem                   Defaults to $CATALINA_HOME/endorsed.

 rem

 rem   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"

@@ -185,12 +196,27 @@
 if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig

 set LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"

 :noJuliConfig

-set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%"

 

 if not "%LOGGING_MANAGER%" == "" goto noJuliManager

 set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

 :noJuliManager

-set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%"

+

+rem Java 9 no longer supports the java.endorsed.dirs

+rem system property. Only try to use it if

+rem JAVA_ENDORSED_DIRS was explicitly set

+rem or CATALINA_HOME/endorsed exists.

+set ENDORSED_PROP=ignore.endorsed.dirs

+if "%JAVA_ENDORSED_DIRS%" == "" goto noEndorsedVar

+set ENDORSED_PROP=java.endorsed.dirs

+goto doneEndorsed

+:noEndorsedVar

+if not exist "%CATALINA_HOME%\endorsed" goto doneEndorsed

+set ENDORSED_PROP=java.endorsed.dirs

+:doneEndorsed

+

+rem Configure JAVA 9 specific start-up parameters

+set "JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.lang=ALL-UNNAMED"

+set "JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"

 

 rem ----- Execute The Requested Command ---------------------------------------

 

@@ -308,17 +334,17 @@
 rem Execute Java with the applicable properties

 if not "%JPDA%" == "" goto doJpda

 if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity

-%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

+%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

 goto end

 :doSecurity

-%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

+%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

 goto end

 :doJpda

 if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda

-%_EXECJAVA% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

+%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

 goto end

 :doSecurityJpda

-%_EXECJAVA% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

+%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

 goto end

 

 :end

diff --git a/tomcat-7/bin/catalina.sh b/tomcat-7/bin/catalina.sh
index 33a4803..fa39688 100755
--- a/tomcat-7/bin/catalina.sh
+++ b/tomcat-7/bin/catalina.sh
@@ -62,6 +62,7 @@
 #                   containing some jars in order to allow replacement of APIs
 #                   created outside of the JCP (i.e. DOM and SAX from W3C).
 #                   It can also be used to update the XML parser implementation.
+#                   Note that Java 9 no longer supports this feature.
 #                   Defaults to $CATALINA_HOME/endorsed.
 #
 #   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
@@ -245,6 +246,18 @@
   LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
 fi
 
+# Java 9 no longer supports the java.endorsed.dirs
+# system property. Only try to use it if
+# JAVA_ENDORSED_DIRS was explicitly set
+# or CATALINA_HOME/endorsed exists.
+ENDORSED_PROP=ignore.endorsed.dirs
+if [ -n "$JAVA_ENDORSED_DIRS" ]; then
+    ENDORSED_PROP=java.endorsed.dirs
+fi
+if [ -d "$CATALINA_HOME/endorsed" ]; then
+    ENDORSED_PROP=java.endorsed.dirs
+fi
+
 # Uncomment the following line to make the umask available when using the
 # org.apache.catalina.security.SecurityListener
 #JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.security.SecurityListener.UMASK=`umask`"
@@ -261,6 +274,11 @@
     _NOHUP=nohup
 fi
 
+# Add the JAVA 9 specific start-up parameters required by Tomcat
+JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.lang=ALL-UNNAMED"
+JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"
+export JDK_JAVA_OPTIONS
+
 # ----- Execute The Requested Command -----------------------------------------
 
 # Bugzilla 37848: only output this if we have a TTY
@@ -308,7 +326,8 @@
       fi
       shift
       exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+        -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \
+        -classpath "$CLASSPATH" \
         -sourcepath "$CATALINA_HOME"/../../java \
         -Djava.security.manager \
         -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
@@ -318,7 +337,8 @@
         org.apache.catalina.startup.Bootstrap "$@" start
     else
       exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+        -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \
+        -classpath "$CLASSPATH" \
         -sourcepath "$CATALINA_HOME"/../../java \
         -Dcatalina.base="$CATALINA_BASE" \
         -Dcatalina.home="$CATALINA_HOME" \
@@ -336,7 +356,8 @@
     fi
     shift
     eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
+      -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
+      -classpath "\"$CLASSPATH\"" \
       -Djava.security.manager \
       -Djava.security.policy=="\"$CATALINA_BASE/conf/catalina.policy\"" \
       -Dcatalina.base="\"$CATALINA_BASE\"" \
@@ -345,7 +366,8 @@
       org.apache.catalina.startup.Bootstrap "$@" start
   else
     eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
+      -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
+      -classpath "\"$CLASSPATH\"" \
       -Dcatalina.base="\"$CATALINA_BASE\"" \
       -Dcatalina.home="\"$CATALINA_HOME\"" \
       -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
@@ -402,7 +424,8 @@
     fi
     shift
     eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
+      -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
+      -classpath "\"$CLASSPATH\"" \
       -Djava.security.manager \
       -Djava.security.policy=="\"$CATALINA_BASE/conf/catalina.policy\"" \
       -Dcatalina.base="\"$CATALINA_BASE\"" \
@@ -413,7 +436,8 @@
 
   else
     eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
+      -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
+      -classpath "\"$CLASSPATH\"" \
       -Dcatalina.base="\"$CATALINA_BASE\"" \
       -Dcatalina.home="\"$CATALINA_HOME\"" \
       -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
@@ -465,7 +489,8 @@
   fi
 
   eval "\"$_RUNJAVA\"" $LOGGING_MANAGER $JAVA_OPTS \
-    -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
+    -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
+    -classpath "\"$CLASSPATH\"" \
     -Dcatalina.base="\"$CATALINA_BASE\"" \
     -Dcatalina.home="\"$CATALINA_HOME\"" \
     -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
@@ -551,7 +576,8 @@
 elif [ "$1" = "configtest" ] ; then
 
     eval "\"$_RUNJAVA\"" $LOGGING_MANAGER $JAVA_OPTS \
-      -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
+      -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
+      -classpath "\"$CLASSPATH\"" \
       -Dcatalina.base="\"$CATALINA_BASE\"" \
       -Dcatalina.home="\"$CATALINA_HOME\"" \
       -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
diff --git a/tomcat-7/bin/commons-daemon-native.tar.gz b/tomcat-7/bin/commons-daemon-native.tar.gz
index 6d25918..39cfff5 100644
--- a/tomcat-7/bin/commons-daemon-native.tar.gz
+++ b/tomcat-7/bin/commons-daemon-native.tar.gz
Binary files differ
diff --git a/tomcat-7/bin/commons-daemon.jar b/tomcat-7/bin/commons-daemon.jar
index 2b6b9c6..173f67f 100644
--- a/tomcat-7/bin/commons-daemon.jar
+++ b/tomcat-7/bin/commons-daemon.jar
Binary files differ
diff --git a/tomcat-7/bin/daemon.sh b/tomcat-7/bin/daemon.sh
index dee6c77..ef9f708 100755
--- a/tomcat-7/bin/daemon.sh
+++ b/tomcat-7/bin/daemon.sh
@@ -94,6 +94,15 @@
 #
 if [ -z "$JAVA_HOME" ]; then
     JAVA_BIN="`which java 2>/dev/null || type java 2>&1`"
+    while [ -h "$JAVA_BIN" ]; do
+        ls=`ls -ld "$JAVA_BIN"`
+        link=`expr "$ls" : '.*-> \(.*\)$'`
+        if expr "$link" : '/.*' > /dev/null; then
+            JAVA_BIN="$link"
+        else
+            JAVA_BIN="`dirname $JAVA_BIN`/$link"
+        fi
+    done
     test -x "$JAVA_BIN" && JAVA_HOME="`dirname $JAVA_BIN`"
     test ".$JAVA_HOME" != . && JAVA_HOME=`cd "$JAVA_HOME/.." >/dev/null; pwd`
 else
@@ -172,6 +181,18 @@
     fi
 fi
 
+# Java 9 no longer supports the java.endorsed.dirs
+# system property. Only try to use it if
+# JAVA_ENDORSED_DIRS was explicitly set
+# or CATALINA_HOME/endorsed exists.
+ENDORSED_PROP=ignore.endorsed.dirs
+if [ -n "$JAVA_ENDORSED_DIRS" ]; then
+    ENDORSED_PROP=java.endorsed.dirs
+fi
+if [ -d "$CATALINA_HOME/endorsed" ]; then
+    ENDORSED_PROP=java.endorsed.dirs
+fi
+
 # ----- Execute The Requested Command -----------------------------------------
 case "$1" in
     run     )
@@ -186,7 +207,7 @@
       -errfile "&2" \
       -classpath "$CLASSPATH" \
       "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
+      -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \
       -Dcatalina.base="$CATALINA_BASE" \
       -Dcatalina.home="$CATALINA_HOME" \
       -Djava.io.tmpdir="$CATALINA_TMP" \
@@ -203,7 +224,7 @@
       -errfile "&1" \
       -classpath "$CLASSPATH" \
       "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
+      -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \
       -Dcatalina.base="$CATALINA_BASE" \
       -Dcatalina.home="$CATALINA_HOME" \
       -Djava.io.tmpdir="$CATALINA_TMP" \
@@ -215,7 +236,7 @@
       -stop \
       -pidfile "$CATALINA_PID" \
       -classpath "$CLASSPATH" \
-      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
+      -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \
       -Dcatalina.base="$CATALINA_BASE" \
       -Dcatalina.home="$CATALINA_HOME" \
       -Djava.io.tmpdir="$CATALINA_TMP" \
diff --git a/tomcat-7/bin/setclasspath.bat b/tomcat-7/bin/setclasspath.bat
index da0d8a3..2cf4610 100644
--- a/tomcat-7/bin/setclasspath.bat
+++ b/tomcat-7/bin/setclasspath.bat
@@ -67,7 +67,10 @@
 :okJava

 rem Don't override the endorsed dir if the user has set it previously

 if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir

-rem Set the default -Djava.endorsed.dirs argument

+rem Java 9 no longer supports the java.endorsed.dirs

+rem system property. Only try to use it if

+rem CATALINA_HOME/endorsed exists.

+if not exist "%CATALINA_HOME%\endorsed" goto gotEndorseddir

 set "JAVA_ENDORSED_DIRS=%CATALINA_HOME%\endorsed"

 :gotEndorseddir

 

diff --git a/tomcat-7/bin/setclasspath.sh b/tomcat-7/bin/setclasspath.sh
index 873fad3..5232b8e 100755
--- a/tomcat-7/bin/setclasspath.sh
+++ b/tomcat-7/bin/setclasspath.sh
@@ -79,8 +79,12 @@
 
 # Don't override the endorsed dir if the user has set it previously
 if [ -z "$JAVA_ENDORSED_DIRS" ]; then
-  # Set the default -Djava.endorsed.dirs argument
-  JAVA_ENDORSED_DIRS="$CATALINA_HOME"/endorsed
+  # Java 9 no longer supports the java.endorsed.dirs
+  # system property. Only try to use it if
+  # CATALINA_HOME/endorsed exists.
+  if [ -d "$CATALINA_HOME"/endorsed ]; then
+    JAVA_ENDORSED_DIRS="$CATALINA_HOME"/endorsed
+  fi
 fi
 
 # Set standard commands for invoking Java, if not already set.
@@ -91,4 +95,4 @@
   if [ -z "$_RUNJDB" ]; then
     _RUNJDB="$JAVA_HOME"/bin/jdb
   fi
-fi
\ No newline at end of file
+fi
diff --git a/tomcat-7/bin/tomcat-juli.jar b/tomcat-7/bin/tomcat-juli.jar
index 2d3628a..995d3e5 100644
--- a/tomcat-7/bin/tomcat-juli.jar
+++ b/tomcat-7/bin/tomcat-juli.jar
Binary files differ
diff --git a/tomcat-7/bin/tomcat-native.tar.gz b/tomcat-7/bin/tomcat-native.tar.gz
index 3d0d017..2b47ef1 100644
--- a/tomcat-7/bin/tomcat-native.tar.gz
+++ b/tomcat-7/bin/tomcat-native.tar.gz
Binary files differ
diff --git a/tomcat-7/bin/tool-wrapper.bat b/tomcat-7/bin/tool-wrapper.bat
index fcff6da..331d42e 100644
--- a/tomcat-7/bin/tool-wrapper.bat
+++ b/tomcat-7/bin/tool-wrapper.bat
@@ -36,6 +36,7 @@
 rem                   containing some jars in order to allow replacement of APIs

 rem                   created outside of the JCP (i.e. DOM and SAX from W3C).

 rem                   It can also be used to update the XML parser implementation.

+rem                   Note that Java 9 no longer supports this feature.

 rem                   Defaults to $CATALINA_HOME/endorsed.

 rem ---------------------------------------------------------------------------

 

@@ -82,6 +83,19 @@
 

 set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

 

+rem Java 9 no longer supports the java.endorsed.dirs

+rem system property. Only try to use it if

+rem JAVA_ENDORSED_DIRS was explicitly set

+rem or CATALINA_HOME/endorsed exists.

+set ENDORSED_PROP=ignore.endorsed.dirs

+if "%JAVA_ENDORSED_DIRS%" == "" goto noEndorsedVar

+set ENDORSED_PROP=java.endorsed.dirs

+goto doneEndorsed

+:noEndorsedVar

+if not exist "%CATALINA_HOME%\endorsed" goto doneEndorsed

+set ENDORSED_PROP=java.endorsed.dirs

+:doneEndorsed

+

 rem Get remaining unshifted command line arguments and save them in the

 set CMD_LINE_ARGS=

 :setArgs

@@ -91,6 +105,6 @@
 goto setArgs

 :doneSetArgs

 

-%_RUNJAVA% %JAVA_OPTS% %TOOL_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.home="%CATALINA_HOME%" org.apache.catalina.startup.Tool %CMD_LINE_ARGS%

+%_RUNJAVA% %JAVA_OPTS% %TOOL_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.home="%CATALINA_HOME%" org.apache.catalina.startup.Tool %CMD_LINE_ARGS%

 

 :end

diff --git a/tomcat-7/bin/tool-wrapper.sh b/tomcat-7/bin/tool-wrapper.sh
index 31cebf6..54ea0fc 100755
--- a/tomcat-7/bin/tool-wrapper.sh
+++ b/tomcat-7/bin/tool-wrapper.sh
@@ -37,6 +37,7 @@
 #                   containing some jars in order to allow replacement of APIs
 #                   created outside of the JCP (i.e. DOM and SAX from W3C).
 #                   It can also be used to update the XML parser implementation.
+#                   Note that Java 9 no longer supports this feature.
 #                   Defaults to $CATALINA_HOME/endorsed.
 # -----------------------------------------------------------------------------
 
@@ -129,11 +130,24 @@
   JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
 fi
 
+# Java 9 no longer supports the java.endorsed.dirs
+# system property. Only try to use it if
+# JAVA_ENDORSED_DIRS was explicitly set
+# or CATALINA_HOME/endorsed exists.
+ENDORSED_PROP=ignore.endorsed.dirs
+if [ -n "$JAVA_ENDORSED_DIRS" ]; then
+    ENDORSED_PROP=java.endorsed.dirs
+fi
+if [ -d "$CATALINA_HOME/endorsed" ]; then
+    ENDORSED_PROP=java.endorsed.dirs
+fi
+
 JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
 
 # ----- Execute The Requested Command -----------------------------------------
 
 exec "$_RUNJAVA" $JAVA_OPTS $TOOL_OPTS \
-  -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+  -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \
+  -classpath "$CLASSPATH" \
   -Dcatalina.home="$CATALINA_HOME" \
   org.apache.catalina.startup.Tool "$@"