If you're getting the error message - "Unable to access
UserTransaction in DataService", then your transaction services is
not set up correctly. There is not enough detail in your message to
diagnosis what the issue is but this is what I would recommend and
the configuration that works for me.
(a) During development, get in the habit of running the
server in debug mode and check for errors in the server console and
logs frequently, especially when you encounter errors on the
client.
For FDS, you'll want to set debug level logging in
enterprise-services.xml. Restart the server after making changes.
(b) Double-check that JOTM is configured correctly.
These are the steps I used to get Flex running with Tomcat
5.5.17 and JOTM 2.0.10 - the latest versions.
With Tomcat, there are several different ways of configuring
the server so this is not the only way of doing things. The
directions under 'Configuring Tomcat' seems to have the most
details for all versions of Tomcat -
http://static.raibledesigns.com/downloads/howto-tomcat-jotm.htmli. drop the JOTM jars into <tomcat>/common/lib
ii. add the following line to my application configuration
file <tomcat>/conf/Catalina/localhost/samples.xml
<Context
docBase="c:/dev/flex/enterprise/apps/j2ee/samples"
privileged="true" antiResourceLocking="false"
antiJARLocking="false">
....
<Transaction
factory="org.objectweb.jotm.UserTransactionFactory"
jotm.timeout="60"/>
....
</Context>
iii. restart the server for good measure, check the logs
localhost-xxxx.log and catalina-xxx.log to be sure that everything
started correctly.
(c) Verify that transactions are working correctly with this
test JSP page. Just drop the jsp page into your web application and
access from the browser. If you see an exception, go back to the
JOTM setup. If you see, 'success'. Then proceed with the contact
manager example.
<%@ page import="javax.naming.*,javax.transaction.*" %>
<%
Context ctx = new InitialContext();
UserTransaction tx =
(UserTransaction)ctx.lookup("java:comp/UserTransaction");
tx.begin();
tx.commit();
%>
success!
(d) Run the contact manager sample and try to update a
contact. If you see "Unable to access UserTransaction in
DataService", then check the server console and server logs for
errors and/or exceptions.
- Cathy