Add to $CLASSPATH $CATALINA_HOME/common/lib/ojdbc14.jar
Create following directory structure and tune:-
files (./WEB-INF/web.xml & ./META-INF/context.xml) as follows bellow.
Directory Structure of DbFs Web Application to deployed
to TomCat 5.5.16
[tomcat@ServerRHL Jdevdb]$ ls -CR
.:
DbFs.war index.html META-INF WEB-INF
./META-INF:
context.xml
./WEB-INF:
classes src web.xml
./WEB-INF/classes:
coreservlets
./WEB-INF/classes/coreservlets:
DbServlet.class
./WEB-INF/src:
DbServlet.java
***************************
File ./META-INF/context.xml
***************************
<Context debug="0" docBase="/DbFs" path="/DbFs" reloadable="true">
<Resource name="jdbc/oracle10g"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@ServerRHL.informatics.dstu.net:1522:jdevdb"
username="hr"
password="hr"
maxActive="20"
maxIdle="10"
maxWait="-1" />
</Context>
**********************
File ./WEB-INF/web.xml
**********************
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/oracle10g</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<servlet>
<servlet-name>DbServlet</servlet-name>
<servlet-class>coreservlets.DbServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DbServlet</servlet-name>
<url-pattern>/servlet/coreservlets.DbServlet</url-pattern>
</servlet-mapping>
</web-app>
*********************************
File ./WEB-INF/src/DbServlet.java
*********************************
View [1] chapter 21.3.
Then complile:-
[tomcat@ServerRHL src]$ javac -d /home/tomcat/Jdevdb/WEB-INF/classes DbServlet.java
Create index.html:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<HTML>
<HEAD><TITLE>Servlet Connection Pooling: A Test</TITLE></HEAD>
<!-- Causes 25 near simultaneous requests for same servlet. -->
<FRAMESET ROWS="*" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
<FRAMESET COLS="*">
<FRAME SRC="/DbFs/servlet/coreservlets.DbServlet">
</FRAMESET>
</HTML>
Then:-
[tomcat@ServerRHL Jdevdb]$ ls -l
total 32
-rw-rw-r-- 1 tomcat tomcat 351 Apr 29 13:45 index.html
drwxrwxr-x 2 tomcat tomcat 4096 Apr 29 13:23 META-INF
drwxr-xr-x 4 tomcat tomcat 4096 Apr 29 13:31 WEB-INF
[tomcat@ServerRHL Jdevdb]$ jar cvf DbFs.war .
Deploy DbFs.war and run.
References.
1.Java Servlet and JSP Cookbook. Bruce W. Perr, O'REILLY 2004
-
TUNING DATASOURCE(JNDI API) FOR ORACLE 10gR2 IN TOMCAT 5.5.16 (3 messages)
- Posted by: Boris Derzhavets
- Posted on: April 29 2006 06:56 EDT
Threaded Messages (3)
- docBase was accidently assigned wrong value by Boris Derzhavets on April 30 2006 08:33 EDT
- Pattern? by James Watson on May 11 2006 09:25 EDT
- Re: TUNING DATASOURCE(JNDI API) FOR ORACLE 10gR2 IN TOMCAT 5.5. by Mochamad Ramadhan Sjamsani on June 29 2006 05:12 EDT
-
docBase was accidently assigned wrong value[ Go to top ]
- Posted by: Boris Derzhavets
- Posted on: April 30 2006 08:33 EDT
- in response to Boris Derzhavets
Actually,
docBase should to be the "/path/to/sourceApp" , in particular "~tomcat/Jdevdb" -
Pattern?[ Go to top ]
- Posted by: James Watson
- Posted on: May 11 2006 09:25 EDT
- in response to Boris Derzhavets
How is this a pattern? -
Re: TUNING DATASOURCE(JNDI API) FOR ORACLE 10gR2 IN TOMCAT 5.5.[ Go to top ]
- Posted by: Mochamad Ramadhan Sjamsani
- Posted on: June 29 2006 05:12 EDT
- in response to Boris Derzhavets
Which tunning did you do? making -1 for maxwait make tomcat never wait for new connection for ready that cause Exception thrown when 21 or more connection are requested.