aspose file tools*
The moose likes Tomcat and the fly likes Problem in implementing connection pooling in tomcat6.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem in implementing connection pooling in tomcat6.0" Watch "Problem in implementing connection pooling in tomcat6.0" New topic
Author

Problem in implementing connection pooling in tomcat6.0

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

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

Thank you all in advance.

Love all, trust a few, do wrong to none.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

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?

Thank you in advance.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Thanks everybody for your help, I have done it.
I referred this site: click here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in implementing connection pooling in tomcat6.0