Document link: http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html
>From the document: The resources defined in this element are not visible in the per-web-application contexts unless you explicitly link them with <ResourceLink> elements. If you use a GlobalNamingResource element, you will then have to use a <ResourceLink> element in the <Context> element of server.xml. I think you would then use the name attribute specified in the <ResourceLink> element in your /WEB-INF/web.xml <resource-ref> or <resource-ref-env> elements (specifically <res-ref-name> or <resource-env-ref-name>). I'm not at a machine where I can try this, but that's my reading of the documentation. Hope this helps. /mde/ --- ALEX HYDE <[EMAIL PROTECTED]> wrote: > 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. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]