################## # # # Tomcat example # # # ################## # $Id$ Scenario: --------- The Tomcat example shows how to integrate and use JOTM with Tomcat 4.1 to provide Transaction support to Servlets. For more information, on how to configure the Database, JOTM and Tomcat, please refer to the Examples guide[1] of JOTM [1] http://www.objectweb.org/jotm/doc/index.html Setup: ------ o JOTM is the Transaction Manager o Tomcat 4.1.x is the Servlet container o A database: - MySQL - PostgreSQL Database Setup: --------------- The database setup is the same than the JDBC example (see examples/jdbc/README.txt for more information) Compilation: ------------ Set JOTM_HOME to the directory of your JOTM distribution (e.g., .../jotm/output/dist from CVS) Then, type in this directory $ ant compile to compile the example (generated files are put in the output/ directory) Run the example: ---------------- To run the example, the following steps are: 1. Create the Web application o in this directory, type $ ant war it will create a war file (dbtest.war) in the output/ directory 2. Add the JDBC driver to Tomcat Download the JDBC driver corresponding to your database and copy it to the $CATALINA_HOME/common/lib/ directory 3. Copy JOTM files Copy in $CATALINA_HOME/common/lib/ the following jar files for JOTM lib/ directory: o jotm.jar o jotm_jrmp_stubs.jar o jonas_timer.jar o carol.jar o jta-spec1_0_1.jar o jts1_0.jar o objectweb-datasource.jar o xapool.jar Create a file named carol.properties in $CATALINA_HOME/common/classes/ with the following properties: carol.rmi.activated = lmi carol.jndi.start = false carol.ns.start = false 4. Deploy the web application o copy the file dbtest.xml to the webapps/ directory of Tomcat (it sets the context corresponding to the web application) o copy the file output/dbtest.war to the webapps/ directory of Tomcat 5. Start Tomcat o in the bin/ directory of Tomcat, type $ ./catalina.sh run 6. Browse the example o go in your browser to the URL http://localhost:8080/dbtest/test.jsp o choose if you wnat to commit or rollback the transaction: o if you choose "commit", the integer value stored in the database is incremented o if you choose "rollback", the value in the database does not change Enjoy!