Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D50FB200D07 for ; Sun, 1 Oct 2017 23:07:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D37B71609C8; Sun, 1 Oct 2017 21:07:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7CBA61609C5 for ; Sun, 1 Oct 2017 23:07:13 +0200 (CEST) Received: (qmail 87472 invoked by uid 500); 1 Oct 2017 21:07:12 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 87462 invoked by uid 99); 1 Oct 2017 21:07:12 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Oct 2017 21:07:12 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 69FD73A0217 for ; Sun, 1 Oct 2017 21:07:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1810280 - in /tomcat/trunk: ./ bin/ webapps/docs/ Date: Sun, 01 Oct 2017 21:07:07 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20171001210711.69FD73A0217@svn01-us-west.apache.org> archived-at: Sun, 01 Oct 2017 21:07:15 -0000 Author: markt Date: Sun Oct 1 21:07:07 2017 New Revision: 1810280 URL: http://svn.apache.org/viewvc?rev=1810280&view=rev Log: Improved handling of endorsed directories for Java 9. Patch by rjung. Modified: tomcat/trunk/RELEASE-NOTES tomcat/trunk/RUNNING.txt tomcat/trunk/bin/catalina.bat tomcat/trunk/bin/catalina.sh tomcat/trunk/bin/daemon.sh tomcat/trunk/bin/service.bat tomcat/trunk/bin/setclasspath.bat tomcat/trunk/bin/setclasspath.sh tomcat/trunk/bin/tool-wrapper.bat tomcat/trunk/bin/tool-wrapper.sh tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/class-loader-howto.xml Modified: tomcat/trunk/RELEASE-NOTES URL: http://svn.apache.org/viewvc/tomcat/trunk/RELEASE-NOTES?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/RELEASE-NOTES (original) +++ tomcat/trunk/RELEASE-NOTES Sun Oct 1 21:07:07 2017 @@ -93,7 +93,8 @@ or by placing them in JAR files in the " To override the XML parser implementation or interfaces, use the appropriate feature for your JVM. For Java <= 8 use the endorsed standards override -feature. For Java 9+ use the upgradeable modules feature. +feature. The default configuration defines JARs located in "endorsed" as endorsed. +For Java 9+ use the upgradeable modules feature. ================================================================ Modified: tomcat/trunk/RUNNING.txt URL: http://svn.apache.org/viewvc/tomcat/trunk/RUNNING.txt?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/RUNNING.txt (original) +++ tomcat/trunk/RUNNING.txt Sun Oct 1 21:07:07 2017 @@ -272,6 +272,12 @@ In CATALINA_HOME: * lib - Libraries and classes, as explained below + * endorsed - Libraries that override standard "Endorsed Standards" + libraries provided by JRE. See Classloading documentation + in the User Guide for details. + This is only supported for Java <= 8. + By default this "endorsed" directory is absent. + In the default configuration the JAR libraries and classes both in CATALINA_BASE/lib and in CATALINA_HOME/lib will be added to the common classpath, but the ones in CATALINA_BASE will be added first and thus will Modified: tomcat/trunk/bin/catalina.bat URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.bat?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/catalina.bat (original) +++ tomcat/trunk/bin/catalina.bat Sun Oct 1 21:07:07 2017 @@ -63,6 +63,13 @@ rem should be used by rem the version command etc. rem Most options should go into CATALINA_OPTS. rem +rem JAVA_ENDORSED_DIRS (Optional) Lists of of semi-colon separated directories +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 This is only supported for Java <= 8. +rem Defaults to $CATALINA_HOME/endorsed. +rem rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start" rem command is executed. The default is "dt_socket". rem @@ -219,6 +226,19 @@ rem Configure JAVA 9 specific start-up p 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 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 ----- Execute The Requested Command --------------------------------------- echo Using CATALINA_BASE: "%CATALINA_BASE%" @@ -335,17 +355,17 @@ goto setArgs rem Execute Java with the applicable properties if not "%JPDA%" == "" goto doJpda if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity -%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -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% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -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% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -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% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -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 Modified: tomcat/trunk/bin/catalina.sh URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/catalina.sh (original) +++ tomcat/trunk/bin/catalina.sh Sun Oct 1 21:07:07 2017 @@ -58,6 +58,13 @@ # the version command etc. # Most options should go into CATALINA_OPTS. # +# JAVA_ENDORSED_DIRS (Optional) Lists of of colon separated directories +# 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. +# This is only supported for Java <= 8. +# Defaults to $CATALINA_HOME/endorsed. +# # JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start" # command is executed. The default is "dt_socket". # @@ -233,6 +240,7 @@ if $cygwin; then CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"` CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"` CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` fi if [ -z "$JSSE_OPTS" ] ; then @@ -264,6 +272,18 @@ if [ -z "$UMASK" ]; then fi umask $UMASK +# 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`" @@ -332,6 +352,7 @@ if [ "$1" = "debug" ] ; then fi shift exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \ -classpath "$CLASSPATH" \ -sourcepath "$CATALINA_HOME"/../../java \ -Djava.security.manager \ @@ -342,6 +363,7 @@ if [ "$1" = "debug" ] ; then org.apache.catalina.startup.Bootstrap "$@" start else exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \ -classpath "$CLASSPATH" \ -sourcepath "$CATALINA_HOME"/../../java \ -Dcatalina.base="$CATALINA_BASE" \ @@ -360,6 +382,7 @@ elif [ "$1" = "run" ]; then fi shift eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \ -classpath "\"$CLASSPATH\"" \ -Djava.security.manager \ -Djava.security.policy=="\"$CATALINA_BASE/conf/catalina.policy\"" \ @@ -369,6 +392,7 @@ elif [ "$1" = "run" ]; then org.apache.catalina.startup.Bootstrap "$@" start else eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \ -classpath "\"$CLASSPATH\"" \ -Dcatalina.base="\"$CATALINA_BASE\"" \ -Dcatalina.home="\"$CATALINA_HOME\"" \ @@ -426,6 +450,7 @@ elif [ "$1" = "start" ] ; then fi shift eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \ -classpath "\"$CLASSPATH\"" \ -Djava.security.manager \ -Djava.security.policy=="\"$CATALINA_BASE/conf/catalina.policy\"" \ @@ -437,6 +462,7 @@ elif [ "$1" = "start" ] ; then else eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \ -classpath "\"$CLASSPATH\"" \ -Dcatalina.base="\"$CATALINA_BASE\"" \ -Dcatalina.home="\"$CATALINA_HOME\"" \ @@ -489,6 +515,7 @@ elif [ "$1" = "stop" ] ; then fi eval "\"$_RUNJAVA\"" $JAVA_OPTS \ + -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \ -classpath "\"$CLASSPATH\"" \ -Dcatalina.base="\"$CATALINA_BASE\"" \ -Dcatalina.home="\"$CATALINA_HOME\"" \ @@ -575,6 +602,7 @@ elif [ "$1" = "stop" ] ; then elif [ "$1" = "configtest" ] ; then eval "\"$_RUNJAVA\"" $LOGGING_MANAGER $JAVA_OPTS \ + -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \ -classpath "\"$CLASSPATH\"" \ -Dcatalina.base="\"$CATALINA_BASE\"" \ -Dcatalina.home="\"$CATALINA_HOME\"" \ Modified: tomcat/trunk/bin/daemon.sh URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/daemon.sh?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/daemon.sh (original) +++ tomcat/trunk/bin/daemon.sh Sun Oct 1 21:07:07 2017 @@ -181,6 +181,18 @@ if [ "$cygwin" = "false" ]; then 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 ) @@ -195,6 +207,7 @@ case "$1" in -errfile "&2" \ -classpath "$CLASSPATH" \ "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \ -Dcatalina.base="$CATALINA_BASE" \ -Dcatalina.home="$CATALINA_HOME" \ -Djava.io.tmpdir="$CATALINA_TMP" \ @@ -211,6 +224,7 @@ case "$1" in -errfile "&1" \ -classpath "$CLASSPATH" \ "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \ + -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \ -Dcatalina.base="$CATALINA_BASE" \ -Dcatalina.home="$CATALINA_HOME" \ -Djava.io.tmpdir="$CATALINA_TMP" \ @@ -222,6 +236,7 @@ case "$1" in -stop \ -pidfile "$CATALINA_PID" \ -classpath "$CLASSPATH" \ + -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \ -Dcatalina.base="$CATALINA_BASE" \ -Dcatalina.home="$CATALINA_HOME" \ -Djava.io.tmpdir="$CATALINA_TMP" \ Modified: tomcat/trunk/bin/service.bat URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/service.bat?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/service.bat (original) +++ tomcat/trunk/bin/service.bat Sun Oct 1 21:07:07 2017 @@ -77,6 +77,19 @@ rem Set default Service name set SERVICE_NAME=Tomcat@VERSION_MAJOR@ set DISPLAYNAME=Apache Tomcat @VERSION_MAJOR_MINOR@ %SERVICE_NAME% +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 + if "x%1x" == "xx" goto displayUsage set SERVICE_CMD=%1 shift @@ -163,7 +176,7 @@ if "%JvmMx%" == "" set JvmMx=256 --StopClass org.apache.catalina.startup.Bootstrap ^ --StartParams start ^ --StopParams stop ^ - --JvmOptions "-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_BASE%;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;%JvmArgs%" ^ + --JvmOptions "-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_BASE%;-D%ENDORSED_PROP%=%CATALINA_HOME%\endorsed;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;%JvmArgs%" ^ --Startup "%SERVICE_STARTUP_MODE%" ^ --JvmMs "%JvmMs%" ^ --JvmMx "%JvmMx%" Modified: tomcat/trunk/bin/setclasspath.bat URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/setclasspath.bat?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/setclasspath.bat (original) +++ tomcat/trunk/bin/setclasspath.bat Sun Oct 1 21:07:07 2017 @@ -15,8 +15,9 @@ rem See the License for the specific lan rem limitations under the License. rem --------------------------------------------------------------------------- -rem Set JAVA_HOME or JRE_HOME if not already set and ensure any provided -rem settings are valid and consistent with the selected start-up options. +rem Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings +rem are valid and consistent with the selected start-up options and set up the +rem endorsed directory. rem --------------------------------------------------------------------------- rem Make sure prerequisite environment variables are set @@ -64,6 +65,14 @@ echo This environment variable is needed goto exit :okJava +rem Don't override the endorsed dir if the user has set it previously +if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir +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 rem Don't override _RUNJAVA if the user has set it previously if not "%_RUNJAVA%" == "" goto gotRunJava Modified: tomcat/trunk/bin/setclasspath.sh URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/setclasspath.sh?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/setclasspath.sh (original) +++ tomcat/trunk/bin/setclasspath.sh Sun Oct 1 21:07:07 2017 @@ -16,8 +16,9 @@ # limitations under the License. # ----------------------------------------------------------------------------- -# Set JAVA_HOME or JRE_HOME if not already set and ensure any provided -# settings are valid and consistent with the selected start-up options. +# Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings +# are valid and consistent with the selected start-up options and set up the +# endorsed directory. # ----------------------------------------------------------------------------- # Make sure prerequisite environment variables are set @@ -76,6 +77,16 @@ if [ "$1" = "debug" ] ; then fi fi +# Don't override the endorsed dir if the user has set it previously +if [ -z "$JAVA_ENDORSED_DIRS" ]; then + # 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. if [ -z "$_RUNJAVA" ]; then _RUNJAVA="$JRE_HOME"/bin/java @@ -84,4 +95,4 @@ if [ "$os400" != "true" ]; then if [ -z "$_RUNJDB" ]; then _RUNJDB="$JAVA_HOME"/bin/jdb fi -fi \ No newline at end of file +fi Modified: tomcat/trunk/bin/tool-wrapper.bat URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/tool-wrapper.bat?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/tool-wrapper.bat (original) +++ tomcat/trunk/bin/tool-wrapper.bat Sun Oct 1 21:07:07 2017 @@ -31,6 +31,13 @@ rem Defaults to JAVA_H rem are both set, JRE_HOME is used. rem rem JAVA_OPTS (Optional) Java runtime options. +rem +rem JAVA_ENDORSED_DIRS (Optional) Lists of of semi-colon separated directories +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 This is only supported for Java <= 8. +rem Defaults to $CATALINA_HOME/endorsed. rem --------------------------------------------------------------------------- setlocal @@ -76,6 +83,19 @@ set "CLASSPATH=%CLASSPATH%%CATALINA_HOME 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 @@ -85,6 +105,6 @@ shift goto setArgs :doneSetArgs -%_RUNJAVA% %JAVA_OPTS% %TOOL_OPTS% -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 Modified: tomcat/trunk/bin/tool-wrapper.sh URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/tool-wrapper.sh?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/bin/tool-wrapper.sh (original) +++ tomcat/trunk/bin/tool-wrapper.sh Sun Oct 1 21:07:07 2017 @@ -32,6 +32,13 @@ # are both set, JRE_HOME is used. # # JAVA_OPTS (Optional) Java runtime options. +# +# JAVA_ENDORSED_DIRS (Optional) Lists of of colon separated directories +# 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. +# This is only supported for Java <= 8. +# Defaults to $CATALINA_HOME/endorsed. # ----------------------------------------------------------------------------- # OS specific support. $var _must_ be set to either true or false. @@ -120,6 +127,19 @@ if $cygwin; then JRE_HOME=`cygpath --absolute --windows "$JRE_HOME"` CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"` CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + 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" @@ -127,6 +147,7 @@ JAVA_OPTS="$JAVA_OPTS -Djava.util.loggin # ----- Execute The Requested Command ----------------------------------------- exec "$_RUNJAVA" $JAVA_OPTS $TOOL_OPTS \ + -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \ -classpath "$CLASSPATH" \ -Dcatalina.home="$CATALINA_HOME" \ org.apache.catalina.startup.Tool "$@" Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Sun Oct 1 21:07:07 2017 @@ -51,6 +51,14 @@ Improve the fix for 61439 and exclude the JPA, JAX-WS and EJB annotations completely from the Tomcat distributions. (markt) + + Improve handling of endorsed directories. The endorsed directory + mechanism will only be used if the JAVA_ENDORSED_DIRS + system property is explictly set or if + $CATALINA_HOME/endorsed exists. When running on Java 9, any + such attempted use of the endorsed directory mechanism will trigger an + error and Tomcat will fail to start. (rjung) + Modified: tomcat/trunk/webapps/docs/class-loader-howto.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/class-loader-howto.xml?rev=1810280&r1=1810279&r2=1810280&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/class-loader-howto.xml (original) +++ tomcat/trunk/webapps/docs/class-loader-howto.xml Sun Oct 1 21:07:07 2017 @@ -231,6 +231,16 @@ implementation. For more information, s http://docs.oracle.com/javase/1.5.0/docs/guide/standards/index.html. For Java 9+, use the upgradeable modules feature.

+

Tomcat utilizes the endorsed mechanism by including the system property setting +-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS in the +command line that starts the container. The default value of this option is +$CATALINA_HOME/endorsed. This endorsed directory is not +created by default. Note that the endorsed feature is no longer supported +with Java 9 and the above system property will only be set if either the +directory $CATALINA_HOME/endorsed exists, or the variable +JAVA_ENDORSED_DIRS has been set. +

+

Note that overriding any JRE component carries risk. If the overriding component does not provide a 100% compatible API (e.g. the API provided by Xerces is not 100% compatible with the XML API provided by the JRE) then there --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org