-------- Original Message --------
Subject: Lessons learned from using Struts, Tomcat and Oracle
Date: Thu, 21 Mar 2002 19:43:22 -0800 (PST)
From: "Walter S. So" <[EMAIL PROTECTED]>

Hi Ted,

I just want to share this information in case someone else also
goes through the same problems I did.  I was able to come up
with this solution after spending an entire afternoon searching
through the net and archives, so if it saves people a few hours
of debugging, I'll be happy.  I am not sure how to categorize it
or even which mailing list to send this, whether it should go to
Tomcat, Struts, or Tyrex, so I decided to send it to you since
you are active in Jakarta.

My goal was to set up a Connection Pooled DataSource using
Oracle running Struts on Tomcat.  I use Tomcat 4.0.3, Struts
1.1-b1-lib, Oracle 8.1.7 "classes12.zip" running on Windows 98,
but it should work well on Solaris/Linux.

Initially, I set up the Oracle JDBC drivers under my webapp and
used the <datasource> in struts-config.xml to access Oracle.  My
application consistently hung after the pool was exhausted. 
(For example, if I set the minCount and maxCount to "10", my
webapp would hang after 10 requests)  The problem of Oracle
connections not being returned properly by the Struts pool was
well documented in the mailing list, so I switched the
datasource from struts-config.xml to tomcat's server.xml.  I
followed the instructions in the Tomcat jndi-resources-howto and
copied the Oracle drivers to common/lib after renaming the
"classes12.zip" to "classes12.jar" as suggested by the mailing
list.

I found my webapp wasn't running properly as the servlet would
stop executing after context.lookup().  This bothered me because
Tomcat was not throwing any exceptions. After some more
research, I changed the debug level in server.xml from "0" to
"99".  This time, the log generated showed a
java.lang.ClassCastException: tyrex.jdbc.xa.EnabledDataSource
when the lookup() is called.  A post in the tomcat-dev mailing
list provided the answer:  There was a conflict in the jars of
tomcat and the webapp.  True enough, I found a
jdbc2_0-stdext.jar (83KB) that came in tomcat\common\lib, and a
jdbc2_0-stdext.jar (7KB) that i had unpacked from Struts to my
web-app.  After deleting the 7KB jar, the lookup() executed
properly.

To sum up, when using a DataSource in Tomcat and Struts in the
webapp, make sure to remove the extraneous jdbc2_0-stdext.jar
that comes with the Struts Lib. :)

Hope that helps,

Walter


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to