I have java web application using Spring, Hibernate, Tomcat7 & MySql. I use Datasource for database operations. I am not very clear about what is the standard location to load the jar files (Tomcat-jdbc.jar
& Mysql-connector.jar
) from? It works if I keep BOTH the jars either in CATALINA_HOME/lib/
or webapps/myApp/WEB-INF/lib
. But I was told to use only the Tomcat-jdbc from CATALINA_HOME/lib/ and mysql-connector.jar
from /WEB-INF/lib/
, which gives a ClassNotFound
Exception for Sql Driver
. Can someone let me know which is the right location for these jars?
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="${db.url}" />
<property name="username" value="${db.username}" />
<property name="password" value="${db.password}" />
<property name="initialSize" value="${db.initialSize}" />
<property name="minIdle" value="${db.minIdle}" />
<property name="maxActive" value="${db.maxActive}" />
<property name="maxIdle" value="${db.maxIdle}" />
<property name="testWhileIdle" value="${db.testWhileIdle}" />
<property name="minEvictableIdleTimeMillis" value="${db.minEvictableIdleTimeMillis}" />
<property name="timeBetweenEvictionRunsMillis" value="${db.timeBetweenEvictionRunsMillis}" />
<property name="validationQuery" value="${db.validationQuery}" />
</bean>