Skip to content

Commits on Source 22

......@@ -23,6 +23,7 @@ output
work
build.properties
mvn.properties
.ant-targets-build.xml
.checkstyle
.classpath
.fbprefs
......@@ -30,6 +31,8 @@ mvn.properties
.settings
.idea
*.iml
*.ipr
*.iws
*.asc
*.jj
*.tmp
......
......@@ -21,7 +21,7 @@
This subproject contains the source code for Tomcat @VERSION_MAJOR_MINOR@, a container that
implements the Servlet 3.1, JSP 2.3, EL 3.0, WebSocket 1.1 and JASPIC 1.1
specifications from the Java Community Process <http://www.jcp.org/>.
specifications from the Java Community Process <https://www.jcp.org/>.
Note: If you just need to run Apache Tomcat, it is not necessary to build
it. You may simply download a binary distribution. It is cross-platform.
......@@ -35,7 +35,7 @@ source distribution, do the following:
1. If the JDK is already installed, skip to (2).
2. Download a version 8 of Java Development Kit (JDK) release (use the
2. Download a version 7 of Java Development Kit (JDK) release (use the
latest update available for your chosen version) from one of:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
......@@ -45,18 +45,18 @@ source distribution, do the following:
Note regarding later versions of Java:
As documented elsewhere, one of components in Apache Tomcat includes
a private copy of the Apache Commons DBCP library.
a private copy of the Apache Commons DBCP 2 library.
The JDBC interfaces implemented by DBCP frequently change in non-backwards
compatible ways between versions of the Java SE specification. Therefore,
it is likely that DBCP will only compile with the specific version of Java
it is likely that DBCP 2 will only compile with the specific version of Java
listed above and that compilation will fail if a later version of Java is
used.
See Apache Commons DBCP project web site for more details on
See Apache Commons DBCP 2 project web site for more details on
available versions of the library and its requirements,
http://commons.apache.org/dbcp/
https://commons.apache.org/dbcp/
3. Install the JDK according to the instructions included with the release.
......@@ -64,14 +64,14 @@ source distribution, do the following:
into which you installed the JDK release.
(2) Install Apache Ant version 1.9.5 or later on your computer.
(2) Install Apache Ant version 1.9.8 or later on your computer.
1. If Apache Ant version 1.9.5 or later is already installed on your
1. If Apache Ant version 1.9.8 or later is already installed on your
computer, skip to (3).
2. Download a binary distribution of Ant from:
http://ant.apache.org/bindownload.cgi
https://ant.apache.org/bindownload.cgi
3. Unpack the binary distribution into a convenient location so that the
Ant release resides in its own directory (conventionally named
......@@ -93,17 +93,17 @@ source distribution, do the following:
(3.1) Checkout or obtain the source code for Tomcat @VERSION_MAJOR_MINOR@
Checkout the source using SVN, selecting a tag for released version or
trunk for the current development code, or download and unpack a source
Clone the source using git, then checkout a specific major branch or
master for the latest code development, or download and unpack a source
package.
* Tomcat SVN repository URL:
* Tomcat GitHub repository URL:
http://svn.apache.org/repos/asf/tomcat/tc@VERSION_MAJOR_MINOR@.x/trunk/
https://github.com/apache/tomcat
* Source packages can be downloaded from:
http://tomcat.apache.org/download-@VERSION_MAJOR@0.cgi
https://tomcat.apache.org/download-@VERSION_MAJOR@0.cgi
The location where the source has been placed will be further referred as
${tomcat.source}.
......@@ -397,6 +397,12 @@ For example:
test.name=**/TestSsl.java,**/TestWebSocketFrameClientSSL.java
You can exclude specific JUnit test classes by adding the "test.exclude"
property to the build.properties file. The property specifies an Ant
excludes pattern for the fileset of test class files to exclude form the run.
The default value is empty, so no classes are excluded. The syntax is the same
as for the property "test.name".
(7.4) Other configuration options
......@@ -443,8 +449,8 @@ For example:
6. Optional support is provided for the Cobertura code coverage tool.
NOTE: Cobertura is licensed under GPL v2 with parts of it being under
Apache License v1.1. See http://cobertura.sf.net for details. Using it
during Tomcat build is optional and is off by default.
Apache License v1.1. See https://cobertura.github.io/cobertura/ for details.
Using it during Tomcat build is optional and is off by default.
Cobertura can be enabled using the following properties:
......@@ -523,7 +529,7 @@ target. The command is:
NOTE: FindBugs is licensed under LGPL. Using Findbugs during Tomcat build is
optional and is off by default.
See http://findbugs.sourceforge.net/ for more information.
See https://spotbugs.github.io/ for more information.
To enable FindBugs, add the following property to build.properties file:
......@@ -545,15 +551,12 @@ The report file by default is written to
You usually would not need to run this check. You can skip this section.
Apache Tomcat project has convention that all of its textual source files,
stored in Subversion repository, are marked with Subversion property
"svn:eol-style" with value of "native". This convention makes the editing
of source code on different platforms easier.
stored in the Git repository, use Unix style LF line endings.
This test is used by developers to check that the source code adheres to
this convention. It verifies that the ends of lines in textual files are
appropriate for the operating system where it is run. The idea is to run
this check regularly on two different platforms and notify developers when
an inconsistency is detected.
appropriate. The idea is to run this check regularly and notify developers
when an inconsistency is detected.
The command to run this test is:
......
# Contributing to Apache Tomcat
Firstly, thanks for your interest in contributing! I hope that this will be a
pleasant experience for you, and that you will return to continue
contributing.
Please visit our [Get Involved page](https://tomcat.apache.org/getinvolved.html)
for more information on how to contribute.
## Code of Conduct
This project and everyone participating in it are governed by the Apache
software Foundation's
[Code of Conduct](https://www.apache.org/foundation/policies/conduct.html). By
participating, you are expected to adhere to this code. If you are aware of
unacceptable behavior, please visit the
[Reporting Guidelines page](https://www.apache.org/foundation/policies/conduct.html#reporting-guidelines)
and follow the instructions there.
## How Can I Contribute?
Most of the contributions that we receive are code contributions, but you can
also contribute to the documentation, wiki, etc., or simply report solid bugs
for us to fix.
### Reporting Bugs
Please review our [guide](https://tomcat.apache.org/bugreport.html) on how to
submit a bug report. This page also has links to other resources to assist
you.
### Your First Code Contribution
### Trouble Deciding How to Contribute?
Unsure where to begin contributing to Tomcat? You can start by taking a look at
the issues marked 'Beginner', link below. Please note that the Beginner keyword
is pretty new to the project, so if there aren't any issues in the filter feel
free to ask on the [dev list](https://tomcat.apache.org/lists.html#tomcat-dev).
* [Beginner issues](https://bz.apache.org/bugzilla/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO&keywords=Beginner&keywords_type=allwords&list_id=160824&product=Tomcat%207&product=Tomcat%208.5&product=Tomcat%209&query_format=advanced) -
issues which should only require a few lines of code, and a test or two to
resolve.
The list above shows all bugs that are marked 'Beginner' and are open in the
currently supported Tomcat versions (7, 8.5, and 9).
If you prefer C over Java, you may also take a look at the tomcat-native and
Tomcat Connectors products in Bugzilla.
### How to Provide Your First Patch
Excited yet? This section will guide you through providing a patch to the
committers of the project for review and acceptance.
##### Choose Your Method of Submission
You can provide a patch in one of the following ways (in order of preference):
* GitHub Pull Request
* Patch attachment to the Bugzilla issue
* Email the patch to the developer list. This is not preferred, but if no bug
is associated with the patch, or you would like a developer review, an email
may be appropriate.
##### Get the Sources
Now that you've chosen how you want to submit a patch, you need to get the
source code.
###### Download The Source Distribution
This method works if you want to submit a patch via email, but
the difference in using the sources distribution and a VCS is that you have to
manually generate the patch file by using diff. If this is what you want, you
can download the sources from the "Source Code Distributions" section of the
Download Page. There is one such page for every major Tomcat version:
- [Tomcat 9](https://tomcat.apache.org/download-90.cgi)
- [Tomcat 8](https://tomcat.apache.org/download-80.cgi)
- [Tomcat 7](https://tomcat.apache.org/download-70.cgi)
##### Manual Patch Generation
If you have chosen to attach a patch to the Bugzilla issue (or email
one), then you'll need to download the sources as noted above, make your
desired changes and then manually generate your patch using diff (other
other tool).
##### GitHub
To submit a GitHub Pull Request you'll need to fork the
[repository](https://github.com/apache/tomcat), clone your fork to do the work:
```
$ git clone https://github.com/$USERNAME/tomcat.git
```
and then push your changes, and submit a Pull Request via the GitHub UI.
#### Submitting Your Patch!
After you've chosen your method of submission, retrieved the sources, and
fixed the issue it's time to submit your work. At this point, just follow
the method of submission you chose earlier.
* GitHub PR - after resolving the issue in your local fork and pushing to your
copy of the repository, open a GitHub PR for review.
* Bugzilla attachment - attach the patch to the Bugzilla issue
* Email - again, not preferred, but you may send an email to the developer list
with a patch attached for review.
#### Waiting For Feedback
It may take a while for committers to review. Please be patient during this
time as all committers are volunteers on the project. If a significant amount
of time has lapsed since your submission, such as a couple of months, feel free
to either update your BZ, PR, or email the dev list with a message to bump your
issue. Sometimes things get lost in all the work and we need a reminder :smile:
## Style Guide
Apache Tomcat has very loosely defined coding conventions, but the following
guidelines will be useful:
* Use spaces for indenting, not tabs
* 100 char line width for Java source, 80 char line width for documentation
source (.txt, .xml)
* Java source: { at end of line, 4 space indents
* XML source: 2 space indents
## Did we miss something?
Have you reviewed this guide and found it lacking? Or are you confused about
some particular step? If so, please let us know! Or better yet, submit a PR to
address the issue :wink:
......@@ -614,3 +614,63 @@ QCuUl/v3Zly66jThcNS/U6S9VXBtQRxDZtkL8pSzmJxaFvvnZgkQ/hlvJ8f9ccS7
2/KQU94=
=yvcP
-----END PGP PUBLIC KEY BLOCK-----
pub rsa4096 2018-10-20 [SC]
7659 0809 9ACF 9270 2C7D 949B FA0C 35EA 8AA2 99F1
uid Konstantin Kolinko (CODE SIGNING KEY) <kkolinko@apache.org>
sig 3 FA0C35EA8AA299F1 2018-10-20 Konstantin Kolinko (CODE SIGNING KEY) <kkolinko@apache.org>
sub rsa4096 2018-10-20 [E]
sig FA0C35EA8AA299F1 2018-10-20 Konstantin Kolinko (CODE SIGNING KEY) <kkolinko@apache.org>
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
mSKqKZpUdvO77XQVYsjBAu3aMluPBNo=
=uK1p
-----END PGP PUBLIC KEY BLOCK-----
......@@ -725,10 +725,6 @@ For the following XML Schemas for Java EE Deployment Descriptors:
- web-app_3_1.xsd
- web-common_3_1.xsd
- web-fragment_3_1.xsd
- javaee_8.xsd
- web-app_4_0.xsd
- web-common_4_0.xsd
- web-fragment_4_0.xsd
COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
......
......@@ -22,51 +22,51 @@ ideal. These include:
- a large JAR where Tomcat only depends on a small fraction
SVN
===
For sources hosted in svn the approach is to svn copy the classes to the Tomcat
source tree, modify them (always with a package rename, sometimes with
additional changes) and then keep them in sync with the original via regular svn
merges. This file keeps track of these copies to assist committers in keeping
them up to date.
BCEL
org.apache.tomcat.util.bcel is copied from:
/commons/proper/bcel/trunk/src/main/java/org/apache/bcel
DBCP
org.apache.tomcat.dbcp.dbcp2 is copied from:
/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2
and
/commons/proper/dbcp/trunk/src/main/resources/org/apache/commons/dbcp2
org.apache.tomcat.dbcp.pool2 is copied from:
/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2
FileUpload
This used to be hosted in svn. All changes up to the point where FileUpload was
migrated to git have been merged.
Codec
org.apache.tomcat.util.codec is copied from:
/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/
Note: Only classes required for Base64 encoding/decoding. The rest are removed.
GIT
===
Updates from Git are applied manually via patch files. Patch files are generated
using:
git diff <last SHA1>:<sub-tree> HEAD:<sub-tree> > temp.patch
The more recently merged SHA1 for the component below should be updated after
The most recently merged SHA1 for the component below should be updated after
the patch file has been applied and committed
BCEL
----
Sub-tree:
src/main/java/org/apache/bcel
The SHA1 ID for the most recent commit to be merged to Tomcat is:
ff6941e4491c68f6eaf270ff03c1bc1e554c7b42 (2019-12-06)
Codec
-----
Sub-tree:
src/main/java/org/apache/commons/codec
The SHA1 ID for the most recent commit to be merged to Tomcat is:
9637dd44fa0e2d5a6ddb45791e3cd78298842d95 (2019-12-06)
Note: Only classes required for Base64 encoding/decoding. The rest are removed.
FileUpload
----------
Sub-tree:
src/main/java/org/apache/commons/fileupload
src/main/java/org/apache/commons/fileupload2
The SHA1 ID for the most recent commit to be merged to Tomcat is:
2317552993fd5180a84083d599b8cbdb05a07bab (2019-12-06)
Note: Tomcat's copy of fileupload also includes classes copied manually from
Commons IO.
DBCP
----
Pool2
Sub-tree
src/main/java/org/apache/commons/pool2
The SHA1 ID for the most recent commit to be merged to Tomcat is:
86b11bbc1437a12fa64bc1484c4edc0bdd5a0966
6092f924b36061353ff92b18c88400ab3bc05327 (2019-12-06)
Note: Tomcat's copy of fileupload also includes classes copied manually (rather
than svn copied) from Commons IO.
DBCP2
Sub-tree
src/main/java/org/apache/commons/dbcp2
src/main/resources/org/apache/commons/dbcp2
The SHA1 ID for the most recent commit to be merged to Tomcat is:
a363906bf7a039f79c07fa3c68b082a69ae035d7 (2019-12-06)
Apache Tomcat
Copyright 1999-2017 The Apache Software Foundation
Copyright 1999-2019 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
The Apache Software Foundation (https://www.apache.org/).
This software contains code derived from netty-native
developed by the Netty project
(http://netty.io, https://github.com/netty/netty-tcnative/)
(https://netty.io, https://github.com/netty/netty-tcnative/)
and from finagle-native developed at Twitter
(https://github.com/twitter/finagle).
......@@ -19,7 +19,7 @@ http://nsis.sourceforge.net.
Java compilation software for JSP pages is provided by the Eclipse
JDT Core Batch Compiler component, which is open source software.
The original software and related information is available at
http://www.eclipse.org/jdt/core/.
https://www.eclipse.org/jdt/core/.
For portions of the Tomcat JNI OpenSSL API and the OpenSSL JSSE integration
The org.apache.tomcat.jni and the org.apache.tomcat.net.openssl packages
......
## Welcome to Apache Tomcat!
### What Is It?
The Apache Tomcat® software is an open source implementation of the Java
Servlet, JavaServer Pages, Java Expression Language and Java WebSocket
technologies. The Java Servlet, JavaServer Pages, Java Expression Language and
Java WebSocket specifications are developed under the
[Java Community Process](https://jcp.org/en/introduction/overview).
The Apache Tomcat software is developed in an open and participatory
environment and released under the
[Apache License version 2](https://www.apache.org/licenses/). The Apache Tomcat
project is intended to be a collaboration of the best-of-breed developers from
around the world. We invite you to participate in this open development
project. To learn more about getting involved,
[click here](https://tomcat.apache.org/getinvolved.html) or keep reading.
Apache Tomcat software powers numerous large-scale, mission-critical web
applications across a diverse range of industries and organizations. Some of
these users and their stories are listed on the
[PoweredBy wiki page](https://wiki.apache.org/tomcat/PoweredBy).
Apache Tomcat, Tomcat, Apache, the Apache feather, and the Apache Tomcat
project logo are trademarks of the Apache Software Foundation.
### Get It
For every major Tomcat version there is one download page containing
links to the latest binary and source code downloads, but also
links for browsing the download directories and archives:
- [Tomcat 9](https://tomcat.apache.org/download-90.cgi)
- [Tomcat 8](https://tomcat.apache.org/download-80.cgi)
- [Tomcat 7](https://tomcat.apache.org/download-70.cgi)
To facilitate choosing the right major Tomcat version one, we have provided a
[version overview page](https://tomcat.apache.org/whichversion.html).
### Documentation
The documentation available as of the date of this release is
included in the docs webapp which ships with tomcat. You can access that webapp
by starting tomcat and visiting http://localhost:8080/docs/ in your browser.
The most up-to-date documentation for each version can be found at:
- [Tomcat 9](https://tomcat.apache.org/tomcat-9.0-doc/)
- [Tomcat 8](https://tomcat.apache.org/tomcat-8.5-doc/)
- [Tomcat 7](https://tomcat.apache.org/tomcat-7.0-doc/)
### Installation
Please see [RUNNING.txt](RUNNING.txt) for more info.
### Licensing
Please see [LICENSE](LICENSE) for more info.
### Support and Mailing List Information
* Free community support is available through the
[tomcat-users](https://tomcat.apache.org/lists.html#tomcat-users) email list and
a dedicated [IRC channel](https://tomcat.apache.org/irc.html) (#tomcat on
Freenode).
* If you want freely available support for running Apache Tomcat, please see the
resources page [here](https://tomcat.apache.org/findhelp.html).
* If you want to be informed about new code releases, bug fixes,
security fixes, general news and information about Apache Tomcat, please
subscribe to the
[tomcat-announce](https://tomcat.apache.org/lists.html#tomcat-announce) email
list.
* If you have a concrete bug report for Apache Tomcat, please see the
instructions for reporting a bug
[here](https://tomcat.apache.org/bugreport.html).
### Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for more info.
......@@ -38,7 +38,7 @@ CONTENTS:
===================
Dependency Changes:
===================
Tomcat @VERSION_MAJOR_MINOR@ is designed to run on Java SE 7 and later.
Tomcat @VERSION_MAJOR_MINOR@ is designed to run on Java @MIN_JAVA_VERSION@ and later.
==============
......@@ -85,7 +85,7 @@ for use by web applications (by placing them in "lib"):
* servlet-api.jar (Servlet 3.1 API)
* tomcat-api.jar (Interfaces shared by Catalina and Jasper)
* tomcat-coyote.jar (Tomcat connectors and utility classes)
* tomcat-dbcp.jar (package renamed database connection pool based on Commons DBCP)
* tomcat-dbcp.jar (package renamed database connection pool based on Commons DBCP 2)
* tomcat-jdbc.jar (Tomcat's database connection pooling solution)
* tomcat-jni.jar (Interface to the native component of the APR/native connector)
* tomcat-util.jar (Various utilities)
......@@ -98,7 +98,8 @@ or by placing them in JAR files in the "lib" directory.
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.
================================================================
......@@ -119,7 +120,7 @@ and putting them in the shared classloader instead (JARs should be put in the
Security manager URLs:
======================
In order to grant security permissions to JARs located inside the
web application repository, use URLs of of the following format
web application repository, use URLs of the following format
in your policy file:
file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar
......@@ -138,7 +139,7 @@ the check.
==============================
Viewing the Tomcat Change Log:
==============================
The full change log is available from http://tomcat.apache.org and is also
The full change log is available from https://tomcat.apache.org and is also
included in the documentation web application.
......@@ -174,4 +175,4 @@ software:
When all else fails:
====================
See the FAQ
http://tomcat.apache.org/faq/
https://tomcat.apache.org/faq/
......@@ -43,7 +43,7 @@ Running With JRE 7 Or Later
(2.1) Download a binary distribution of Tomcat from:
http://tomcat.apache.org/
https://tomcat.apache.org/
(2.2) Unpack the binary distribution so that it resides in its own
directory (conventionally named "apache-tomcat-[version]").
......@@ -157,7 +157,7 @@ create the following script file:
On Windows, %CATALINA_BASE%\bin\setenv.bat:
set "JRE_HOME=%ProgramFiles%\Java\jre7"
set "JRE_HOME=%ProgramFiles%\Java\jre@MIN_JAVA_VERSION@"
exit /b 0
On *nix, $CATALINA_BASE/bin/setenv.sh:
......@@ -203,7 +203,7 @@ launches Java directly and does not use the script files.
(4.3) Further information about configuring and running Tomcat can be found in
the documentation included here, as well as on the Tomcat web site:
http://tomcat.apache.org/
https://tomcat.apache.org/
(5) Shut Down Tomcat
......@@ -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
......@@ -387,32 +393,32 @@ For further reading:
* Documentation for APR/Native library in the Tomcat User's Guide
http://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/apr.html
https://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/apr.html
* Documentation for the HTTP and AJP protocol connectors in the Tomcat
Configuration Reference
http://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/config/http.html
https://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/config/http.html
http://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/config/ajp.html
https://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/config/ajp.html
- Apache Tomcat Native project home
http://tomcat.apache.org/native-doc/
https://tomcat.apache.org/native-doc/
- Other projects
* OpenSSL
http://openssl.org/
https://www.openssl.org/
* Apache Portable Runtime
http://apr.apache.org/
https://apr.apache.org/
* Apache HTTP Server
http://httpd.apache.org/
https://httpd.apache.org/
To disable Apache Tomcat Native library:
......@@ -443,17 +449,17 @@ For further reading:
- Apache Commons Daemon project
http://commons.apache.org/daemon/
https://commons.apache.org/daemon/
- Apache Tomcat documentation
* Installing Apache Tomcat
http://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/setup.html
https://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/setup.html
* Windows service HOW-TO
* Windows Service How-To
http://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/windows-service-howto.html
https://tomcat.apache.org/tomcat-@VERSION_MAJOR_MINOR@-doc/windows-service-howto.html
The binary files of Apache Commons Daemon in Apache Tomcat distributions
for Windows are named:
......
......@@ -17,6 +17,9 @@ rem limitations under the License.
rem ---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem For supported commands call "catalina.bat help" or see the usage section
rem towards the end of this file.
rem
rem Environment Variable Prerequisites
rem
rem Do not set the variables in this script. Instead put them into a script
......@@ -28,9 +31,8 @@ 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 Registry, and is most conveniently maintained using the "tomcat@VERSION_MAJOR@w.exe"
rem maintenance utility.
rem
rem CATALINA_HOME May point at your Catalina "build" directory.
rem
......@@ -63,6 +65,13 @@ rem should be used by Tomcat and also by the stop process,
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
......@@ -197,7 +206,7 @@ set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar"
:juliClasspathDone
if not "%JSSE_OPTS%" == "" goto gotJsseOpts
set JSSE_OPTS="-Djdk.tls.ephemeralDHKeySize=2048"
set "JSSE_OPTS=-Djdk.tls.ephemeralDHKeySize=2048"
:gotJsseOpts
set "JAVA_OPTS=%JAVA_OPTS% %JSSE_OPTS%"
......@@ -215,6 +224,24 @@ if not "%LOGGING_MANAGER%" == "" goto noJuliManager
set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
:noJuliManager
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.base/java.io=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%"
......@@ -331,17 +358,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
......@@ -18,6 +18,9 @@
# -----------------------------------------------------------------------------
# Control Script for the CATALINA Server
#
# For supported commands call "catalina.sh help" or see the usage section at
# the end of this file.
#
# Environment Variable Prerequisites
#
# Do not set the variables in this script. Instead put them into a script
......@@ -58,6 +61,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".
#
......@@ -221,7 +231,7 @@ fi
# Bugzilla 37848: When no TTY is available, don't output to console
have_tty=0
if [ "`tty`" != "not a tty" ]; then
if [ -t 0 ]; then
have_tty=1
fi
......@@ -233,6 +243,7 @@ if $cygwin; then
CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"`
CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$JAVA_ENDORSED_DIRS" ] && JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi
if [ -z "$JSSE_OPTS" ] ; then
......@@ -264,9 +275,20 @@ if [ -z "$UMASK" ]; then
fi
umask $UMASK
# 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`"
# 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
# Make the umask available when using the org.apache.catalina.security.SecurityListener
JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.security.SecurityListener.UMASK=`umask`"
if [ -z "$USE_NOHUP" ]; then
if $hpux; then
......@@ -277,9 +299,15 @@ if [ -z "$USE_NOHUP" ]; then
fi
unset _NOHUP
if [ "$USE_NOHUP" = "true" ]; then
_NOHUP=nohup
_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.base/java.io=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
......@@ -315,6 +343,10 @@ if [ "$1" = "jpda" ] ; then
shift
fi
# TODO: Bugzilla 63815
# This doesn't currently work (and can't be made to work) if values used in
# CATALINA_OPTS and/or JAVA_OPTS require quoting. See:
# https://bugs.openjdk.java.net/browse/JDK-8234808
if [ "$1" = "debug" ] ; then
if $os400; then
echo "Debug command not available on OS400"
......@@ -327,6 +359,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 \
......@@ -337,6 +370,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" \
......@@ -354,7 +388,8 @@ elif [ "$1" = "run" ]; then
echo "Using Security Manager"
fi
shift
eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
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\"" \
......@@ -363,7 +398,8 @@ elif [ "$1" = "run" ]; then
-Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
org.apache.catalina.startup.Bootstrap "$@" start
else
eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
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\"" \
......@@ -420,7 +456,8 @@ elif [ "$1" = "start" ] ; then
echo "Using Security Manager"
fi
shift
eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
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\"" \
......@@ -431,7 +468,8 @@ elif [ "$1" = "start" ] ; then
>> "$CATALINA_OUT" 2>&1 "&"
else
eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
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\"" \
......@@ -471,7 +509,7 @@ elif [ "$1" = "stop" ] ; then
if [ -s "$CATALINA_PID" ]; then
kill -0 `cat "$CATALINA_PID"` >/dev/null 2>&1
if [ $? -gt 0 ]; then
echo "PID file found but no matching process was found. Stop aborted."
echo "PID file found but either no matching process was found or the current user does not have permission to stop the process. Stop aborted."
exit 1
fi
else
......@@ -483,7 +521,8 @@ elif [ "$1" = "stop" ] ; then
fi
fi
eval "\"$_RUNJAVA\"" $JAVA_OPTS \
eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
-D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
-classpath "\"$CLASSPATH\"" \
-Dcatalina.base="\"$CATALINA_BASE\"" \
-Dcatalina.home="\"$CATALINA_HOME\"" \
......@@ -569,7 +608,8 @@ elif [ "$1" = "stop" ] ; then
elif [ "$1" = "configtest" ] ; then
eval "\"$_RUNJAVA\"" $LOGGING_MANAGER $JAVA_OPTS \
eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
-D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
-classpath "\"$CLASSPATH\"" \
-Dcatalina.base="\"$CATALINA_BASE\"" \
-Dcatalina.home="\"$CATALINA_HOME\"" \
......
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem ---------------------------------------------------------------------------
rem Script to digest password using the algorithm specified
rem ---------------------------------------------------------------------------
setlocal
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
set "EXECUTABLE=%CATALINA_HOME%\bin\tool-wrapper.bat"
rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs
call "%EXECUTABLE%" org.apache.tomcat.util.net.openssl.ciphers.OpenSSLCipherConfigurationParser %CMD_LINE_ARGS%
:end
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------------
# Script to digest password using the algorithm specified
# -----------------------------------------------------------------------------
# Better OS/400 detection: see Bugzilla 31132
os400=false
case "`uname`" in
OS400*) os400=true;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
PRGDIR=`dirname "$PRG"`
EXECUTABLE=tool-wrapper.sh
# Check that target executable exists
if $os400; then
# -x will Only work on the os400 if the files are:
# 1. owned by the user
# 2. owned by the PRIMARY group of the user
# this will not work if the user belongs in secondary groups
eval
else
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
exit 1
fi
fi
exec "$PRGDIR"/"$EXECUTABLE" org.apache.tomcat.util.net.openssl.ciphers.OpenSSLCipherConfigurationParser "$@"
......@@ -18,20 +18,22 @@
# -----------------------------------------------------------------------------
# Commons Daemon wrapper script.
# -----------------------------------------------------------------------------
#
# resolve links - $0 may be a softlink
ARG0="$0"
while [ -h "$ARG0" ]; do
ls=`ls -ld "$ARG0"`
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
ARG0="$link"
PRG="$link"
else
ARG0="`dirname $ARG0`/$link"
PRG=`dirname "$PRG"`/"$link"
fi
done
DIRNAME="`dirname $ARG0`"
PROGRAM="`basename $ARG0`"
DIRNAME="`dirname "$PRG"`"
PROGRAM="`basename "$PRG"`"
while [ ".$1" != . ]
do
case "$1" in
......@@ -94,7 +96,16 @@ test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat
#
if [ -z "$JAVA_HOME" ]; then
JAVA_BIN="`which java 2>/dev/null || type java 2>&1`"
test -x "$JAVA_BIN" && JAVA_HOME="`dirname $JAVA_BIN`"
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
JAVA_BIN="$JAVA_HOME/bin/java"
......@@ -125,7 +136,7 @@ elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
fi
# Add on extra jar files to CLASSPATH
test ".$CLASSPATH" != . && CLASSPATH="${CLASSPATH}:"
test ".$CLASSPATH" != . && CLASSPATH="$CLASSPATH:"
CLASSPATH="$CLASSPATH$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar"
test ".$CATALINA_OUT" = . && CATALINA_OUT="$CATALINA_BASE/logs/catalina-daemon.out"
......@@ -159,7 +170,7 @@ if [ "$cygwin" = "false" ]; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ "$?" -eq 0 ]; then
# Darwin does not allow RLIMIT_INFINITY on file soft limit
if [ "$darwin" = "true" -a "$MAX_FD_LIMIT" = "unlimited" ]; then
if [ "$darwin" = "true" ] && [ "$MAX_FD_LIMIT" = "unlimited" ]; then
MAX_FD_LIMIT=`/usr/sbin/sysctl -n kern.maxfilesperproc`
fi
test ".$MAX_FD" = ".maximum" && MAX_FD="$MAX_FD_LIMIT"
......@@ -172,50 +183,67 @@ 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 )
shift
"$JSVC" $* \
$JSVC_OPTS \
-java-home "$JAVA_HOME" \
-pidfile "$CATALINA_PID" \
-wait "$SERVICE_START_WAIT_TIME" \
eval exec "\"$JSVC\"" $* \
"$JSVC_OPTS" \
-java-home "\"$JAVA_HOME\"" \
-pidfile "\"$CATALINA_PID\"" \
-wait $SERVICE_START_WAIT_TIME \
-nodetach \
-outfile "&1" \
-errfile "&2" \
-classpath "$CLASSPATH" \
"$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMP" \
-outfile "\"&1\"" \
-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\"" \
$CATALINA_MAIN
exit $?
;;
start )
"$JSVC" $JSVC_OPTS \
-java-home "$JAVA_HOME" \
eval "\"$JSVC\"" \
"$JSVC_OPTS" \
-java-home "\"$JAVA_HOME\"" \
-user $TOMCAT_USER \
-pidfile "$CATALINA_PID" \
-wait "$SERVICE_START_WAIT_TIME" \
-outfile "$CATALINA_OUT" \
-errfile "&1" \
-classpath "$CLASSPATH" \
"$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMP" \
-pidfile "\"$CATALINA_PID\"" \
-wait $SERVICE_START_WAIT_TIME \
-outfile "\"$CATALINA_OUT\"" \
-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\"" \
$CATALINA_MAIN
exit $?
;;
stop )
"$JSVC" $JSVC_OPTS \
eval "\"$JSVC\"" \
"$JSVC_OPTS" \
-stop \
-pidfile "$CATALINA_PID" \
-classpath "$CLASSPATH" \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMP" \
-pidfile "\"$CATALINA_PID\"" \
-classpath "\"$CLASSPATH\"" \
-D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
-Dcatalina.base="\"$CATALINA_BASE\"" \
-Dcatalina.home="\"$CATALINA_HOME\"" \
-Djava.io.tmpdir="\"$CATALINA_TMP\"" \
$CATALINA_MAIN
exit $?
;;
......@@ -236,7 +264,7 @@ case "$1" in
exit $?
;;
* )
echo "Unknown command: \`$1'"
echo "Unknown command: '$1'"
echo "Usage: $PROGRAM ( commands ... )"
echo "commands:"
echo " run Start Tomcat without detaching from console"
......
......@@ -17,33 +17,91 @@ rem limitations under the License.
rem ---------------------------------------------------------------------------
rem NT Service Install/Uninstall script
rem
rem Usage: service.bat install/remove [service_name [--rename]] [--user username]
rem
rem Options
rem install Install the service using Tomcat@VERSION_MAJOR@ as service name.
rem Service is installed using default settings.
rem remove Remove the service from the System.
rem install Install the service using default settings.
rem remove Remove the service from the system.
rem
rem service_name (optional) The name to use for the service. If not specified,
rem Tomcat@VERSION_MAJOR@ is used as the service name.
rem
rem name (optional) If the second argument is present it is considered
rem to be new service name
rem --rename (optional) Rename tomcat@VERSION_MAJOR@.exe and tomcat@VERSION_MAJOR@w.exe to match
rem the non-default service name.
rem
rem username (optional) The name of the OS user to use to install/remove
rem the service (not the name of the OS user the
rem service will run as). If not specified, the current
rem user is used.
rem ---------------------------------------------------------------------------
setlocal
set "SELF=%~dp0%service.bat"
rem Guess CATALINA_HOME if not defined
set DEFAULT_SERVICE_NAME=Tomcat@VERSION_MAJOR@
set SERVICE_NAME=%DEFAULT_SERVICE_NAME%
set "CURRENT_DIR=%cd%"
rem Parse the arguments
if "x%1x" == "xx" goto displayUsage
set SERVICE_CMD=%1
shift
if "x%1x" == "xx" goto checkEnv
:checkUser
if "x%1x" == "x/userx" goto runAsUser
if "x%1x" == "x--userx" goto runAsUser
set SERVICE_NAME=%1
shift
if "x%1x" == "xx" goto checkEnv
if "x%1x" == "x--renamex" (
set RENAME=%1
shift
)
if "x%1x" == "xx" goto checkEnv
goto checkUser
:runAsUser
shift
if "x%1x" == "xx" goto displayUsage
set SERVICE_USER=%1
shift
runas /env /savecred /user:%SERVICE_USER% "%COMSPEC% /K \"%SELF%\" %SERVICE_CMD% %SERVICE_NAME%"
goto end
rem Check the environment
:checkEnv
rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%cd%"
if exist "%CATALINA_HOME%\bin\tomcat@VERSION_MAJOR@.exe" goto okHome
if exist "%CATALINA_HOME%\bin\%DEFAULT_SERVICE_NAME%.exe" goto okHome
if exist "%CATALINA_HOME%\bin\%SERVICE_NAME%.exe" goto okHome
rem CD to the upper dir
cd ..
set "CATALINA_HOME=%cd%"
:gotHome
if exist "%CATALINA_HOME%\bin\tomcat@VERSION_MAJOR@.exe" goto okHome
echo The tomcat@VERSION_MAJOR@.exe was not found...
echo The CATALINA_HOME environment variable is not defined correctly.
echo This environment variable is needed to run this program
if exist "%CATALINA_HOME%\bin\%DEFAULT_SERVICE_NAME%.exe" (
set "EXECUTABLE=%CATALINA_HOME%\bin\%DEFAULT_SERVICE_NAME%.exe"
goto okHome
)
if exist "%CATALINA_HOME%\bin\%SERVICE_NAME%.exe" (
set "EXECUTABLE=%CATALINA_HOME%\bin\%SERVICE_NAME%.exe"
goto okHome
)
if "%DEFAULT_SERVICE_NAME%"== "%SERVICE_NAME%" (
echo The file %DEFAULT_SERVICE_NAME%.exe was not found...
) else (
echo Neither the %DEFAULT_SERVICE_NAME%.exe file nor the %SERVICE_NAME%.exe file was found...
)
echo Either the CATALINA_HOME environment variable is not defined correctly or
echo the incorrect service name has been used.
echo Both the CATALINA_HOME environment variable and the correct service name
echo are required to run this program.
goto end
:okHome
cd "%CURRENT_DIR%"
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJdkHome
if not "%JRE_HOME%" == "" goto gotJreHome
......@@ -52,12 +110,16 @@ echo Service will try to guess them from the registry.
goto okJavaHome
:gotJreHome
if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome
goto okJavaHome
:gotJdkHome
if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\jre\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
rem Java 9 has a different directory structure
if exist "%JAVA_HOME%\jre\bin\java.exe" goto preJava9Layout
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%"
goto okJavaHome
:preJava9Layout
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%\jre"
goto okJavaHome
......@@ -71,39 +133,27 @@ if not "%CATALINA_BASE%" == "" goto gotBase
set "CATALINA_BASE=%CATALINA_HOME%"
:gotBase
set "EXECUTABLE=%CATALINA_HOME%\bin\tomcat@VERSION_MAJOR@.exe"
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
if "x%1x" == "xx" goto checkServiceCmd
:checkUser
if "x%1x" == "x/userx" goto runAsUser
if "x%1x" == "x--userx" goto runAsUser
set SERVICE_NAME=%1
set DISPLAYNAME=Apache Tomcat @VERSION_MAJOR_MINOR@ %1
shift
if "x%1x" == "xx" goto checkServiceCmd
goto checkUser
:runAsUser
shift
if "x%1x" == "xx" goto displayUsage
set SERVICE_USER=%1
shift
runas /env /savecred /user:%SERVICE_USER% "%COMSPEC% /K \"%SELF%\" %SERVICE_CMD% %SERVICE_NAME%"
goto end
:checkServiceCmd
rem Process the requested command
if /i %SERVICE_CMD% == install goto doInstall
if /i %SERVICE_CMD% == remove goto doRemove
if /i %SERVICE_CMD% == uninstall goto doRemove
echo Unknown parameter "%SERVICE_CMD%"
:displayUsage
echo.
echo Usage: service.bat install/remove [service_name] [/user username]
echo Usage: service.bat install/remove [service_name [--rename]] [--user username]
goto end
:doRemove
......@@ -118,6 +168,10 @@ echo Failed removing '%SERVICE_NAME%' service
goto end
:removed
echo The service '%SERVICE_NAME%' has been removed
if exist "%CATALINA_HOME%\bin\%SERVICE_NAME%.exe" (
rename "%SERVICE_NAME%.exe" "%DEFAULT_SERVICE_NAME%.exe"
rename "%SERVICE_NAME%w.exe" "%DEFAULT_SERVICE_NAME%w.exe"
)
goto end
:doInstall
......@@ -146,9 +200,17 @@ if "%SERVICE_STARTUP_MODE%" == "" set SERVICE_STARTUP_MODE=manual
if "%JvmMs%" == "" set JvmMs=128
if "%JvmMx%" == "" set JvmMx=256
if exist "%CATALINA_HOME%\bin\%DEFAULT_SERVICE_NAME%.exe" (
if "x%RENAME%x" == "x--renamex" (
rename "%DEFAULT_SERVICE_NAME%.exe" "%SERVICE_NAME%.exe"
rename "%DEFAULT_SERVICE_NAME%w.exe" "%SERVICE_NAME%w.exe"
set "EXECUTABLE=%CATALINA_HOME%\bin\%SERVICE_NAME%.exe"
)
)
"%EXECUTABLE%" //IS//%SERVICE_NAME% ^
--Description "Apache Tomcat @VERSION@ Server - http://tomcat.apache.org/" ^
--DisplayName "%DISPLAYNAME%" ^
--Description "Apache Tomcat @VERSION@ Server - https://tomcat.apache.org/" ^
--DisplayName "Apache Tomcat @VERSION_MAJOR_MINOR@ %SERVICE_NAME%" ^
--Install "%EXECUTABLE%" ^
--LogPath "%CATALINA_BASE%\logs" ^
--StdOutput auto ^
......@@ -163,7 +225,8 @@ 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%" ^
--JvmOptions9 "--add-opens=java.base/java.lang=ALL-UNNAMED#--add-opens=java.base/java.io=ALL-UNNAMED#--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED" ^
--Startup "%SERVICE_STARTUP_MODE%" ^
--JvmMs "%JvmMs%" ^
--JvmMx "%JvmMx%"
......@@ -174,4 +237,3 @@ goto end
echo The service '%SERVICE_NAME%' has been installed.
:end
cd "%CURRENT_DIR%"
......@@ -15,8 +15,9 @@ rem See the License for the specific language governing permissions and
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
......@@ -35,7 +36,6 @@ goto exit
rem Check if we have a usable JDK
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
set "JRE_HOME=%JAVA_HOME%"
......@@ -54,7 +54,6 @@ set "JRE_HOME=%JAVA_HOME%"
:gotJreHome
rem Check if we have a usable JRE
if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome
if not exist "%JRE_HOME%\bin\javaw.exe" goto noJreHome
goto okJava
:noJreHome
......@@ -64,6 +63,14 @@ echo This environment variable is needed to run this program
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
......
......@@ -16,12 +16,13 @@
# 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
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
if [ -z "$JAVA_HOME" ] && [ -z "$JRE_HOME" ]; then
if $darwin; then
# Bugzilla 54390
if [ -x '/usr/libexec/java_home' ] ; then
......@@ -33,8 +34,8 @@ if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
else
JAVA_PATH=`which java 2>/dev/null`
if [ "x$JAVA_PATH" != "x" ]; then
JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null`
JRE_HOME=`dirname $JAVA_PATH 2>/dev/null`
JAVA_PATH=`dirname "$JAVA_PATH" 2>/dev/null`
JRE_HOME=`dirname "$JAVA_PATH" 2>/dev/null`
fi
if [ "x$JRE_HOME" = "x" ]; then
# XXX: Should we try other locations?
......@@ -43,13 +44,13 @@ if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
fi
fi
fi
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
if [ -z "$JAVA_HOME" ] && [ -z "$JRE_HOME" ]; then
echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
echo "At least one of these environment variable is needed to run this program"
exit 1
fi
fi
if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then
echo "JAVA_HOME should point to a JDK in order to run in debug mode."
exit 1
fi
......@@ -60,14 +61,14 @@ fi
# If we're running under jdb, we need a full jdk.
if [ "$1" = "debug" ] ; then
if [ "$os400" = "true" ]; then
if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
exit 1
fi
else
if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/jdb ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
......@@ -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
......
......@@ -31,6 +31,13 @@ rem Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
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%\bin\bootstrap.jar;%CATALINA_HOME%\bin\
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
......@@ -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,13 +127,27 @@ if $cygwin; then
JRE_HOME=`cygpath --absolute --windows "$JRE_HOME"`
CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$JAVA_ENDORSED_DIRS" ] && 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 \
-classpath "$CLASSPATH" \
-Dcatalina.home="$CATALINA_HOME" \
eval exec "\"$_RUNJAVA\"" "$JAVA_OPTS" "$TOOL_OPTS" \
-D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
-classpath "\"$CLASSPATH\"" \
-Dcatalina.home="\"$CATALINA_HOME\"" \
org.apache.catalina.startup.Tool "$@"