+ All Categories
Home > Documents > Tomcat Documentation

Tomcat Documentation

Date post: 14-Apr-2018
Category:
Upload: richard-sibbaluca
View: 247 times
Download: 0 times
Share this document with a friend

of 13

Transcript
  • 7/30/2019 Tomcat Documentation

    1/13

    TOMCAT APACHE

    Configuration

    1.) Installing J2SDK

    J2SDK is the Java 2 Software Development Kit from Sun Microsystems. Itcontains a Java run-time environment, Java compiler and various utilities.

    1. Download J2SDK.

    Download from here: http://java.sun.com/

    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.

    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.

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

    cd /opt/local/

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

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

    setenv JAVA_HOME /opt/local/jdk1.5.0_03

    http://java.sun.com/http://java.sun.com/
  • 7/30/2019 Tomcat Documentation

    2/13

    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 verifyand repeat the above steps until it works correctly.

    Note: If you already have a tomcat account please set a java homeenvironment to its profile in order to run tomcat application properly.

    2. Installing Tomcat

    /opt/local/jdk1.5.0_03

    echo $JAVA_HOME

  • 7/30/2019 Tomcat Documentation

    3/13

    1. Download a binary distribution of Tomcat from the Apache website

    http://tomcat.apache.org/

    2. Create a user account for tomcat and its group account .

    3. Extract the Tomcat distribution in a new directory:

    4. Set an environment home directory for tomcat application.

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

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

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

    7. Starting tomcat application.

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

    vi ~tomcat/.tcshrcsetenv JAVA_HOME /opt/local/jdk1.5.0_03

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

    vi ~tomcat/.tchshrcsetenv CATALINA_HOME /opt/local/apache-tomcat-6.0.10

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

    /opt/local/apache-tomcat-6.0.10/bin/startup.sh

    http://tomcat.apache.org/http://tomcat.apache.org/
  • 7/30/2019 Tomcat Documentation

    4/13

    8. Stopping tomcat application

    9. Create a start/stop script for tomcat.

    vi tomcat.sh

    #!/bin/bash# Tomcat Server# chkconfig: 345 96 30# description: Java servlet container

    START=/opt/local/apache-tomcat-6.0.10/bin/startup.sh

    STOP=/opt/local/apache-tomcat-6.0.10/bin/shutdown.sh

    start(){

    if [ -x ${TOMCAT_START} ]; thenecho "Starting tomcat server..."${TOMCAT_START}

    elseecho "Cannot start tomcat server"

    fi}

    stop(){

    if [ -x ${TOMCAT_STOP} ]; then

    echo "Stopping tomcat server..."${TOMCAT_STOP}

    elseecho "Cannot stop tomcat server"

    fi}

    restart(){

    stopsleep 10start

    }

    status(){

    echo "No status available for tomcat server"

    }

    case "$1" in'start')

    start;;

    'stop')stop;;

    'restart')restart;;

    'status')status;;

    *)echo "Please supply an argument [start|stop|restart]"

    esac

    /opt/local/apache-tomcat-6.0.10/bin/shutdown.sh

  • 7/30/2019 Tomcat Documentation

    5/13

    10. Setup service control script.

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

  • 7/30/2019 Tomcat Documentation

    6/13

    11. Setup startup symlinks.

    We'll use the chkconfig utility to create the required start/stop symlinks. This is easier then doingit by hand.

    To test the results do:

    And look for output like this:

    12. Manually stop/start the server.

    13. Verify that server is running.

    Open a web browser and enter the address of the server. The default welcome page should bedisplayed.

    URL: http://:8080/

    chkconfig --add tomcatchkconfig --levels 3 tomcat on

    chkconfig --list tomcat

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

    service tomcat stopservice tomcat start

  • 7/30/2019 Tomcat Documentation

    7/13

    14. Configuring server.xml for database connection used by workflow and war file.

    Delete or comment out the tag line then replace it from the variable set below.

    server.xml

    PATH: /opt/local/apache-tomcat-6.0.10/conf/server.xml

  • 7/30/2019 Tomcat Documentation

    8/13

    170.248.99.74sgdap01.solutionworks.com

    Database Connection

    url="jdbc:oracle:thin:@170.248.99.72:1521:sg6"

    Database = 170.248.99.72

    170.248.99.72is the IP Address of the database server.

    Oracle SID = sg6

    sg6 is your Oracle SID when connecting to your database.

    Oracle SID is your database name.

    Note: Oracle SID in production server must be capital letters.

    Default Port = 1521 is the default port on Oracle Database connection.

    path= "/workflow

    path is the directory name of your 3rd Partyapplication.

    Server name

    TAG = The first alias tag signifies the IP address of theApplication Server..e.g. 170.248.99.74

    TAG = The second alias tag signifies the hostname of theApplication Server.

    .e.g. sgdap01.solutionworks.com

    name = Server name of the application server.

    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

    Accounts

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

  • 7/30/2019 Tomcat Documentation

    9/13

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

    web.xml

    Oracle Database Driver

    driverClassName The driverClassName is the driver of your oracledatabase.

    The driver should be placed in /opt/local/apache-tomcat-

    6.0.10/lib. The apache-tomcat application will read thisdriver in order to communicate to oracle database.

  • 7/30/2019 Tomcat Documentation

    10/13

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

    PATH: /opt/local/apache-tomcat-6.0.10/conf/web.xml

    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.

    17. Viewing tomcat manager.

    Follow this example URL.

    It will ask for administration account when logging in to the tomcat managerapplication.

    Try to use this account for viewing the tomcat manager applicationUsername: manager Password: manager

    Oracle Datasourcejdbc/ifxdbjavax.sql.DataSourceContainer

    http://sgdap01:8080/manager/html

  • 7/30/2019 Tomcat Documentation

    11/13

    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

  • 7/30/2019 Tomcat Documentation

    12/13

    19. Starting/stopping/undeploy application using tomcat manager application?

    To stop the application you uploaded using tomcat manager applicationJust click on Stop button based on the application you want to stop (See above)

    To start the application you uploaded using tomcat manager applicationJust click on Start button based on the application you wan to start (See above)

    To undeploy the application you uploaded using tomcat manager applicationJust click on Undeploy button based on the application you want to stop (See above)

  • 7/30/2019 Tomcat Documentation

    13/13


Recommended