You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by shawn <ja...@koyuru.com> on 2002/12/23 10:38:43 UTC

OK Re: ClassCastException Conn=dataSource.getConnection();

I see now. Thanks. 

My confusion was this in server.xml 
<!-- Tomcat Root Context --> 
        <!-- 
          <Context path="" docBase="ROOT" debug="0"/> 
        --> 

so I had 

<Context path="" docBase="root" 
        debug="5" reloadable="true" crossContext="true">... 

instead of 

<Context path="/root" docBase="root" 
        debug="5" reloadable="true" crossContext="true">... 

and 
DataSource
> > dataSource2=(DataSource)ctx.lookup("java:comp/env/jdbc/");
instead of 

DataSource
dataSource2=(DataSource)ctx.lookup("java:comp/env/jdbc/root");

> It's because jdbc is not a datasource, it's a container (or something
> similar.  I have not the time to look it up).
> 
> In your server.xml/web.xml files you should have a resource that's probably
> named "jdbc/myConnection".
> 
> Your code should read
> 
> dataSource2=(DataSource)ctx.lookup( "java:comp/env/jdbc/myConnection" );
> 
> This of course is a guess.  Without your config file, it's hard to tell.
> 
> Sorry if this is a duplicate post, but I replied from the wrong account
> earlier.
> 
> Andy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>