Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Configuration
cp jdk-1_5_0_03-linux-i586.bin cd /opt/local/
/opt/local/
Copy the binary file to /opt/local, run the self extracting installer. The result will be to install the J2SDK to /opt/local/
echo $JAVA_HOME
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 http://tomcat.apache.org/ 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
Note: CATALINA_HOME is the default environment variable for tomcat home directory.
/opt/local/apache-tomcat-6.0.10/bin/startup.sh
/opt/local/apache-tomcat-6.0.10/bin/shutdown.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() {
} 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"
9.
case "$1" in 'start') Create a start/stop start script for tomcat. ;; vi'stop') tomcat.sh stop ;; 'restart') restart ;; 'status') status ;; *) echo "Please supply an argument [start|stop|restart]" esac
cp tomcat.sh /etc/rc.d/init.d/tomcat
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
tomcat
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.
server.xml
PATH:
/opt/local/apache-tomcat-6.0.10/conf/server.xml
Database Connection
url="jdbc:oracle:thin:@170.248.99.72:1521:sg6"
<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. 170.248.99.74 maxWait="5000" validationQuery="select * from en_sysdates" <Alias> TAG = The secondurl="jdbc:oracle:thin:@170.248.99.72:1521:sg6" alias tag signifies the hostname of the Application Server. maxActive="4"/> .e.g. sgdap01.solutionworks.com </Context>
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"
15. Configuring web.xml for database connection used by workflow and war file.
web.xml
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.
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.
<?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>
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)