Hi, Welcome to the list, finally ;) Why do you need to move it to the GlobalNamingResources?
Yoav Shapira Millennium Research Informatics >-----Original Message----- >From: Toby Tittles [mailto:[EMAIL PROTECTED] >Sent: Wednesday, May 26, 2004 4:14 PM >To: [EMAIL PROTECTED] >Subject: ResourceLink to JNDI DataSource in GlobalResources not working > > >Hi There, I'm running Tomcat 4.1.30. When I put the Resource and >ResourceParams elements in the Context element of my webapp, it seems to >work fine, but when I move it to the GlobalNamingResources element and >point to it using a ResourceLink, it doesn't seem to work giving me an >exception saying that the driver class is null. Here's my Resource in the >GlobalNamingResources: <Resource name="jdbc/myoracle" auth="Container" >scope="Shareable" type="javax.sql.DataSource" /> ><ResourceParams name="jdbc/myoracle"> <parameter> ><name>factory</name> ><value>org.apache.commons.dbcp.BasicDataSourceFactory</value> ></parameter> <parameter> <name>driverClassName</name> ><value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> ><name>url</name> <value>jdbc:oracle:thin:@MY_DB_URL</value> ></parameter> <parameter> <name>username</name> ><value>MY_USER_NAME</value> </parameter> <parameter> ><name>password</name> > <value>MY_PASSWORD</value> </parameter> <parameter> ><name>maxActive</name> <value>30</value> </parameter> <parameter> ><name>maxIdle</name> <value>10</value> </parameter> <parameter> ><name>maxWait</name> <value>60000</value> </parameter> <parameter> ><name>removeAbandonedTimeout</name> <value>60</value> </parameter> ><parameter> <name>logAbandoned</name> <value>true</value> ></parameter> </ResourceParams> And here's my ResourceLink nested in my >Context: <ResourceLink name="jdbc/myoracle" >global="jdbc/myoracle" type="javax.sql.DataSource"/> > >Here's my entry in my web.xml > > <resource-ref> > <description>DB Connection</description> > <res-ref-name>jdbc/myoracle</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > >and here's my java code to get a connection > > >Context ctx = new InitialContext(); > > > > > >Object obj = ctx.lookup("java:comp/env/jdbc/myoracle"); > >DataSource ds = (DataSource)obj; > > > >return ds.getConnection(); > > >Like I mentioned, the code works when the resource is nested inside > >the context, but when I replace it with the resource link like above > >and move it up to the global naming resources, it doesn't work. > >Any suggestions? > > > >--------------------------------- >Do you Yahoo!? >Friends. Fun. Try the all-new Yahoo! Messenger This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
