Classloading Question
I am connecting my application to a Oracle XE database and I am having a weird issue with classloading. According to the classloading documentation [1] I should be placing the Oracle JDBC jar file ojdbc14.jar in $CATALINA_HOME/shared/lib, but when I do that, my application throws a Cannot load JDBC driver class 'oracle.jdbc.OracleDriver' exception. This also happens if I move the jar file to WEB-INF/lib too. The only way I can get it to work is to place it in $CATALINA_HOME/common/lib Any ideas? I've attached my test case and it's the application level context.xml file thanks -- brian [1] - http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html = index.jsp (well, the important parts) = InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(java:comp/env/jdbc/XEDB); Connection conn = ds.getConnection(); = context.xml = ?xml version=1.0 encoding=UTF-8? Context Resource name=jdbc/XEDB type=javax.sql.DataSource driverClassName=oracle.jdbc.OracleDriver url=jdbc:oracle:thin:brian/password@//localhost:1521/XE maxActive=8 / /Context - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classloading Question
What version of TC are you using? I wouldn't put the jar file there, no! Try in %TC HOME%\common\lib, whereever that is. -Original Message- From: Brian Munroe [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 31, 2007 3:50 PM To: Tomcat Users List Subject: Classloading Question I am connecting my application to a Oracle XE database and I am having a weird issue with classloading. According to the classloading documentation [1] I should be placing the Oracle JDBC jar file ojdbc14.jar in $CATALINA_HOME/shared/lib, but when I do that, my application throws a Cannot load JDBC driver class 'oracle.jdbc.OracleDriver' exception. This also happens if I move the jar file to WEB-INF/lib too. The only way I can get it to work is to place it in $CATALINA_HOME/common/lib Any ideas? I've attached my test case and it's the application level context.xml file thanks -- brian [1] - http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html = index.jsp (well, the important parts) = InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(java:comp/env/jdbc/XEDB); Connection conn = ds.getConnection(); = context.xml = ?xml version=1.0 encoding=UTF-8? Context Resource name=jdbc/XEDB type=javax.sql.DataSource driverClassName=oracle.jdbc.OracleDriver url=jdbc:oracle:thin:brian/password@//localhost:1521/XE maxActive=8 / /Context - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classloading Question
On 7/31/07, Propes, Barry L [EMAIL PROTECTED] wrote: What version of TC are you using? I wouldn't put the jar file there, no! I am using 5.5.23. Wouldn't put it where? shared/lib? Try in %TC HOME%\common\lib, whereever that is. I did, and it works, but from my understanding of the classloading documentation, you should technically place application level jars in $CATALINA_HOME/shared/lib, in which it does not work. -- brian - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classloading Question
From: Brian Munroe [mailto:[EMAIL PROTECTED] Subject: Re: Classloading Question I did, and it works, but from my understanding of the classloading documentation, you should technically place application level jars in $CATALINA_HOME/shared/lib, in which it does not work. Depends on whether or not you're letting Tomcat manage the pool. If you are, the driver jar has to go where Tomcat can see it as well, and that's common/lib. Look here for details: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h tml - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classloading Question
On 7/31/07, Caldarale, Charles R [EMAIL PROTECTED] wrote: Look here for details: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h tml Heh, II was wondering about that. I just gleamed that and found this gem: Drivers for older Oracle versions may be distributed as *.zip files rather than *.jar files. Tomcat will only use *.jar files installed in $CATALINA_HOME/common/lib. Therefore classes111.zip or classes12.zip will need to be renamed with a .jar extension. Since jarfiles are zipfiles, there is no need to unzip and jar these files - a simple rename will suffice. Bam, right there in front of me! thanks! -- brian - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]