Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Problem in implementing connection pooling in tomcat6.0

 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 25468
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everybody for your help, I have done it.
I referred this site: click here
 
You got style baby! More than this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic