Your context.xml can stay in the conf directory (as server.xml), however you 
need the context.xml. You can comment out the Resource section in server.xml.


"Tomcat Users List" <users@tomcat.apache.org> schrieb am 08.03.06 20:39:49:
> 
> Thanks for the help. 
>   
>   I seem to be able to get it working when I have a context file under my  
> web-app in the meta-inf directory. But I am still unable to properly  
> configure a global datasource. Here is my context.xml..... very  standard:
>   
>   <?xml version="1.0" encoding="UTF-8"?>
>   
>   <Context>
>   
>   <Resource name="jdbc/testdb" auth="SERVLET" type="javax.sql.DataSource" 
> driverClassName="com.mysql.jdbc.Driver" 
>            url="jdbc:mysql://localhost:3306/testdb" username="me" 
> password="me"  maxActive="30" maxIdle="2000" maxWait="120"/>
>   
>   </Context>
> 
>   If I remove this and instead add this to server.xml
>   
>       <GlobalNamingResources>
>           <Resource name="jdbc/testdb"  auth="SERVLET" 
> type="javax.sql.DataSource"  driverClassName="com.mysql.jdbc.Driver"  
> url="jdbc:mysql://localhost:3306/testdb" username="me" password="me"  
> maxActive="30" maxIdle="2000" maxWait="120"/>
>       </GlobalNamingResources>
>   
>   It no longer finds the datasource. My web.xml looks like this:
>   
>   <web-app version="2.4">
>       <display-name>JNDI Test</display-name>
>       <description>
>                Welcome to JNDI
>        </description>
>       <resource-ref>
>           <description>hello </description>
>           <res-ref-name>jdbc/testdb</res-ref-name>
>           <res-type>javax.sql.DataSource</res-type>
>           <res-auth>SERVLET</res-auth> 
>       </resource-ref>
>   </web-app>
>   
>   I tried this, but it is failing to parse:
>   
>   <web-app version="2.4">
>       <display-name>JNDI Test</display-name>
>       <description>
>                Welcome to JNDI
>        </description>
>       <resource-env-ref>
>           <description>hello </description>
>           <res-env-ref-name>jdbc/testdb</res-env-ref-name>
>           <res-env-type>javax.sql.DataSource</res-env-type>
>       </resource-env-ref>
>   </web-app>
>   
>   Any input would be great. Thanks alot.
>   
> [EMAIL PROTECTED] wrote:  Follows is to do:
> 
> extract your Resource section from server.xml and copy to context.xml. I did 
> the same and my jndi works very fine.
> 
> György 
> 
> 
> "Tomcat Users List"  schrieb am 07.03.06 22:58:18:
> > 
> > here are the docs
> > http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> > 
> > I don't see them declare the "factory" attribute in 5.5, you didn't tell 
> > us what version you were on
> > 
> > Filip
> > 
> > ALEX HYDE wrote:
> > > Hi All,
> > >
> > > I've seen this one all over the user group but I seem
> > > to have come to a dead end with this. I have upgraded
> > > from tomcat 4 to 5 and I can't seem to get my app
> > > working again. 
> > >
> > > The part that has broken is the jndi datasource
> > > look-up. I notice that I'm definitly not the first to
> > > experience this problem. Perhaps things might have
> > > been made a bit clearer. I thought I had set things up
> > > correctly. I have extracted my old context from
> > > server.xml and added it under my web app context. 
> > >
> > > 
> > >         debug="0" reloadable="true"
> > > crossContext="true">
> > >
> > >   
> > > type="javax.sql.DataSource"
> > >  maxActive="10" maxIdle="7" maxWait="50000"
> > > driverClassName="com.mysql.jdbc.Driver"
> > >  url="jdbc:mysql://localhost:1521/testdb"
> > > username="user1" password="****"
> > > factory="org.apache.commons.dbcp.BasicDataSourceFactory"
> > >  />
> > >
> > > I now have this error where it had been working in
> > > version 4. 
> > >
> > > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> > > create JDBC driver of cla
> > > ss '' for connect URL 'null'  
> > >
> > > Thanks for your help.
> > >
> > >
> > >   
> > > ___________________________________________________________ 
> > > Win a BlackBerry device from O2 with Yahoo!. Enter now. 
> > > http://www.yahoo.co.uk/blackberry
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >   
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> Mit freundlichen Grüßen
> 
> Dr. György Kelemen
> Email: [EMAIL PROTECTED]
> Mobil: 0173 534 5668
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
>               
> ---------------------------------
> To help you stay safe and secure online, we've developed the all new Yahoo! 
> Security Centre.

-- 
Mit freundlichen Grüßen

Dr. György Kelemen
Email: [EMAIL PROTECTED]
Mobil: 0173 534 5668

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

Reply via email to