When you use Data Management Services to update objects on the server
side, and your destination has use-transactions=true, FDS will create a
JTA transaction before it calls your assembler methods.  The problem you
are running into is that this code is failing... it is a pretty standard
set of features for a J2EE server though servlet containers don't
usually support JTA "out of the box".   You might be able to workaround
this problem by setting use-transactions=false on your destinations
though you'll still need JTA libraries to be available to satisfy
linkage.  

 

Here's a JSP file which you can use to test the transaction support in
your servlet container:

 

<%@ 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: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Shailesh Mangal
Sent: Sunday, May 27, 2007 2:56 PM
To: [email protected]
Subject: [flexcoders] Re: Jetty with JOTM causes ClassCastException in
FDS

 

I decided to try tomcat, only to get following (version 5.5.15)

[Flex] cause=javax.naming.NamingException: Cannot create resource
instance type=class javax.naming.NamingException
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.TransactionFactory.getObjectInstance(Transacti
onFactory.java:98)
at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:792)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at
flex.data.DataServiceTransaction.doBegin(DataServiceTransaction.java:653
)
at
flex.data.DataServiceTransaction.begin(DataServiceTransaction.java:624)
at
flex.data.DataService.serviceTransactedMessage(DataService.java:474)
at flex.data.DataService.serviceMessage(DataService.java:241)
at
flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:54
8)
at
flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoin
t.java:302)
at
flex.messaging.endpoints.rtmp.AbstractRTMPServer.dispatchMessage(Abstrac
tRTMPServer.java:682)
at
flex.messaging.endpoints.rtmp.NIORTMPConnection$RTMPReader.run(NIORTMPCo
nnection.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker
.runTask(ThreadPoolExecutor.java:643)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker
.run(ThreadPoolExecutor.java:668)

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Shailesh Mangal"
<[EMAIL PROTECTED]> wrote:
>
> Adding to this, I found that I can read the data (using Fill()) but as
> soon I use createItem(), FDS blows up (giving ClassCastException)
> 
> -Shailesh
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "Shailesh Mangal"
> <shailesh.mangal@> wrote:
> >
> > Hi All, 
> > 
> > After struggling for a quite a while, I was able to configure Jetty
> > with JOTM (to a point where it starts cleanly).
> > 
> > Now I am getting a ClassCast Exception in JNDILookup. Wondering if
> > anyone has come across following error (FDS output in Debug mode).
> > Same issue is discussed on in decent depth,
> > http://tech.groups.yahoo.com/group/flexcoders/message/51486
<http://tech.groups.yahoo.com/group/flexcoders/message/51486>  but no
> > concrete solution suggested. 
> > 
> > 
> > [Flex] Error handling rtmp message: flex.data.DataServiceException:
> > Unable to access UserTransaction in DataService.
> > incomingMessage: Flex Message (flex.data.messages.DataMessage) 
> > operation = transacted
> > id = null
> > clientId = D9CE4977-870F-8C20-2C39-C6D4DA7BB599
> > correlationId = 
> > destination = loginService
> > messageId = 466A87F6-D404-76D9-361C-C7CE219FDB80
> > timestamp = 1180173215095
> > timeToLive = 0
> > body = 
> > [
> > Flex Message (flex.data.messages.DataMessage) 
> > operation = create_and_sequence
> > id = ASObject(10255870){id=1234}
> > clientId = 03D24138-E112-748E-2BED-C7CE1F822C65
> > correlationId = 466A87F6-D404-76D9-361C-C7CE219FDB80
> > destination = loginService
> > messageId = 6C4AEB83-B4A2-73F6-5541-C7CE219CF4BB
> > timestamp = 0
> > timeToLive = 0
> > body = [EMAIL PROTECTED]
> > ]
> > hdr(DSEndpoint) = my-rtmp
> > errorReply: Flex Message (flex.messaging.messages.ErrorMessage) 
> > clientId = null
> > correlationId = 466A87F6-D404-76D9-361C-C7CE219FDB80
> > destination = loginService
> > messageId = D9CE49A3-790B-1933-0AD6-36F523BDEB89
> > timestamp = 1180173215113
> > timeToLive = 0
> > body = null
> > code = Server.Processing
> > message = Unable to access UserTransaction in DataService.
> > details = null
> > rootCause = java.lang.ClassCastException:
> org.objectweb.jotm.Current
> > body = null
> > extendedData = null
> > [Flex] cause=java.lang.ClassCastException:
org.objectweb.jotm.Current
> > type=class java.lang.ClassCastException
> > java.lang.ClassCastException: org.objectweb.jotm.Current
> > at
> >
>
flex.data.DataServiceTransaction.doBegin(DataServiceTransaction.java:653
)
> > at
> >
flex.data.DataServiceTransaction.begin(DataServiceTransaction.java:624)
> > at
> > flex.data.DataService.serviceTransactedMessage(DataService.java:474)
> > at flex.data.DataService.serviceMessage(DataService.java:241)
> > at
> >
>
flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:54
8)
> > at
> >
>
flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoin
t.java:302)
> > at
> >
>
flex.messaging.endpoints.rtmp.AbstractRTMPServer.dispatchMessage(Abstrac
tRTMPServer.java:682)
> > at
> >
>
flex.messaging.endpoints.rtmp.NIORTMPConnection$RTMPReader.run(NIORTMPCo
nnection.java:665)
> > at
> >
>
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker
.runTask(ThreadPoolExecutor.java:643)
> > at
> >
>
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker
.run(ThreadPoolExecutor.java:668)
> > at java.lang.Thread.run(Thread.java:613)
> >
>

 

Reply via email to