0

Possible Duplicate:
ClassCastException DataSource cannot be cast to javax.sql.ConnectionPoolDataSource

How to make tomcat-jdbc.jar work with Tomcat 6?

We have an application that was designed to be deployed in Tomcat 6 however due to fixes we did, we needed to put JDBC pool codes, that I believe only works with Tomcat 7? Since tomcat 6 is already in our production server, I may need to make JDBC pool work with Tomcat 6?

*I was doing my local development for our application and use Tomcat7 for debugging, that I forgot that we use Tomcat6 in production**

Update:

When I run in tomcat 6 I get this exception:

java.lang.ClassCastException: org.apache.tomcat.jdbc.pool.DataSource cannot be cast to javax.sql.ConnectionPoolDataSource

When it works without problems in Tomcat7...

Community
  • 1
  • 1
quarks
  • 33,478
  • 73
  • 290
  • 513

1 Answers1

3

This is fairly easy, I am running Tomcat JDBC for more than a year now on Tomcat 6. Configure it as you would configure a normal DataSource but put the JAR in Tomcat's lib dir and add the factory attribute with the value org.apache.tomcat.jdbc.pool.DataSourceFactory to your Resource element.

Off topic: Just a tip, always use the same Tomcat version for testing as you would use for production.

Michael-O
  • 18,123
  • 6
  • 55
  • 121
  • I have configured tomcat 7 jdbc in tomcat 6 for more than a year now with the way that you suggest and it works fine apart from an exception that I get every now and then related to the PoolCleaner. Do you get this exception too? Here is more details about the exception http://stackoverflow.com/q/17473483/2105307 – NikosDim Jun 19 '14 at 10:56
  • @NikosDim, I don't ever had this one. I will continue on the question mentioned. – Michael-O Jun 19 '14 at 11:11