Configuring Tomcat for PrologBeans

This section will briefly describe how to set up a Tomcat server so that is it possible to test the example JSPs. Some knowledge about how to run Tomcat and how to set up your own web application is required. Detailed information about Tomcat is available at http://jakarta.apache.org/tomcat/.

Assuming that you are positioned in the Tomcat installation directory, do the following:

  1. Add the prologbeans.jar to the common/lib/ directory. Note that this will give all Tomcat applications access to the PrologBeans system. There are other options for importing prologbeans.jar that might be better for your type of application.
  2. In the conf/server.xml file add the following (after the Tomcat Root Context tags - shown as the first lines below):
              [...]
              <!-- Tomcat Root Context -->
              <!--
                <Context path="" docBase="ROOT" debug="0"/>
              -->
              
              
              <DefaultContext>
                 <Resource name="prolog/PrologSession" auth="Container"
                           type="se.sics.prologbeans.PrologSession"/>
              
                 <ResourceParams name="prolog/PrologSession">
                   <parameter>
                     <name>factory</name>
                     <value>org.apache.naming.factory.BeanFactory</value>
                   </parameter>
                   <parameter>
                     <name>port</name>
                     <value>8066</value>
                   </parameter>
                 </ResourceParams>
              </DefaultContext>
              [...]
              
    This will register a PrologSession instance under the name prolog/PrologSession so that it is possible to do a JNDI lookup.
  3. In your application's web.xml file, found in Tomcat's webapps/your_application/WEB-INF directory, you need the following resource reference:
                  <resource-ref>
                    <res-ref-name>prolog/PrologSession</res-ref-name>
                    <res-type>se.sics.prologbeans.PrologSession</res-type>
                    <res-auth>Container</res-auth>
                  </resource-ref>
              
  4. Copy the example JSP files that you want to use (sessionsum.jsp and evaluate.jsp) into the Tomcat web application directory (webapps/your_application).
  5. Start the Tomcat server.
  6. Start the example that you want to test (pbn-exa shows how to start one of the examples).