I think that somehow you have got two versions of the UserTransaction
class in your classpath. Maybe you followed the tomcat instructions for
installing JOTM? If so, that is not necessary (and will break) jboss.
Here's a simple JSP you can use to debug this problem without DS in the
way:
<%@ 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>
When this works, DS with use-transactions=true should also work.
Jeff
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of mancer82
Sent: Monday, August 27, 2007 9:17 AM
To: [email protected]
Subject: [flexcoders] Issue with transactions on Data Management Service
Hello, I'm actually creating an application for a library and I'm
running it on JBoss 4.2.0.GA with underlying DB2 8.2.
The application relies on a POJO + Hibernate3 server backend,
communicating with the Flex client thru Data Management Service
destinations.
The problem I get is the following; as long as I ask for records using
the dataservice.fill() method, I encounter no issue and the app works
fine. But as soon as I try to create a new item, or modify an existing
one, I get this error in STDOUT:
2004-10-24 20:26:35,125 INFO [STDOUT] [Flex] Exception when invoking
service: data-service
with message: Flex Message (flex.data.messages.DataMessage)
operation = transacted
id = null
clientId = 81828BBA-8E7A-B668-86B3-76D34BF1071F
correlationId =
destination = utente.hibernate
messageId = ADE53343-F3F1-D938-A31D-CC308E3F66B1
timestamp = 1098642394734
timeToLive = 0
body =
[
Flex Message (flex.data.messages.DataMessage)
operation = create_and_sequence
id = ASObject(19507034){id=2004901826687}
clientId = 43BC3541-8881-F29B-B186-CC3039979243
correlationId = ADE53343-F3F1-D938-A31D-CC308E3F66B1
destination = utente.hibernate
messageId = 59933554-59E2-8624-EA5B-CC308E3F279A
timestamp = 0
timeToLive = 0
body = [EMAIL PROTECTED]
]
hdr(DSEndpoint) = my-rtmp
exception: flex.data.DataServiceException: Unable to access
UserTransaction in DataService.
2004-10-24 20:26:35,125 INFO [STDOUT] [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 = 81828BBA-8E7A-B668-86B3-76D34BF1071F
correlationId =
destination = utente.hibernate
messageId = ADE53343-F3F1-D938-A31D-CC308E3F66B1
timestamp = 1098642394734
timeToLive = 0
body =
[
Flex Message (flex.data.messages.DataMessage)
operation = create_and_sequence
id = ASObject(19507034){id=2004901826687}
clientId = 43BC3541-8881-F29B-B186-CC3039979243
correlationId = ADE53343-F3F1-D938-A31D-CC308E3F66B1
destination = utente.hibernate
messageId = 59933554-59E2-8624-EA5B-CC308E3F279A
timestamp = 0
timeToLive = 0
body = [EMAIL PROTECTED]
]
hdr(DSEndpoint) = my-rtmp
errorReply: Flex Message (flex.messaging.messages.ErrorMessage)
clientId = null
correlationId = ADE53343-F3F1-D938-A31D-CC308E3F66B1
destination = utente.hibernate
messageId = 81828F75-2508-726A-7B40-2ECD5E71CF75
timestamp = 1098642395125
timeToLive = 0
body = null
code = Server.Processing
message = Unable to access UserTransaction in DataService.
details = null
rootCause = java.lang.ClassCastException:
org.jboss.tm.usertx.client.ServerVMClientUserTransaction cannot be
cast to javax.transaction.UserTransaction
body = null
extendedData = null
2004-10-24 20:26:35,125 INFO [STDOUT] [Flex]
cause=java.lang.ClassCastException:
org.jboss.tm.usertx.client.ServerVMClientUserTransaction cannot be
cast to javax.transaction.UserTransaction type=class
java.lang.ClassCastException
java.lang.ClassCastException:
org.jboss.tm.usertx.client.ServerVMClientUserTransaction cannot be
cast to javax.transaction.UserTransaction
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:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker
.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:619)
2004-10-24 20:26:35,140 INFO [STDOUT] [Flex] Serializing AMF/RTMP
response
Version: 3
(Command method=_error (0) trxId=17)
(Typed Object #0 'flex.messaging.messages.ErrorMessage')
headers = (Object #1)
rootCause = (Typed Object #2 'java.lang.ClassCastException')
message =
"org.jboss.tm.usertx.client.ServerVMClientUserTransaction cannot be
cast to javax.transaction.UserTransaction"
localizedMessage =
"org.jboss.tm.usertx.client.ServerVMClientUserTransaction cannot be
cast to javax.transaction.UserTransaction"
cause = null
body = null
correlationId = "ADE53343-F3F1-D938-A31D-CC308E3F66B1"
faultDetail = null
faultString = "Unable to access UserTransaction in DataService."
clientId = null
timeToLive = 0.0
destination = "utente.hibernate"
timestamp = 1.098642395125E12
extendedData = null
faultCode = "Server.Processing"
messageId = "81828F75-2508-726A-7B40-2ECD5E71CF75"
I'm going crazy trying to solve this...any suggestions? Maybe a JBoss
configuration problem?
Riccardo