Yeah, I wish this stuff was easier to install and configure.   Too bad this JTA 
stuff hasn't been picked up by servlet containers as part of the core.

To help debug this problem, here's the source for a .jsp file which does the 
same thing we do.  Usually once this works, DataServiceTransaction.begin(true) 
will work too:

<%@ page import="javax.transaction.UserTransaction" %>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="javax.naming.Context" %>
<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("returned null");
            }
        }
        catch (Exception ne)
        {
            out.println(ne.toString());
        }
%>

done

</body>

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey
Sent: Monday, August 04, 2008 2:51 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DataServiceException


I just went through installing/configuring JTA using JOTM(which was
not as straight forward as the docs say) with Tomcat.

The bummer is that I can't debug into the DataServiceTransaction
class... no source.

I guess I could try passing "false" to the begin method, but I should
be able to use JOTM.

BTW, thanks for your help on that other LCDS issue.

--- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Jeff 
Vroom <[EMAIL PROTECTED]> wrote:
>
> When you create a DataServiceTransaction, especially with "true" so
it needs to start a JTA transaction, it is look in the JNDI namespace
for the standard UserTransaction object i.e. new
InitialContext().lookup("java:comp/UserTransaction"). That call is
not working... if you are not in a JEE container or Tomcat with JOTM
installed that would explain it. You can try passing "false" to
begin and that would avoid use of the JTA transaction manager.
>
> Jeff
>
> From: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com> 
> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>]
On Behalf Of Geoffrey
> Sent: Monday, August 04, 2008 1:31 PM
> To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] DataServiceException
>
>
> I'm trying to create a DataServiceTransaction to push an update out to
> my DataService clients. I'm getting the below error when it tries to
> create the DataServiceTransaction.
>
> flex.data.DataServiceException: Unable to access UserTransaction in
> DataService.
> at
>
flex.data.DataServiceTransaction.doBegin(DataServiceTransaction.java:855)
> at
> flex.data.DataServiceTransaction.begin(DataServiceTransaction.java:807)
> at
> flex.data.DataServiceTransaction.begin(DataServiceTransaction.java:270)
> at
> flex.data.DataServiceTransaction.begin(DataServiceTransaction.java:283)
> ...
>
> My code is:
> DataServiceTransaction dst = DataServiceTransaction.begin(true);
> dst.refreshFill("myTasks", null);
> dst.commit();
>
> Any ideas?
> Geoff
>

<<inline: image001.jpg>>

<<inline: image002.jpg>>

Reply via email to