McEahern, Mark S wrote: > I have a JNDI resource defined in my application's context.xml like so: > > <?xml version="1.0" encoding="UTF-8"?> > <Context reloadable="true" debug="true" allowLinking="true"> > <Resource > name="jdbc/v5/myjndi" > type="javax.sql.DataSource" > driverClassName="oracle.jdbc.driver.OracleDriver" ...
> maxActive="4"/> > </Context> > > When I try to put the ojdbc14.jar in the /WEB-INF/lib/*.jar of my web > application, it results in the following error: > > Could not get JDBC Connection; nested exception is > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver > class 'oracle.jdbc.driver.OracleDriver' That happens because the resources are set up with the server classpath (Common classloader), which does not include any of the webapp libraries. See http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html for classloader details. It has to be this way, because the resources actually do not belong into the webapp, but are part of the container. > I'd like to package the ojdbc14.jar inside of my application--not so > much because I expect it to be different across applications, but so as > to minimize Tomcat setup necessary to run my applications. As much as > possible, I'd like my applications to be self-contained. > > How do I get the class loader used for this JNDI resource to use my > application's /WEB-INF/lib folder's jars? I don't think you can; you'll need to weigh the pros and cons of different approaches here. You already have a feeling about the pros and cons of the standard, JNDI-based, approach. The other way (in order to be able to package the Oracle JARs within your application) would be to let go of JNDI, and declare your database dependencies in a more direct way. Just place the connection descriptor and account details into a properties file within WEB-INF, and have a database interface class to pick them up from there at application startup. -- ..Juha --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]