Daniel Harfleet

Delivering user-centric applications on the Adobe Flash Platform using Flex and AIR

Unable to access UserTransaction in DataService

leave a comment »

In a project I am working on at the moment, I had an entity which was managed and when an update occurred on this entity, I got the following stack trace:


[RPC Fault faultString="Unable to access UserTransaction in DataService." faultCode="Server.Processing" faultDetail="null"]


at mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::dispatchFaultEvent()[C:\depot\DataServices\trunk\frameworks\projects\data\src\mx\data\ConcreteDataService.as:3353]

at mx.data::CommitResponder/fault()[C:\depot\DataServices\trunk\frameworks\projects\data\src\mx\data\CommitResponder.as:181]

at mx.rpc::AsyncRequest/fault()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:113]

at NetConnectionMessageResponder/statusHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:604]

at mx.messaging::MessageResponder/status()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:264]

after a little digging around, from what I can work out is that Data Management in LCDS (v 2.3.1) requires the JOTM transaction libraries which are under [LCDS]/tomcat/lib/jotm2.0.10  .

However, if you want your war to find the libraries, you need to add (or update) context.xml to [your project]/[root folder]/META-INF/ with the following:

<?xml version="1.0" encoding="UTF-8"?>
<Context reloadable="true">
<Transaction factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
</Context>

If you are JSP skilled, you can also create a quick test jsp to check its working:

<%@page import=”javax.transaction.UserTransaction”%>
<%@page import=”javax.naming.Context”%>
<%@page import=”javax.naming.InitialContext”%><%@ page  %>
<% Context context= new InitialContext();
UserTransaction transaction = (UserTransaction) context.lookup(“java:comp/UserTransaction”);
transaction.begin();
transaction.commit();
%>
Transactions are working

Advertisements

Written by dharfleet

August 26, 2010 at 14:00

Posted in LCDS

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: