abishkar bhattarai
abishkar bhattarai

Reputation: 7651

tomcat jdbc and spring version compatability

I am using apache-tomcat-6.0.37, spring 2.5.6 and tomcat-jdbc-7.0.19.When configuring org.apache.tomcat.jdbc.pool.DataSource in xml file, I am getting this error:

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.tomcat.jdbc.pool.DataSource].

Does spring 2.5.6 does not support tomcat-jdbc-7.0.19? Do it need higher version of spring? At this current moment I can not shift to higher version. Do I need to get conform?

Upvotes: 0

Views: 1154

Answers (4)

abishkar bhattarai
abishkar bhattarai

Reputation: 7651

The problem is solved .Though the class path of jar was present in .class file generated by ecclipse .I have forgotten to include in build.xml.So the jar was missing in lib of tomcat.

Upvotes: 0

Michael-O
Michael-O

Reputation: 18415

Your JARs are outdated first of all.

  1. Update to the most recent Tomcat JDBC Pool
  2. Put that JAR and your driver into $CATALINA_*/lib and nowhere else (* == HOME or BASE)
  3. Declare your DataSource in your context.xml
  4. Retrieve that DataSource from your beans.xml with a JNDI lookup

Tomcat JDBC Pool works flawlessly with Tomcat 6 as long as your run Java 6.

Here is a very similar question.

Upvotes: 0

Himanshu Bhardwaj
Himanshu Bhardwaj

Reputation: 4123

Right now the error you are getting is Cannot find class, this means that the following class is not in the classpath. You should check if jar is present in classpath or not.

Probable location (Since it doesn't get shipped with tomcat-6.x):

  1. WEB-INF/lib directory of war file.

By reading from the documentation, I guess tomcat-jdbc is something introduced in tomcat-7.x not in tomcat-6.x so I doubt if it will work as expected.

Link of interest: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

Upvotes: 1

Related Questions