Hi everybody, I am chaitanya, since few days I am struggling on how to establish connection pooling with tomcat6.0 and mysql4.1. I have searched may forums and web sites. I gathered some information and started connection pooling. But all my efforts went into vain. I am providing the my code. Please correct me where I am wrong.
This code went into server.xml
This code went into my application's web.xml file
After configuring server.xml and my web.xml I placed two copies of the mysql driver jar in my alpplication's lib folder and server's lib folder. Next the necessary class file was placed in classes folder under WEB-INF folder.
This is the listener class MyConnectionListener.java
This is my jsp page which tries to connect to the database using pooling.
When I try to execute this I am getting the following error.
Can anybody please help me. Can anybody post me a sample application which implements connection pooling. I have referred this site for help. Connection pooling
Open server.xml and look for the "/ConnectionPooling" context. Do you find several of them ? Remove unwanted ones. I think it would even look better to remove that from server.xml, and make your own context file under /conf/Catalina/localhost.
Apparently you are attempting to publish multiple webapps under the context name of /ConnectionPooling. Each deployed webapp in Tomcat must have a unique context name, since that's how the URLs get routed to specific webapps. So you need to find and remove the duplicates from wherever they are.
For what you're doing you really shouldn't be modifying server.xml at all. For several years now, that's been discouraged, since it has significant disadvantages. It's better to make context XML files in $TOMCAT_HOME/conf/Catalina/localhost. DON'T attempt to define a context in both server.xml and conf/catalina/localhost, since Tomcat treats them as though they were all one big file, and that will give you a "duplicate context name" error.
If you're using that infernal useless Eclipse WST web plugin, it WILL muck with server.xml, but you shouldn't. Neither should they, technically, but they insist that they want to be compatible with Tomcat 3, even though even Tomcat 4 went end-of-life years ago.
Also, JDBC drivers should be placed in the Tomcat lib directory and NOT in the WAR. If you put a driver jar in both places, you may end up with classpath problems.
An IDE is no substitute for an Intelligent Developer.
Hi Christophe, hi Tim, thanks for helping me. But I didn't understand anything, and I am a beginner in connection pooling, I have read a lot, I understood what the concept is, but unable to implement. Please can you give me a link where I can learn this?