Jakarta Tomcat Configuration

  1. Place TM4J JAR files and library JAR files into the $TOMCAT_HOME/common/lib folder (make sure that these JAR files are ONLY contained in this directory of your TOMCAT installation or you will get the dreaded ClassCastException)

    Note

    The TM4J JAR files must NOT be placed inside the webapps lib folders or they will be loaded with a different classloader!

  2. Add the following to the server.xml file of tomcat (inside the <GlobalNamingResources> element)
    ...................
      <Resource name="TM4JProvider" auth="Container" 
    		scope="Shareable" type="org.tm4j.topicmap.TopicMapProvider"/>
      	<ResourceParams name="TM4JProvider">
      		<parameter>
        		<name>factory</name>
        		<value>org.tm4j.jndi.spi.ProviderFactory</value>
      		</parameter>
      </ResourceParams>
    ......................
               
  3. For every webapp that wants to access this provider, add a Context element and a ResourceLink element, linking the global entry to the local name, to the server.xml. For example:
    ............
     <Context className="org.apache.catalina.core.StandardContext" 
            	cachingAllowed="true" 
            	charsetMapperClass="org.apache.catalina.util.CharsetMapper" 
            	cookies="true" 
            	crossContext="true" 
            	debug="9" 
            	displayName="jndi sharing test" 
            	docBase="C:\Programme\Apache Group\Tomcat 4.1\webapps\JNDIProvider" 
            	mapperClass="org.apache.catalina.core.StandardContextMapper" 
            	path="/JNDIProvider" 
            	privileged="false" 
            	reloadable="true" 
            	swallowOutput="false" 
            	useNaming="true" 
            	wrapperClass="org.apache.catalina.core.StandardWrapper">
    <ResourceLink global="TM4JProvider" name="provider" 
    		type="org.tm4j.topicmap.TopicMapProvider"/>
    </Context>
    ..............
               

    Note

    Replace the docBase and path elements with the ones for your webapp