I am trying to create a standalone spring pool for tomcat-dbcp using tomcat-dbcp.jar version 7.0.30
However, it appears that the class org.apache.tomcat.jdbc.DataSource is specified in the Tomcat documentation (http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Standalone)
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"
destroy-method="close">
<property name="factory"
value="org.apache.tomcat.jdbc.pool.DataSourceFactory" />
<property name="type" value="javax.sql.DataSource" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ym" />
<property name="username" value="admin" />
<property name="password" value="admin" />
<property name="initialSize" value="5" />
<property name="maxActive" value="10" />
</bean>
So, this spring bean definition is correct according to the Tomcat doc, however, when I run the application, I get a CNF exception:
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.tomcat.jdbc.pool.DataSource] for bean with name 'dataSource' defined in class path resource [application-context.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSource
I was super stupid and missed the obvious here.
source
share