Sei sulla pagina 1di 13



1.) Installing J2SDK

J2SDK is the Java 2 Software Development Kit from Sun Microsystems. It contains a Java run-time environment, Java compiler and various utilities.
1. Download J2SDK. Download from here: Get the SDK version packaged as a self extracting archive. It will be named something like jdk-1_5_0_03-linux-i586.bin. Download the file. 2. Install J2SDK.

cp jdk-1_5_0_03-linux-i586.bin cd /opt/local/


chmod 755 jdk-1_5_0_03-linux-i586.bin ./ jdk-1_5_0_03-linux-i586.bin

Copy the binary file to /opt/local, run the self extracting installer. The result will be to install the J2SDK to /opt/local/

3. Setup JAVA_HOME environment variable.

setenv JAVA_HOME /opt/local/jdk1.5.0_03

4. Verify that JAVA_HOME is set.

Run the following command:


The output should be:


Nothing else will work right if JAVA_HOME is not set properly so verify and repeat the above steps until it works correctly. Note: If you already have a tomcat account please set a java home environment to its profile in order to run tomcat application properly.

2. Installing Tomcat

1. Download a binary distribution of Tomcat from the Apache website 2. Create a user account for tomcat and its group account .

groupadd -g 220 tomcat useradd -u 220 -g tomcat -c "Tomcat" -d /home/tomcat -s /bin/tcsh tomcat

3. Extract the Tomcat distribution in a new directory:

cd /opt/local/ tar -xvzf apache-tomcat-6.0.10.tar.gz

4. Set an environment home directory for tomcat application.

vi ~tomcat/.tchshrc setenv CATALINA_HOME /opt/local/apache-tomcat-6.0.10

Note: CATALINA_HOME is the default environment variable for tomcat home directory.

5. Set the java home directory environment to tomcat profile.

vi ~tomcat/.tcshrc setenv JAVA_HOME /opt/local/jdk1.5.0_03

6. Change the group and owner of the tomcat directory.

chmod 774 /opt/local/apache-tomcat-6.0.10 chown R tomcat.tomcat /opt/local/apache-tomcat-6.0.10

7. Starting tomcat application.


8. Stopping tomcat application


#!/bin/bash # Tomcat Server # chkconfig: 345 96 30 # description: Java servlet container START=/opt/local/apache-tomcat-6.0.10/bin/ STOP=/opt/local/apache-tomcat-6.0.10/bin/ start() {

} stop() {

if [ -x ${TOMCAT_START} ]; then echo "Starting tomcat server..." ${TOMCAT_START} else echo "Cannot start tomcat server" fi

if [ -x ${TOMCAT_STOP} ]; then echo "Stopping tomcat server..." ${TOMCAT_STOP} else echo "Cannot stop tomcat server" fi

restart() { stop sleep 10 start } status() { } echo "No status available for tomcat server"


case "$1" in 'start') Create a start/stop start script for tomcat. ;; vi'stop') stop ;; 'restart') restart ;; 'status') status ;; *) echo "Please supply an argument [start|stop|restart]" esac

10. Setup service control script.

cp /etc/rc.d/init.d/tomcat

11. Setup startup symlinks.

We'll use the chkconfig utility to create the required start/stop symlinks. This is easier then doing it by hand. chkconfig --add tomcat chkconfig --levels 3 tomcat on

To test the results do:

chkconfig --list tomcat

And look for output like this:


0:off 1:off 2:off 3:on 4:off 5:off 6:off

12. Manually stop/start the server.

service tomcat stop service tomcat start

13. Verify that server is running. Open a web browser and enter the address of the server. The default welcome page should be displayed. URL: http://<your domain>:8080/

14. Configuring server.xml for database connection used by workflow and war file. Delete or comment out the tag line <Host > </Host> then replace it from the variable set below.


Database Connection

Database = sgdap01 <Host name=" " appBase="webapps" > is the IP Address of the database server. <Alias></Alias> <Alias></Alias>
<Context Oracle SID = sg6 path="/workflow"> sg6 is your Oracle SID when connecting to your database. <Resource name="jdbc/myoracle" Oracle SID is your database name. password="energybui" driverClassName="oracle.jdbc.OracleDriver" maxIdle="2" Default Port = 1521 is the default port on Oracle Database connection. maxWait="5000" validationQuery="select * from en_sysdates" url="jdbc:oracle:thin:@" path = "/workflow maxActive="4"/> </Context> path username = "energybui " Note: Oracle SID in production server must be capital letters. type="javax.sql.DataSource"

<Context path="/webreporting"> <Resource name="jdbc/myoracle" type="javax.sql.DataSource" Server name username="energybui" password="energybui" <Alias> TAG = The first alias tag signifies the IP address of the driverClassName="oracle.jdbc.OracleDriver" Application Server. maxIdle="2" .e.g. maxWait="5000" validationQuery="select * from en_sysdates" <Alias> TAG = The secondurl="jdbc:oracle:thin:@" alias tag signifies the hostname of the Application Server. maxActive="4"/> .e.g. </Context>

is the directory name of your 3rd Party application.

name = Server name of the application server. </Host> e.g. sgdap01

Deployment Directory
appBase = "webapps" = webapps is the directory where the 3 rd party application will be deployed. = e.g. /opt/local/apache-tomcat-6.0.10/webapps

Account used when connecting in database server. e.g.
username = "energybui" password = "energybui"

Oracle Database Driver

driverClassName The driverClassName is the driver of your oracle database. The driver should be placed in /opt/local/apache-tomcat6.0.10/lib. The apache-tomcat application will read this driver in order to communicate to oracle database.

15. Configuring web.xml for database connection used by workflow and war file.


Add the following to xml code below in web.xml, this is also used by both tomcat and the application deployed in tomcat like workflow and webreporting utility.



<resource-ref> <description>Oracle Datasource</description> <res-ref-name>jdbc/ifxdb</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>

16. Creating and adding account for tomcat manager. vi /opt/local/apache-tomcat-6.0.10/conf/tomcat-users.xml. Add this account to the file.

<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <role rolename="monitor"/> <user username="manager" password="manager" roles="manager"/> <user username="absu" password="absu" roles="monitor"/> <user username="admin" password="admin" roles="admin"/> </tomcat-users>

17. Viewing tomcat manager.

Follow this example URL. http://sgdap01:8080/manager/html

It will ask for administration account when logging in to the tomcat manager application. Try to use this account for viewing the tomcat manager application Username: manager Password: manager

Similar pages will pop-up after you enter the correct account. (See below)

18. How to deploy war file in tomcat manager application?. Click on Browse button then select your war file to be deployed then click on Deployed button

19. Starting/stopping/undeploy application using tomcat manager application? To stop the application you uploaded using tomcat manager application Just click on Stop button based on the application you want to stop (See above) To start the application you uploaded using tomcat manager application Just click on Start button based on the application you wan to start (See above) To undeploy the application you uploaded using tomcat manager application Just click on Undeploy button based on the application you want to stop (See above)