After a couple days of fussing around, I was able to successfully
integrate JOTM into our webapp, and thought that I'd share what I did.
 Hopefully it will be useful to someone else.


Environment:
Eclipse 3.3.1.1
Tomcat 6.0.16
LCDS 2.5.1
JOTM 2.0.10


Installation:
1) Download JOTM 2.0.10 from http://forge.objectweb.org/projects/jotm/
if you don't already have it.
2) Unzip to c:\
3) Link those jars to Tomcat
        a. Double-click Tomcat definition in the Servers tab of Eclipse.
        b. Click "Open launch configuration".
        c. Select the Classpath tab.
        d. Select "User Entries", and then "Add External JARs".
        e. Navigate to C:\jotm-2.0.10\lib.
        f. Select all classes except commons-logging.jar and log4j.jar.
        g. Apply the changes and exit Tomcat properties.
        h. (optional) test JOTM installation by starting the server and
accessing the below JSP file*.  Success will be obvious.
4) Edit your META-INF\context.xml to include the following line:
        <Transaction name="UserTransaction" auth="Container"
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>


You should now be able to perform create, delete, and update
operations on a managed collection of a DataService.


* Optional JSP file(I got this from someone in this forum, but can't
remember who)
<%@ page import="javax.transaction.UserTransaction" %>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="javax.naming.Context" %>
<[EMAIL PROTECTED] import="javax.naming.NamingException"%>
<body>
start<br/>
<%
        try
        {
            Context ctx = new InitialContext();
 
            String userTransactionJndi = "java:comp/UserTransaction";
            String userSpecified = System.getProperty("UserTxJndiName");
            if (userSpecified != null)
            {
                userTransactionJndi = userSpecified;
            }
            UserTransaction userTransaction = (UserTransaction)
ctx.lookup(userTransactionJndi);
            if (userTransaction != null)
            {
                userTransaction.begin();
                out.println("begin ok!<br>");
                userTransaction.commit();
                out.println("commit ok!<br>");
            }
            else
            {
                out.println("Context returned null userTransaction");
            }
        }
                catch (NamingException ne)
                {
                    out.println(ne.toString());
                }
                catch (Exception e)
                {
                    out.println(e.toString());
                }
%>
done
</body>

Reply via email to