This content has been marked as final. Show 3 replies
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.html
i. 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"/>
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");
(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.
Thanks so much for your technical advice. I'm doing something wrong since I could not get it to run due to my limited expertise in setting up servers, configuration files, etc. So I gave up.
Instead, I reinstalled with the Integrated Jrun instead of the custom install with all the manual tweaking needed with Tomcat.
The samples webapps worked fine on the first try with Jrun. In addition, other problems I had with latest Tomcat 5.5, such as running out of memory during loading are all gone when using Jrun (and I do have 1.5 gigs of ram.. so tomcat must be leaking somewhere).
Anyway, I finally have a working local server to play with now.
> with latest Tomcat 5.5, such as running out of memory during loading
Depending on the application server default memory for the application jvm, you may need to increase the default memory. As I recall, this is the case with Tomcat. For the integrated JRun, we run with the following jvm memory args -Xms32m -Xmx384m. You could start with that.