Classpath Tomcat
The issue I'm having is that from what I've gleaned from the web all I.should. need in my classpath for my main method is my main class, tomcat-embed-core.jar, tomcat-embed-logging.juli.jar, tomcat-embed-jasper.jar, and ecj.jar but I'm finding that when trying to launch my main from the command line I keep having to append more and more jars. Tomcat8w is a GUI application for monitoring and configuring Tomcat services. The available command line options are.Classpath: Set the Java classpath. Classpath of Tomcat in Idea? My web application refuse to run because the the tools.jar is not found. Have put it in the WEB-INF/lib of my Web application but it still not work. In Eclipse for example i put these jar files in the JVM classpath of. Tomcat eclipse plugin.
This chapter contains information about configuring Tomcat to support your WebCenter Sites web application.
This chapter contains the following sections:
4.1 Quick Reference for Setting Up Tomcat Application Server
This section contains the following topics:
4.1.1 Summary of Steps
You will complete the steps below as necessary for your requirements for each environment: development, content management, and delivery.
Step 1: Configuring Tomcat Application Server
Modify the default Tomcat ports as shown in Section 4.2.1, 'Modifying Tomcat Server Ports.'
Create and configure a data source as shown in Section 4.2.2, 'Creating and Configuring a Data Source.'
Set Java options as described in Section 4.2.3, 'Setting Java Options.'
Set the classpath as described in Section 4.2.4, 'Setting the Classpath.'
Set the URI encoding character set, as described in Section 4.2.5, 'Configuring URI Encoding.'
If the server is a part of a multi-server environment, set the
jvmRoute
attribute as described in Section 4.2.7, 'Configuring a Tomcat Server for Load Balancing.'If the Tomcat server is part of a cluster environment, configure the server for clustering as described in Section 4.2.8, 'Configuring a Tomcat Server for Clustering.'
If the server will be running over SSL, configure the Tomcat server for SSL as described in Section 4.2.9, 'Configuring a Tomcat Server for SSL.'
Step 2: Integrating Tomcat Application Server with a Supported Web Server
This step is required if:
You are creating a clustered environment that will be load balanced through Apache Web Server.
You wish to place an apache WebServer in front of Tomcat.
Steps for integrating Tomcat with Apache Web Server are given in Section 4.3, 'Step 2: Integrating Tomcat Application Server with a Supported Web Server.'
4.1.2 Paths and Directories Used in This Chapter
Table 4-1 lists the paths and directories used in this chapter.
Table 4-1 Paths and Directories Used in Configuring Tomcat Application Server
Name | Description |
---|---|
| Path to the WebCenter Sites installation directory. |
| Path to the Tomcat installation directory. |
| Path to the shared folder on the given system. The path includes the name of the shared folder. |
4.1.3 Start/Stop Commands for Tomcat
This section lists commands for starting and stopping Tomcat instances.
Note:
All commands require thatCATALINA_HOME
and JAVA_HOME
are set to the proper directories.To start the Tomcat instance
Run the following command:
In UNIX:
In Windows:
To stop the Tomcat instance
Run the following command:
In UNIX:
In Windows:
4.2 Step 1: Configuring Tomcat Application Server
In this section, you will complete the following steps:
Note:
Procedures in this section use UNIX commands.4.2.1 Modifying Tomcat Server Ports
This section explains how to modify the default ports used by Tomcat. In order to run more than one Tomcat server on the same physical server, these ports must be changed to avoid port conflicts.
Shutdown the Tomcat server.
Open the
<tomcat_home>/conf/server.xml
file in a text editor and modify the following ports:Shutdown port (default
8005
)This port is used when shutting down the Tomcat server.
HTTP port (default
8080
)This is the main port from which web applications will be accessible.
Redirect port (default
8443
)This port needs to be modified in both the HTTP and AJP connectors.
AJP port (default
8009
)This port can be used for communicating with an Apache web server.
(SSL only) SSL HTTP port (default
8443
)If you will be using SSL, change this port to the same value used in step 2.
Save the changes.
4.2.2 Creating and Configuring a Data Source
Choose the data source information that corresponds to the database you will be using and place the required JAR files in the
<tomcat_home>/lib
directory. Data source information in Table 4-2 will be used to create the data source in the next step.Table 4-2 Data Source Information
Database Driver Parameters Values JTDS (third-party driver)
DriverClass
Required
.jar
filesURL
net.sourceforge.jtds.jdbcx.JtdsDataSource
jtds-1.2.5 jar
jdbc:jtds:sqlserver://
<server>
:
<dbport>
/
<dbname>
Example:
jdbc:jtds:sqlserver://
127.0.0.1:1433/contentDB
DB2
DriverClass
Required
.jar
filesURL
com.ibm.db2.jcc.DB2Driver
db2jcc.jar, db2cc_license_cu.jar
Note: The
db2jcc4.jar
file is not supported. Installation will fail if thedb2jcc4.jar
file is used.jdbc:db2://
<hostname>
:
<dbport>
/
<dbname>
Example:
jdbc:db2://127.0.0.1:50001/contentDB
Oracle Thin driver
DriverClass
Required
.jar
filesURL
oracle.jdbc.driver.OracleDriver
ojdbc6.jar
jdbc:oracle:thin:@//
<hostname>
:1521/
<dbname>
Example:
jdbc:oracle:thin:@//127.0.0.1:1521/contentDB
Open the
<tomcat_home>/conf/server.xml
file in a text editor and add the following XML code inside theHost
tag, replacing any parameterized values:Sample data source for an Oracle Database:
Note:
In the example above the maximum allowed database connections is set to100
. While this is the recommended value, it may be changed depending on environment requirements.Save the changes.
4.2.3 Setting Java Options
This section explains how to set memory arguments as well as add Java options required by WebCenter Sites.
Open <
tomcat_home>/bin/setenv.sh
in a text editor and add the lineCATALINA_OPTS='<java_opts>'
where<java_opts>
is a space-separated list of the following options:-Xms2048m -Xmx16834m
These options set the minimum and maximum memory heap sizes. These are recommended sizes, but may be changed depending on environment requirements.
-XX:MaxPermSize=192m
This option sets the maximum size of the permanent generation space. This is the recommended size, but may be changed depending on environment requirements.
-Dfile.encoding=UTF-8
This option specifies UTF-8 file encoding.
-Dnet.sf.ehcache.enableShutdownHook=true
This option enables the
Ehcache
shutdown hook.-Djava.net.preferIPv4Stack=true
This option specifies the use of IPv4 addresses.
-Duser.timezone=UTC
This option is used to set the time zone for the JVM. It is recommended to set the value to
UTC
across all WebCenter Sites installations. However, you can set any preferable time zone as long as this value is the same for all WebCenter Sites installations. So, the completeCATALINA_OPTS
should look like:Note:
IfShift-JIS
characters will be used, add the following option:-Dcs.useJavaURLDecoder=false
Save the changes.
4.2.4 Setting the Classpath
This section explains how to add paths required by WebCenter Sites to the application server classpath.
Open
<tomcat_home>/bin/setenv.sh
in a text editor and add the following line:CLASSPATH='<paths>'
where<paths>
is a colon (:) separated list of the following paths:<sites_install_dir>/bin
This path contains the required WebCenter Sites and CAS configuration files. Without this file, the CAS web application will not start and the System Tools node in the Admin tab of the WebCenter Sites Admin interface will have reduced functionality.
$JAVA_HOME/lib/tools.jar
This JAR file is located in the JDK.
Save the changes.
4.2.5 Configuring URI Encoding
This section explains how to set the character set for URI encoding to UTF-8.
Open
<tomcat_home>/conf/server.xml
in a text editor and add theURIEncoding
attribute to theHTTP Connector
tag as follows:Save the changes.

4.2.6 Configuring AJP Connectors
This section explains how to set encoding configuration for one or both HTTP and AJP connectors on the application server.
Ensure all the language and file encoding configuration parameters are set to be UTF-8 throughout the entire infrastructure for multilingual and special character recognition.
This includes the db, system variables, futuretense.ini file and the connectors as defined in the application server -including the AJP connector as needed, described in the Oracle Fusion Middleware Online Documentation Library 11g Release 1 (11.1.1.8) for WebCenter Sites installation and administration guides.
The above circumstance (Tomcat also using Apache webserver) was resolved by the following:
Add
URIEncoding='UTF-8'
in the HTTP and AJP Connectors in$CATALINA_BASE/conf/server.xml.
Tomcat Classpath Order
4.2.7 Configuring a Tomcat Server for Load Balancing
This section explains how to configure a Tomcat server so that it may be a part of a load balancing environment.
Open
<tomcat_home>/conf/server.xml
in a text editor and add thejvmRoute
attribute to theEngine
tag as follows:Modify the value of
jvmRoute
so that it is unique from all other Tomcat servers that will be load balanced.Save the changes.
4.2.8 Configuring a Tomcat Server for Clustering
This section explains how to configure a Tomcat server to be part of a cluster.

Open
<tomcat_home>/conf/server.xml
in a text editor and add the following XML code as the first thing inside theEngine
tag:Modify the Membership address or port as necessary:
Each cluster must have a unique Membership address/port combination to avoid message conflicts.
All members of a cluster must have the same values for Membership address and port.
Modify the Receiver port or
autoBind
as necessary.The receiver will automatically avoid port conflicts between port and port plus
autoBind
by binding to a free port. Modify either of these values as necessary to restrict the range of ports the receiver will use.Save the changes.
4.2.9 Configuring a Tomcat Server for SSL
Generate a certificate:
Set the
-keystore
parameter to the location where you want the generated keys to be stored.When prompted for the keystore password, you may use your own password, or the default
changeit
. If a custom password is entered, a value in theserver.xml
file will need to be changed (as explained in step 2).Enter your first and last name, name of organization, city, state, and country code when prompted, then click Yes to confirm.
At the next prompt, 'Enter key password for
<tomcat>
(RETURN if same as keystore password),' press Enter, as the key password must be the same as the keystore password.
Edit <
tomcat_home>/conf/server.xml
, uncomment the SSL section, and add the following attributes to the SSL connector:keystoreType='JKS'
This attribute is set to JKS for Java Keystore (the format produced by Java's keytool).
keystoreFile='
<tomcat_home>
/keys/.keystore'
This attribute is set to the path where the
.keystore
file was created and the same path used in step 1.keystorePass='<new_password>'
This attribute is needed only if the keystore password used in step 1 is not
changeit
, and should be set to the custom password used.
Save the changes.
After starting the server, point your browser to
https://<tomcat_host>:<ssl_port>
.If your system works correctly, you will be prompted to accept the certificate. When you accept the certificate, the Tomcat index page is displayed.
4.3 Step 2: Integrating Tomcat Application Server with a Supported Web Server
This section provides guidelines for integrating Tomcat Server with your choice of supported web servers.
4.3.1 Configuring Apache HTTP Server
This section explains how to configure Apache 2.2.x or Apache 2.4.x HTTP server with the mod_proxy_ajp
plugin to use this plugin with Tomcat.
Ensure that
mod_so.c
is enabled. Run<apache_home>/bin/apachectl -l
. Ifmod_so.c
is not in the list that is printed, you must rebuild your Apache with the-enable-module=so
option.Open
<apache_home>/config/httpd.conf
in a text editor and add the following at the end of the file:Single Server Environment
Multi Server Environment
Note:
In this example, the balancer-manager allows all access. For increased security you may want to modify the values of 'Deny from' and 'Allow from' using the Apache documentation as reference.If you will be installing the AVI Sports sample site, add
timeout=180
at the end of eachBalancerMember
line.Save the changes.
Verify the syntax of the
httpd.conf
file with the following command:<apache_home>/bin/apachectl -t
Restart the web server.
This section explains how to use the PATH
and CLASSPATH
environment variables on Microsoft Windows, Solaris, and Linux. Consult the installation instructions included with your installation of the Java Development Kit (JDK) software bundle for current information.
After installing the software, the JDK directory will have the structure shown below.
The bin
directory contains both the compiler and the launcher.
Update the PATH Environment Variable (Microsoft Windows)
You can run Java applications just fine without setting the PATH
environment variable. Or, you can optionally set it as a convenience.
Set the PATH
environment variable if you want to be able to conveniently run the executables (javac.exe
, java.exe
, javadoc.exe
, and so on) from any directory without having to type the full path of the command. If you do not set the PATH
variable, you need to specify the full path to the executable every time you run it, such as:
The PATH
environment variable is a series of directories separated by semicolons (;
). Microsoft Windows looks for programs in the PATH
directories in order, from left to right. You should have only one bin
directory for the JDK in the path at a time (those following the first are ignored), so if one is already present, you can update that particular entry.
The following is an example of a PATH
environment variable:
It is useful to set the PATH
environment variable permanently so it will persist after rebooting. To make a permanent change to the PATH
variable, use the System icon in the Control Panel. The precise procedure varies depending on the version of Windows:
- Select Start, select Control Panel. double click System, and select the Advanced tab.
- Click Environment Variables. In the section System Variables, find the
PATH
environment variable and select it. Click Edit. If thePATH
environment variable does not exist, clickNew
. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATH
environment variable. Click OK. Close all remaining windows by clicking OK.
- From the desktop, right click the My Computer icon.
- Choose Properties from the context menu.
- Click the Advanced tab (Advanced system settings link in Vista).
- Click Environment Variables. In the section System Variables, find the
PATH
environment variable and select it. Click Edit. If thePATH
environment variable does not exist, clickNew
. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATH
environment variable. Click OK. Close all remaining windows by clicking OK.
- From the desktop, right click the Computer icon.
- Choose Properties from the context menu.
- Click the Advanced system settings link.
- Click Environment Variables. In the section System Variables, find the
PATH
environment variable and select it. Click Edit. If thePATH
environment variable does not exist, clickNew
. - In the Edit System Variable (or New System Variable) window, specify the value of the
PATH
environment variable. Click OK. Close all remaining windows by clicking OK.
PATH
environment variable similar to the following when editing it from the Control Panel:Variables enclosed in percentage signs (%
) are existing environment variables. If one of these variables is listed in the Environment Variables window from the Control Panel (such as JAVA_HOME
), then you can edit its value. If it does not appear, then it is a special environment variable that the operating system has defined. For example, SystemRoot
is the location of the Microsoft Windows system folder. To obtain the value of a environment variable, enter the following at a command prompt. (This example obtains the value of the SystemRoot
environment variable):Update the PATH Variable (Solaris and Linux)
You can run the JDK just fine without setting the PATH
variable, or you can optionally set it as a convenience. However, you should set the path variable if you want to be able to run the executables (javac
, java
, javadoc
, and so on) from any directory without having to type the full path of the command. If you do not set the PATH
variable, you need to specify the full path to the executable every time you run it, such as:
To find out if the path is properly set, execute:
This will print the version of the java
tool, if it can find it. If the version is old or you get the error java: Command not found, then the path is not properly set.
To set the path permanently, set the path in your startup file.
For C shell (csh
), edit the startup file (~/.cshrc
):
For bash
, edit the startup file (~/.bashrc
):
For ksh
, the startup file is named by the environment variable, ENV
. To set the path:
For sh
, edit the profile file (~/.profile
):
Then load the startup file and verify that the path is set by repeating the java
command:
For C shell (csh
):
Classpath For Tomcat
For ksh
, bash
, or sh
:
Checking the CLASSPATH variable (All platforms)
The CLASSPATH
variable is one way to tell applications, including the JDK tools, where to look for user classes. (Classes that are part of the JRE, JDK platform, and extensions should be defined through other means, such as the bootstrap class path or the extensions directory.)
The preferred way to specify the class path is by using the -cp
command line switch. This allows the CLASSPATH
to be set individually for each application without affecting other applications. Setting the CLASSPATH
can be tricky and should be performed with care.
The default value of the class path is '.', meaning that only the current directory is searched. Specifying either the CLASSPATH variable or the -cp
command line switch overrides this value.
To check whether CLASSPATH
is set on Microsoft Windows NT/2000/XP, execute the following:
On Solaris or Linux, execute the following:
If CLASSPATH
is not set you will get a CLASSPATH: Undefined variable error (Solaris or Linux) or simply %CLASSPATH% (Microsoft Windows NT/2000/XP).
To modify the CLASSPATH
, use the same procedure you used for the PATH
variable.
Class path wildcards allow you to include an entire directory of .jar
files in the class path without explicitly naming them individually. For more information, including an explanation of class path wildcards, and a detailed description on how to clean up the CLASSPATH
environment variable, see theSetting the Class Path technical note.