Andreas Hess // Computer // UDDI // Tomcat

How to Setup Tomcat for jUDDI

In some cases, jUDDI does not read the connection data properly from the properties. This is probably dependent on your installation or on the version of jUDDI or Tomcat. In these cases the conf/server.xml file of Tomcat needs to be changed. You will have to add a new context in the server.xml file.

For Tomcat 4

  <Context path="/juddi" docBase="juddi"
              debug="5" reloadable="true" crossContext="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="localhost_juddiDB_log" suffix=".txt"
              timestamp="true"/>
    <Resource name="jdbc/juddiDB"
              auth="Container"
              type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/juddiDB">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>

      <!-- Maximum number of dB connections in pool. Make sure
           you configure your mysqld max_connections large enough to
           handle all of your db connections. Set to 0 for no limit.
        -->

    <parameter>
       <name>maxActive</name>
       <value>100</value>
     </parameter>

     <!-- Maximum number of idle dB connections to retain in
         pool. Set to 0 for no limit.
     -->

      <parameter>
        <name>maxIdle</name>
        <value>30</value>
      </parameter>

      <parameter>
        <name>maxWait</name>
        <value>10000</value>
      </parameter>

      <!-- MySQL dB username and password for dB connections  -->

      <parameter>
        <name>username</name>
        <value>juddi</value>
      </parameter>

      <parameter>
        <name>password</name>
        <value>password</value>
      </parameter>

      <!-- Class name for mm.mysql JDBC driver -->

      <parameter>
        <name>driverClassName</name>
        <value>org.gjt.mm.mysql.Driver</value>
      </parameter>

      <!-- The JDBC connection url for connecting to your MySQL dB.
           The autoReconnect=true argument to the url makes sure
           that the mm.mysql JDBC Driver will automatically reconnect if
           mysqld closed the connection.
           mysqld by default closes idle connections after 8 hours.
       -->

      <parameter>
        <name>url</name>
        <value>jdbc:mysql://localhost:3306/jUDDI?autoReconnect=true</value>

      </parameter>
    </ResourceParams>
  </Context>

Thanks to "freeman" for pointing this out to me. He also pointed me to a mailing list mail that might contain valuable information if you have trouble getting jUDDI to work.

For Tomcat 5

In Tomcat 5, the syntax for the server.xml file has changed.

<Context path="/juddi" docBase="juddi" debug="5" reloadable="true" crossContext="true">
  <Resource name="jdbc/juddiDB" auth="Container" type="javax.sql.DataSource"
            username="juddi" password="juddi" driverClassName="org.gjt.mm.mysql.Driver"
            url="jdbc:mysql://localhost:3306/juddi?autoReconnect=true"
            validationQuery="select count(*) from PUBLISHER" />  
</Context>

Thanks to Steven Hulshof for contributing the XML snippet for Tomcat 5.

Note

Note that all these settings that were discussed above are for MySQL! If you use any other database, you have to edit the above properties differently. The jdbcDriver property is sun.jdbc.odbc.JdbcOdbcDriver for any database that is connected through ODBC. If you have configured DB2 with the Client Configuration assistant, access is through ODBC. The database name is then jdbc:odbc:juddi (if your ODBC data source is called juddi).


26 Mar 2007, Andreas Hess, andreas at idirlion dot de