File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes JMS and XAException on WLS 6... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "JMS and XAException on WLS 6..." Watch "JMS and XAException on WLS 6..." New topic
Author

JMS and XAException on WLS 6...

SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
We recently purchased WLS 6.1 and we have been using the product for the last few months. I am having a problem which I have detailed below. I have provided as much information as possible. If you need additional information, please let me know.
Server A Config:
Pentium III, 1000Mhz
Windows 2000, SP2
WLS WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
Server B Config:
SunBlade 100
Solaris 5.8
WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
Server A contains a session EJB called GoalManager. This EJB has a method named cancel(). The transactional attribute for all methods supported by this bean is REQUIRED. GoalManager uses a transactional data source deployed on Server A named "goal". There is nothing special about this data source aside from the fact that I have enabled two phase commit for it because a previous error was indicating that this was a required setting for the pool. A JMS server exists on Server B. A queue named "emailQueue" is set up as a destination on this JMS server. I also have a MDB on Server B that listens for messages on this queue. When a message is received, the MDB's onMessage() method extracts some properties from the message and sends an email to the specified recipient in the message. I have confirmed that this queue and MDB are working properly because I ran a small test program from the command prompt which creates a message and sends it to the queue on Server B. The MDB gets the message and sends the email to the correct recipient, so I am sure there are no misconfigurations on the server.
The problem is as follows: The cancel() method in the GoalManager EJB on Server A performs some database work. If no exceptions are raised, the last task in the method attempts to access the queue on Server B and send a message to the queue. Here is the code that I am using to access the queue:
QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup( "javax.jms.QueueConnectionFactory");
QueueConnection queueConnection = queueFactory.createQueueConnection();
Queue queue = (Queue)context.lookup( "emailQueue");
QueueSession queueSession = queueConnection.createQueueSession( false, Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender = queueSession.createSender( queue);

The cancel() method executes without error, but when the EJB container on Server A attempts to commit the transaction at the end of the method, I am receiving the following error on Server A's log:

<Error> <EJB> <Exception during commit of transaction Name=[EJB com.frx.emp.go.ejb.session.goal.GoalManagerBean.cancelGoal(com.frx.emp.entity.Employee,com.frx.emp.go.entity.Goal)],
Xid=0:7c2dda32cf39a36e(6911242),
Status=Rolled back. [Reason=javax.transaction.xa.XAException],
numRepliesOwedMe=0,
numRepliesOwedOthers=0,
seconds since begin=2,
seconds left=10,
ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=rolledback,assigned=server1),
ServerResourceInfo[JMS_EMailServer_NotDurable]=(state=rolledback,assigned=server1),
SCInfo[FRX+server1]=(state=rolledback),
SCInfo[frxnet+wlsvr1]=(state=rolledback),
properties=({weblogic.transaction.name=[EJB com.frx.emp.go.ejb.session.goal.GoalManagerBean.cancelGoal(com.frx.emp.entity.Employee,com.frx.emp.go.entity.Goal)],
weblogic.jdbc=t3://172.16.200.9:9005}),
OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=server1+172.16.200.9:9005+FRX+, Resources={})],
CoordinatorURL=server1+172.16.200.9:9005+FRX+): javax.transaction.xa.XAException
at weblogic.jms.backend.BEXAResource.prepare(BEXAResource.java:853)
at weblogic.transaction.internal.ServerResourceInfo.prepare(ServerResourceInfo.java:1124)
at weblogic.transaction.internal.ServerResourceInfo.prepare(ServerResourceInfo.java:370)
at weblogic.transaction.internal.ServerSCInfo.startPrepare(ServerSCInfo.java:186)
at weblogic.transaction.internal.ServerTransactionImpl.localPrepare(ServerTransactionImpl.java:1822)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrepare(ServerTransactionImpl.java:1607)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:218)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
at com.frx.emp.go.ejb.session.goal.GoalManagerBean_e3dvd2_EOImpl.cancelGoal(GoalManagerBean_e3dvd2_EOImpl.java:459)
at com.frx.emp.go.web.handler.UpdateGoalHandler.handleRequest(UpdateGoalHandler.java:55)
at com.frx.emp.web.mvc.HandlerMappedController.service(HandlerMappedController.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
--------------- nested within: ------------------
weblogic.transaction.RollbackException: Could not prepare resource 'JMS_EMailServer_NotDurable - with nested exception:
[javax.transaction.xa.XAException]
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1475)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:263)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
at com.frx.emp.go.ejb.session.goal.GoalManagerBean_e3dvd2_EOImpl.cancelGoal(GoalManagerBean_e3dvd2_EOImpl.java:459)
at com.frx.emp.go.web.handler.UpdateGoalHandler.handleRequest(UpdateGoalHandler.java:55)
at com.frx.emp.web.mvc.HandlerMappedController.service(HandlerMappedController.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

Just a quick note, I tried to change the following line to specify a "transacted" JMS session by passing "true" to the statement below. When I tested this, the cancel() method raised no exceptions, but the MDB on Server B is never invoked and the email is never sent. Strange.
QueueSession queueSession = queueConnection.createQueueSession( true, Session.AUTO_ACKNOWLEDGE);
Any help would be greatly appreciated!
SAF
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMS and XAException on WLS 6...