Announcement Announcement Module
No announcement yet.
Petclinic Database Setup--JNDI connection-pool with Tomcat Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Petclinic Database Setup--JNDI connection-pool with Tomcat

    I am testing The Spring Petclinic Application with mysql database, it is ok with the Local DataSource with Spring's DriverManagerDataSource. However, I want to use a JNDI connection-pooled datasource which is essential to real production apps. I am not clear how is such a data source configured.

    The Petclinic documentation has the following statement:
    To use a J2EE server supplied connection-pooled data source with Tomcat, it will be necessary to use and possibly edit the appropriate context definition file for the petclinic webapp. To use it, deploy a copy of the appropriate context definition file in Tomcat's webapps directory and restart the server. Consult the Tomcat log files if something goes wrong when starting either Tomcat or the Petclinic application. The context files are named petclinic_tomcat_*.xml...

    I am not sure what "Tomcat's webapps directory" means (Tomcat /webapps? ) and what other configurations should be made in e.g. web.xml, applicationContext-jdbc.xml. Or should the contents of petclinic_tomcat_mysql.xml be copied to Tomcat /conf/server.xml?

  • #2
    for more information on configuring datasources with tomcat, please take a look at JNDI Datasource HOW-TO.


    • #3
      Thanks a lot!

      I tried to copy the context entity from petclinic_tomcat_mysql.xml into tomcat/config/server.xml, and still not work.

      what i want is a JNDI DataSource for J2EE environments specified in the applicationContext.xml file for the following data source bean:

      <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
      <property name="jndiName"><value>java:comp/env/jdbc/petclinic</value></property>

      I wonder if any body have tested the Petclinic application with a JNDI connection-pool.


      • #4
        I also have the same problem as yours. And I try the "JNDI Datasource HOW-TO", it's fine, I thought since the they implemented in different ways.
        BTW, have found the solution?



        • #5
          yes i got the solution thanks.

          it is a matter of the directory to put the tomcat configure file