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]>

Reply via email to