If the jdbc2_0-stdext.jar is in the common/lib and no where else, and
you can't see it from your JSP code, you have a class loading issue that
probably relates to your problem.  

What version of TC?  JDK?  

With TC 4.1.x (maybe older versions too...) you can see the class
loading structure by turning on debugging for it in your Context.

<Context .... debug="9">
        <Loader debug="9"  />
</Context>



- Andrew



-----Original Message-----
From: Meichun Li [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 10, 2002 5:51 PM
To: Tomcat Users List
Subject: DataSource Casting Problem


Hi, 

I have DataSource Casting problem while using DBCP. The server.xml and 
web.xml configuration should be fine.  

The error is:
java.lang.ClassCastException: org.apache.commons.dbcp.BasicDataSource

I searched the archive and it is said that the jar file
jdbc2_0-stdext.jar 
should only be put in $CATALINA_HOME/common/lib. 

But If I don't put it in /WEB-INF/lib directory, there is another error:
javax.sql.* package cant' be found. 

The related codes are:

Context initCtx = new InitialContext();
Context envCtx=(Context)initCtx.lookup("java:comp/env");
DataSource ds =(DataSource)envCtx.lookup("jdbc/ospreyDb");

It works if I use this:
org.apache.commons.dbcp.BasicDataSource ds=
          (org.apache.commons.dbcp.BasicDataSource) 
envCtx.lookup("jdbc/ospreyDb");

Any ideas? Thanks a lot in advance!

-Meichun


-- 
Meichun Li
Ibiblio.org
919-962-5646


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

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

Reply via email to