I'm using tomcat 8 and and deployed the ANT build war file to the tomcat which was previously deployed on Weblogic. I have sorted out most the things and deployment is success too on tomcat locally. However, when i'm trying to test the application thru Postman scripts, I'm having trouble getting the DB connections. The Error is as below:
Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
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:662)
at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:142)
at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:148)
//Later part of the error logs:
--------------------------------
Caused by: java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2224)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2104)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 53 more
Caused by: java.lang.NullPointerException
at oracle.jdbc.driver.OracleDriver.acceptsURL(OracleDriver.java:981)
at java.sql.DriverManager.getDriver(DriverManager.java:299)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2209)
... 57 more
Please help me to understand where the problem is. My configurations are as below:
web.xml:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/MatchDS_DEV</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Context.xml : under tomcat/webapp/manager
<Context antiResourceLocking="false" privileged="true" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
<Resource name="jdbc/DEV" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
username="USER"
password="Admin_1"
driverClassName="oracle.jdbc.xa.client.OracleXADataSource"
url="jdbc:oracle:thin:#//mcpsecv01-***/MCPRM01V"/>
</Context>
DAO Class:
import javax.sql.DataSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
Class XX{
DataSource dataSource;
private NamedParameterJdbcTemplate jdbcTemplate;
public void setDataSource(DataSource dataSource)
{
jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
}
//more source code
//within a method, m calling this jdbcTemplate like this:
Object value = jdbcTemplate.query(params); // this is where it throws error.
//more source code
}//End of class X
I have placed below jars in tomcat/lib:
ojdbc14 , spring-jdbc-3.2.0.RELEASE , commons-dbcp2-2.1.1
Related
In my server.xml, I'm defining a resource:
<Resource name="global" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
username="user" password="betterThanThis"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:memory:test;create=true"/>
In my webapp context.xml I'm linking to it:
<ResourceLink name="local"
auth="Container"
global="global"
type="javax.sql.DataSource" />
In my web.xml I'm referencing it
<resource-ref>
<res-ref-name>local</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
And in my code, I'm using it
DataSource ds = InitialContext.doLookup("java:/comp/env/local");
ds.getConnection();
That last line throws an exception:
java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2167) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2037) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1543) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
Question: Why is a class in the org.apache.tomcat.dbcp.dbcp2 package throwing an error when I've specified factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" on my Resource?
It's not a missing jar problem, because I can see the Derby init in tomcat's logs. I don't think it's a naming issue, because when I change the name in InitialContext.doLookup("java:/comp/env/local") I get a naming error.
Edit: Full stack trace as requested:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:315) ~[na:1.8.0_151]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2151) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
... 8 common frames omitted
Wrapped by: java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2167) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2037) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1543) ~[tomcat8-dbcp-8.5.14.jar:8.5.14]
at com.moosemorals.webmail.Database.getConnection(Database.java:46) ~[classes/:na]
at com.moosemorals.webmail.Database.getAccountForAlias(Database.java:55) ~[classes/:na]
at com.moosemorals.webmail.authserver.PostfixLookupServer.lookup(PostfixLookupServer.java:61) ~[classes/:na]
at com.moosemorals.webmail.authserver.PostfixLookupServer.execute(PostfixLookupServer.java:40) ~[classes/:na]
at com.moosemorals.webmail.authserver.GenericServer$Client.run(GenericServer.java:151) [classes/:na]
It says "No suitable driver" so you may be missing some derby jdbc jar. Putting it in Tomcat lib may be needed.
we are using a JDNI Datasource with DB2 Driver in combination with a Tomcat 6.
The application use Hibernate and Spring Data JPA.
The problem is, that the HotDeployment (with RPM) fails.
After a HotDeployment we get the following error in the log:
Information: Illegal access: this web application instance has been stopped already. Could not load DB2JccConfiguration.properties. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
And the application fails to start...
Definition in web.xml
<resource-ref>
<res-ref-name>jdbc/theDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
</resource-ref>
context.xml
<Resource name="jdbc/testDS" auth="Container"
type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
maxActive="10" minIdle="2" maxIdle="10" maxWait="10000"
minEvictableIdleTimeMillis="120000"
timeBetweenEvictionRunsMillis="60000"
username="xxx" password="xxx"
driverClassName="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://xxxx;"
validationQuery="select 1 from sysibm.sysdummy1" />
And the Bean definition in the spring config class:
#Bean
public DataSource dataSource() throws SQLException {
DataSource dataSource = null;
try {
final JndiDataSourceLookup dsLookup =
new JndiDataSourceLookup();
dsLookup.setResourceRef(true);
dataSource =
dsLookup.getDataSource(JNDI_DATASOURCE_BASE_NAME +
this.jndiDataSourceLookupName);
} catch (Exception ex) {
LOGGER.error(ex.toString());
throw ex;
}
return dataSource;
}
Found the solution. I changed to tomcat7 and replaced "org.apache.commons.dbcp.BasicDataSourceFactory" with the factory from tomcat. After this changes the problem was solved.
I deployed a web application onto Tomcat 8. In that application a global JNDI DataSource is defined that is shared between several servlets. Inside the application it is wrapped within a Spring bean which uses a factory method to retrieve that once from JNDI. There is also a ServletContextListener implemented to react when the web applications context gets destroyed. The application itself works fine and the DataSource can be properly retrieved and used.
The Problem: On a Tomcat shutdown (catalina.sh stop, SIGINT or SIGTERM) the DataSource gets closed before the ServletContextListener.contextDestroyed() is invoked. That is bad because I need to access the DB in that method (e.g. to shutdown our Quartz scheduler properly which has database access).
Here is a snippet of the server.xml:
<Server port="8005" shutdown="SHUTDOWN">
...
<GlobalNamingResources>
...
<Resource name="myDB" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000" username="" password=""
removeAbandonedOnBorrow="true" removeAbandonedTimeout="60" driverClassName="org.h2.Driver"
url="jdbc:h2:myApp" defaultTransactionIsolation="READ_COMMITTED" />
...
</GlobalNamingResources>
...
</Server>
Here from the context.xml:
<Context path="/myApp" docBase="myApp"
reloadable="false" crossContext="false" antiResourceLocking="true" unloadDelay="5000">
<ResourceLink name="jdbc/myDB" global="myDB" type="javax.sql.DataSource" />
<Manager className="org.apache.catalina.session.PersistentManager"
distributable="false" saveOnRestart="false">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
</Context>
Here a snippet of my ServletContextListener:
public class MyListener implements ServletContextListener {
...
#Override
public void contextDestroyed(ServletContextEvent sce) {
...
// using the DataSource here
...
}
...
}
In the logs I can see an Exception when I try to use the DataSource in the ServletContextListener saying that the Data source is already closed:
05 Aug 2015 14:59:17,915 [localhost-startStop-2] () || DEBUG DisposableBeanAdapter: Invoking destroy method 'close' on bean with name 'dataSource'
05-Aug-2015 14:59:17.918 WARNING [localhost-startStop-2] org.apache.tomcat.dbcp.dbcp2.BasicDataSource.close Failed to unregister the JMX name: Catalina:type=DataSource,class=javax.sql.DataSource,name="myDB"
javax.management.InstanceNotFoundException: Catalina:type=DataSource,class=javax.sql.DataSource,name="myDB"
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(Unknown Source)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.close(BasicDataSource.java:1916)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:327)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:510)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:486)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:742)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:455)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1064)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4776)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5390)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
...
Shutting down scheduler.
...
05 Aug 2015 14:59:24,098 [QuartzScheduler_DefaultQuartzScheduler-4424f282be6c1438786703813_ClusterManager] () || ERROR JobStoreTX : ClusterManager: Error managing cluster: Failed to obtain DB connection from data source 'qrtzds': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:comp/env/jdbc/myDB' java.sql.SQLException: Data source is closed
org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'qrtzds': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:comp/env/jdbc/myDB' java.sql.SQLException: Data source is closed [See nested exception: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:comp/env/jdbc/myDB' java.sql.SQLException: Data source is closed]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:778)
at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doCheckin(JobStoreSupport.java:3245)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3858)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.run(JobStoreSupport.java:3895)
Caused by: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:comp/env/jdbc/myDB' java.sql.SQLException: Data source is closed
at org.quartz.utils.JNDIConnectionProvider.getConnection(JNDIConnectionProvider.java:163)
at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:775)
... 4 more
Question:
How can I control the lifecycle of Tomcat to close the global DataSource resource after the web application context is destroyed?
How can I tell Spring to not invoke the BasicDataSource.close() method? I tried to set the bean attribute destroy-method to an empty value. But it seems that when that is empty it still invokes the close() method because it detects an AutoClosable.
I tried to run project on tomcat 7.0.52 and initialize to DB through context.xml file.
But it throws bunch of exceptions, I couldn't figure out what is wrong there.
Here is console output:
java.sql.SQLException: com.mysql.jdbc.Driver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:554)
at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:242)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:141)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
Here is full stack trace.
Here is output to tomcat catalina log
snippet of web.xml:
<resource-ref>
<description>Travel Agency Datasource</description>
<res-ref-name>jdbc/onlinedb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
context.xml:
<Context>
<Resource name="jdbc/onlinedb"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
maxActive="20" maxIdle="10"
maxWait="-1"
username="root"
password="secret"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/travelagency?characterEncoding=utf8"/>
</Context>
ConnectionManager class:
public class ConnectionManager {
private static Logger log = Logger.getLogger(ConnectionManager.class);
public static Connection getConnection() throws SQLException {
Connection con = null;
try {
Context initContext = new InitialContext();
Context envContext = (Context) initContext.lookup("java:/comp/env");
DataSource datasource = (DataSource) envContext.lookup("jdbc/onlinedb");
con = datasource.getConnection();
} catch (NamingException e) {
log.error(e);
}
return con;
}
}
mysql-connector-java-5.1.27-bin.jar is added to cp:
I tried to change content of context.xml file:
<resource-env-ref>
<description>Travel Agency Datasource</description>
<resource-env-ref-name>jdbc/onlinedb</resource-env-ref-name>
<resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
</resource-env-ref>
But it keep failing.
How to solve this trouble?
You have to add a MySQL jdbc driver to the classpath.
Either put a MySQL binary jar to tomcat lib folder or add it to we application WEB-INF/lib folder.
You can find binary jar (Change version accordingly): https://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.27
When you encounter exceptions like this, the most useful information is generally at the bottom of the stacktrace:
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
...
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:246)
The problem is that Tomcat can't find com.mysql.jdbc.Driver. This is usually caused by the JAR containing the MySQL driver not being where Tomcat expects to find it (namely in the webapps/<yourwebapp>/WEB-INF/lib directory).
I use sprint-boot (2.1.1), and mysql version is 8.0.13. I add dependency in pom, solve my problem.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
MySQL Connector/J » 8.0.13 link: https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.13
MySQL Connector/J » All the version link:
https://mvnrepository.com/artifact/mysql/mysql-connector-java
I have also dealt with this exception after a fully working context.xml setup was adjusted. I didn't want environment details in the context.xml, so I took them out and saw this error. I realized I must fully create this datasource resource in code based on System Property JVM -D args.
Original error with just user/pwd/host removed:
org.apache.tomcat.jdbc.pool.ConnectionPool init
SEVERE: Unable to create initial connections of pool.
Removed entire contents of context.xml and try this:
Initialize on startup of app server the datasource object sometime before using first connection. If using Spring this is good to do in an #Configuration bean in #Bean Datasource constructor.
package to use: org.apache.tomcat.jdbc.pool.*
PoolProperties p = new PoolProperties();
p.setUrl(jdbcUrl);
p.setDriverClassName(driverClass);
p.setUsername(user);
p.setPassword(pwd);
p.setJmxEnabled(true);
p.setTestWhileIdle(false);
p.setTestOnBorrow(true);
p.setValidationQuery("SELECT 1");
p.setTestOnReturn(false);
p.setValidationInterval(30000);
p.setValidationQueryTimeout(100);
p.setTimeBetweenEvictionRunsMillis(30000);
p.setMaxActive(100);
p.setInitialSize(5);
p.setMaxWait(10000);
p.setRemoveAbandonedTimeout(60);
p.setMinEvictableIdleTimeMillis(30000);
p.setMinIdle(5);
p.setLogAbandoned(true);
p.setRemoveAbandoned(true);
p.setJdbcInterceptors(
"org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"+
"org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource();
ds.setPoolProperties(p);
return ds;
I am getting the above exception, and I don't know why.
Here is some more information:
Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql://localhost:3306/staffing_2014'
I am using Spring. In the Spring application context, I have the following dataSource:
<jee:jndi-lookup id="dataSource"
jndi-name="jdbc/StaffingDB"
expected-type="javax.sql.DataSource" />
It seems to read the database URL and credentials OK from tomcat's context.xml:
<Resource name="jdbc/StaffingDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="xxx" password="yyy" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/staffing_2014"/>
Before anyone suggests Googling it, I have. The obvious answers I've found have been:
Database URL malformed? - checked and OK.
MySQL driver in classpath? Yes- jar is in $TOMCAT_HOME/lib
Any other suggesions?
EDIT - way down the bottom:
java.sql.SQLException: No suitable driver
java.sql.DriverManager.getDriver(DriverManager.java:279)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
What version of Tomcat are you using? In some Tomcats (T5), TOMCAT_HOME/lib may not be the right location. You have to put the driver in Tomcat's endorsed folder which could be
TOMCAT_HOME/endorsed or
TOMCAT_HOME/shared/lib
Check your Tomcat setup.