The Jakarta Project The Jakarta Slide Project

Main

Resources

User's Guide

Administrator's Guide

HOW-TOs

Programmer's Corner

Slide API

Reference

Building the store

In order to use the J2EE stores you need to build Jakarta-Slide with the Datasource classes available. They are included in JDK1.4 but earlier versions require an additional library (jdbc2_0-stdext.jar) in the slide lib directory.

Configuring Slide

In order to use the stores, the Domain.xml file needs to contain the following configuration for the store:

<definition>
    <store name="j2ee">
        <nodestore classname="slidestore.j2ee.J2EEDescriptorsStore">
            <parameter name="datasource">jdbc/mtx</parameter>
        </nodestore>
        <securitystore>
            <reference store="nodestore"/>
        </securitystore>
        <lockstore>
            <reference store="nodestore"/>
        </lockstore>
        <revisiondescriptorsstore>
            <reference store="nodestore"/>
        </revisiondescriptorsstore>
        <revisiondescriptorstore>
            <reference store="nodestore"/>
        </revisiondescriptorstore>
        <contentstore classname="slidestore.j2ee.J2EEContentStore">
            <parameter name="datasource">jdbc/mtx</parameter>
        </contentstore>
    </store>
    <scope match="/" store="j2ee"/>
</definition>

Configuring Tomcat 4.x

In order to use this with Tomcat you need to setup the datasource. Instructions for this are at http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html.

If you follow the above instructions you will make changes similar to the following in web.xml and server.xml.

web.xml
<resource-ref>
    <description>Testing Tomcat-wide datasource usage</description>
    <res-ref-name>jdbc/mtx</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

server.xml
<DefaultContext debug="99">
    <Resource name="jdbc/mtx" auth="Container" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/mtx">
        <parameter>
            <name>user</name>
            <value>bar</value>
        </parameter>
        <parameter>
            <name>password</name>
            <value>foo</value>
        </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>org.hsqldb.jdbcDriver</value>
        </parameter>
        <parameter>
            <name>driverName</name>
            <value>jdbc:hsqldb:slide</value>
        </parameter>
    </ResourceParams>
</DefaultContext>

Troubleshooting

A couple of general notes in case you encounter problems.

It is important that the only jndi.jar, naming.jar and jdbc.jar's and your jdbc driver are in the %CATALINA_HOME%/common/libs and/or %CATALINA_HOME%/libs folders.

If slide loads any of the classes from its own classloder it will either not find the tomcat datasource or it will fail to load the DB drivers.

With Tomcat 4.0.1 the standard implementation provides a datasource which has pooling. It has no configured limits, it will grow as required and lazily shrinks to reduce its size. Tomcat also has the capability to support other datasource implementations and will offer one based on the Apache commons DBCP pool implementation in version 4.1.


Copyright © 1999-2001, Apache Software Foundation