Download presentation
Presentation is loading. Please wait.
1
Tomcat Environment
2
In this presentation… Setting up tomcat on your machine
Setting up tomcat through MyEclipse Running tomcat through MyEclipse Setting up your project to run in tomcat in development Setting up your project to run in tomcat in test and production Migrating from JBoss to Tomcat Tomcat test and production resources build.properties file for tomcat build.xml file for tomcat Setting up tomcat datasources
3
Why move? Less of a memory footprint More reliable test environment
Easier to understand Development easier and much quicker SIT Recommendation: Everyone that does not need EJB should move to Tomcat.
4
Setting up tomcat on your machine
Extract tomcat into your /java/servers directory Oracle jars (i.e.: UIS_java_lib/oracle /ojdbc14.jar) go in tomcat’s common/lib directory
5
Setting up tomcat through MyEclipse
6
Running tomcat through MyEclipse
Use the running man icon Tomcat 5 Start Tomcat Stop Tomcat
7
Setting up your project to run in tomcat in development
Tomcat 5 now uses context.xml files Runs your application from a specified location Hot deploy (on save) Relieves the dependency on MyEclipse for deployment You need to add: /java/servers/jakarta-tomcat /conf/Catalina/localhost/<app>-<env>.xml
8
Example context.xml <Context path="/fo-dev" reloadable="true" docBase="c:/java/projects/FISCALOFFICER/fo"> <!-- datasources go here --> </Context>
9
Setting up your project to run in tomcat in test and prod
Leverage the existing deployment setup used in the JBoss environment appdeploy ... Context.xml file changes where the docBase points Context.xml should go in your META-INF directory and be named context.xml
10
Cont. Example <Context path="/<app>-<env>" reloadable="true" docBase="/usr/local/tomcat/<appserver>/webapps/<app>-<env>.war"> </Context> Your ant dist task should replace the <env> with the correct test or prod environment.
11
Cont. Example <replaceregexp match="\b(dev|unt|reg|stg|trn|prd)\b" replace="${build.environment}" byline="true" flags="g"> <fileset dir="."> <include name="${webapp}/META-INF/context.xml" /> </fileset> </replaceregexp>
12
Migrating from JBoss to Tomcat
Send a request to:
13
Tomcat test and production resources
Deployment Test Server x1j2ee Deployment Prod Server penguin01 Test Servers x3j2ee x4j2ee Prod Servers penguin03 penguin04
14
build.properties file for tomcat
/opt/ears/<env>/<app> project.cvs.package=SIT/FISCALOFFICER project.cvs.anonpassword=***** project.home=SIT/FISCALOFFICER project.server=sit2 appserver.home=/usr/local/tomcat/default appserver.lib.dir=/usr/local/tomcat/default/common/lib appserver.deploy.dir=/usr/local/tomcat/sit2/webapps
15
build.xml file for tomcat
dist task only needs to build a war and a web.zip dist task should also change the <ENV> for context.xml and web.xml There is a different jsp compiler than for JBoss See a full example in: SIT/FISCALOFFICER
16
Setting up tomcat datasources
Creates a database pool managed by Jakarta DBCP <webapp>/META-INF/context.xml between the <Context> tags Add a <resource-ref> block to your web.xml Example on the next page
17
<!DOCTYPE doc [ <!ENTITY ENDB SYSTEM "file:/opt/sa_forms/java/unt/edu/iu/uis/security/fo/ENDB.xml"> ] > <Context path="/<app>-<env>" reloadable="true" docBase="/usr/local/tomcat/sit2/webapps/fo-unt.war"> <Resource name="jdbc/dev/fo/XA/EDEN" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/dev/fo/XA/EDEN"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <name>maxActive</name> <value>100</value> <name>maxIdle</name> <value>5</value> <name>maxWait</name> <value>10000</value> &ENDB; <!-- rename this to your file --> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> <name>validationQuery</name> <value>select 1 from dual</value> </ResourceParams> </Context>
18
Extract sensitive information
/opt/sa_forms/java/<env>/edu/iu/uis/security/<app>/<app><resource>.xml <parameter> <name>username</name> <value>USERNAME</value> </parameter> <name>password</name> <value>PASSWORD</value> <name>url</name>
19
web.xml addition <resource-ref>
<description>MY Datasource</description> <res-ref-name> jdbc/dev/my/MYDB </res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
20
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.