title: Tomcat 7 fails to load ojdbc6.jar no matter where I have it specified
body: <p>This is one really trying my patience.  I have a simple Spring 3.1 + Jersey application that I'm trying to work with ojdbc6.jar as my datasource.  Unfortunately, no matter what I try, it can never find "oracle.jdbc.driver.OracleDriver" class.</p>
  
  <p>I have turned on class loader tracing and I CAN SEE the ojdbc6.jar being loaded:</p>
  
  <pre><code>[Loaded oracle.jdbc.driver.OracleDriver from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.OracleDriver from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded java.sql.SQLException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.Wrapper from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.Connection from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded javax.management.InstanceAlreadyExistsException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded oracle.jdbc.driver.OracleDriverExtension from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded java.sql.DriverInfo from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded oracle.jdbc.driver.OracleDriver$1 from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.ClassRef from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.ClassRef$XMLTypeClassRef from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.DiagnosabilityMXBean from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.OracleDiagnosabilityMBean from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded javax.management.StandardMBean$MBeanInfoSafeAction from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded oracle.jdbc.driver.DatabaseError from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.OracleSQLException from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded java.lang.StringIndexOutOfBoundsException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded oracle.jdbc.driver.SQLStateMapping from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded java.sql.SQLNonTransientException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLTransientException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLDataException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLFeatureNotSupportedException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLIntegrityConstraintViolationException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLInvalidAuthorizationSpecException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLNonTransientConnectionException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLSyntaxErrorException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLTimeoutException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLTransactionRollbackException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLTransientConnectionException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLClientInfoException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded java.sql.SQLRecoverableException from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar]
  [Loaded oracle.jdbc.driver.SQLStateMapping$Tokenizer from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.Message from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.Message11 from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.internal.ObjectDataFactory from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.sql.ORADataFactory from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.sql.AnyDataFactory from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.internal.ObjectData from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.sql.ORAData from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.sql.TypeDescriptorFactory from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.OracleConnection from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.internal.OracleConnection from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.internal.ClientDataSupport from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.OracleConnectionWrapper from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.OracleConnection from file:/opt/tomcat7/lib/ojdbc6.jar]
  [Loaded oracle.jdbc.driver.PhysicalConnection from file:/opt/tomcat7/lib/ojdbc6.jar]
  </code></pre>
  
  <p>But when I try my web service call, I get the following:</p>
  
  <pre><code>SEVERE: Servlet.service() for servlet [oraclepoc] in context with path [/oraclepoc] threw exception
  org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '"oracle.jdbc.driver.OracleDriver"/&gt;'
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
      at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:729)
      at com.company.sims.oraclepoc.dao.ProcessStatusDaoImpl.getStatusByProcessID(ProcessStatusDaoImpl.java:15)
      at com.company.sims.oraclepoc.resources.ProcessStatusRestController.getEMSStatusByProcessID_XML(ProcessStatusRestController.java:27)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
      at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
      at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
  Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '"oracle.jdbc.driver.OracleDriver"/&gt;'
      at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
      at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
      ... 43 more
  Caused by: java.lang.ClassNotFoundException: "oracle.jdbc.driver.OracleDriver"/&gt;
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
      ... 47 more
  Jan 18, 2013 11:24:30 PM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet [oraclepoc] in context with path [/oraclepoc] threw exception
  org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '"oracle.jdbc.driver.OracleDriver"/&gt;'
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
      at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:729)
      at com.company.sims.oraclepoc.dao.ProcessStatusDaoImpl.getStatusByProcessID(ProcessStatusDaoImpl.java:15)
      at com.company.sims.oraclepoc.resources.ProcessStatusRestController.getEMSStatusByProcessID_XML(ProcessStatusRestController.java:27)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
      at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
      at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
  Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '"oracle.jdbc.driver.OracleDriver"/&gt;'
      at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
      at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
      ... 43 more
  Caused by: java.lang.ClassNotFoundException: "oracle.jdbc.driver.OracleDriver"/&gt;
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
      ... 47 more
  </code></pre>
  
  <p>My application context XML file is the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"&gt;
      &lt;context:component-scan base-package="com.company.sims.oraclepoc"/&gt;
      &lt;context:annotation-config/&gt;
      &lt;bean id="propertyConfigurer" 
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="location"&gt;
              &lt;value&gt;jdbc.properties&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
            destroy-method="close"&gt;
          &lt;property name="driverClassName"&gt;
              &lt;value&gt;${jdbc.driver}&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="url"&gt;
              &lt;value&gt;${jdbc.url}&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="username"&gt;
              &lt;value&gt;${jdbc.user}&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="password"&gt;
              &lt;value&gt;${jdbc.password}&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="processStatusDao" class="com.company.sims.oraclepoc.dao.ProcessStatusDaoImpl"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;/bean&gt;  
  &lt;/beans&gt;
  </code></pre>
  
  <p>My jdbc.properties file:</p>
  
  <pre><code>jdbc.driver="oracle.jdbc.driver.OracleDriver"/&gt;
  jdbc.url="jdbc:oracle:thin:@10.10.10.10:1522:db"/&gt;
  jdbc.user="USER"/&gt;
  jdbc.password="password"/&gt;
  </code></pre>
  
  <p>I've tried putting it in the WEB-INF/lib directory and in within Tomcat's LIB directory.  Both attempts have been in failure.</p>