[ http://jira.jboss.com/jira/browse/JBMQ-17?page=history ]
Daniel Ramagem updated JBMQ-17:
-------------------------------
Description:
A java.io.NotSerializableException is thrown when using JBossMQ as a
transactional "Generic JMS Provider" under IBM WebSphere Application Server
5.0.2. The IBM class com.ibm.ejs.jts.jta.XID is not serializable and causes
the SpyXAResourceManager.prepare(...) method to fail. The solution is to:
1) Clone (deep copy) the non-serializable Xid to a new a new serializable Xid
wrapper: JBossMQXid.java.
2) The org.jboss.mq.TransactionRequest class' writeExternal(...) method must be
modified to perform the wrapping
3) The JBossMQXid class must now be available under both client and server. I
think the packaging jboss-3.2.6-src product needs to be modified so that upon a
build the JBossMQXid class gets made available in the "jbossmq" server (created
when /jboss-3.2.6/docs/examples/jms/standalone/build.xml is run). I had to
manually add the jbossmq-client.jar to servers/jbossmq/lib to make it work.
was:
A java.io.NotSerializableException is thrown when using JBossMQ as a
transactional "Generic JMS Provider" under IBM WebSphere Application Server
5.0.2. The IBM class com.ibm.ejs.jts.jta.XID is not serializable and causes
the SpyXAResourceManager.prepare(...) method to fail. The solution is to:
1) Clone (deep copy) the non-serializable Xid to a new a new serializable Xid
wrapper: JBossMQXid.java
2) The JBossMQXid class must now be available under both client and server. I
think the packaging jboss-3.2.6-src product needs to be modified so that upon a
build the JBossMQXid class gets made available in the "jbossmq" distribution
(created when /jboss-3.2.6/docs/examples/jms/standalone/build.xml is run).
3) The org.jboss.mq.TransactionRequest class' writeExternal(...) method must be
modified to perform the wrapping
Below is the code for #1 and the diff of #3 (based on the source code of 3.2.6).
----- #1: JBossMQXid.java -----
package org.jboss.mq;
import javax.transaction.xa.Xid;
import java.io.Serializable;
import java.util.Arrays;
/**
* This class is a wrapper for non-serializable implementations of
* java.transaction.xa.Xid.
*
* @author Daniel Bloomfield Ramagem ([EMAIL PROTECTED])
*/
public class JBossMQXid implements Xid, Serializable {
private int formatId;
private byte[] globalTransactionId;
private byte[] branchQualifier;
private int hashCode;
public JBossMQXid(Xid xid) {
System.out.println("JBossMQXid: " + xid);
formatId = xid.getFormatId();
globalTransactionId = xid.getGlobalTransactionId();
branchQualifier = xid.getBranchQualifier();
hashCode = xid.hashCode();
}
public int getFormatId() {
return formatId;
}
public byte[] getGlobalTransactionId() {
return globalTransactionId;
}
public byte[] getBranchQualifier() {
return branchQualifier;
}
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof JBossMQXid))
return false;
if (formatId == ((Xid) obj).getFormatId() &&
Arrays.equals(globalTransactionId, ((Xid)
obj).getGlobalTransactionId()) &&
Arrays.equals(branchQualifier, ((Xid)
obj).getBranchQualifier()))
return true;
return false;
}
public int hashCode() {
return hashCode;
}
}
--------------------
----- #3 Diff TransactionRequest.java -----
11a12
> import javax.transaction.xa.Xid;
86,90c87,94
< out.writeObject(xid);
< if (messages == null)
< out.writeInt(0);
< else
< {
---
> if (xid != null && xid instanceof Xid)
> out.writeObject(new JBossMQXid((Xid)xid));
> else
> out.writeObject(xid);
> if (messages == null)
> out.writeInt(0);
> else
> {
95c99
< if (acks == null)
---
> if (acks == null)
112c116
< }
\ No newline at end of file
---
> }
> Fix for Use of Non-Serializable Xid Implementations
> ---------------------------------------------------
>
> Key: JBMQ-17
> URL: http://jira.jboss.com/jira/browse/JBMQ-17
> Project: JBoss MQ
> Type: Patch
> Components: Persistence, Transport
> Versions: JBossAS-3.2.6
> Environment: WebSphere Application Server 5.0.2
> Reporter: Daniel Ramagem
> Assignee: Adrian Brock
> Attachments: JBossMQXid.java, TransactionRequest.java.diff
>
>
> A java.io.NotSerializableException is thrown when using JBossMQ as a
> transactional "Generic JMS Provider" under IBM WebSphere Application Server
> 5.0.2. The IBM class com.ibm.ejs.jts.jta.XID is not serializable and causes
> the SpyXAResourceManager.prepare(...) method to fail. The solution is to:
> 1) Clone (deep copy) the non-serializable Xid to a new a new serializable Xid
> wrapper: JBossMQXid.java.
> 2) The org.jboss.mq.TransactionRequest class' writeExternal(...) method must
> be modified to perform the wrapping
> 3) The JBossMQXid class must now be available under both client and server.
> I think the packaging jboss-3.2.6-src product needs to be modified so that
> upon a build the JBossMQXid class gets made available in the "jbossmq" server
> (created when /jboss-3.2.6/docs/examples/jms/standalone/build.xml is run). I
> had to manually add the jbossmq-client.jar to servers/jbossmq/lib to make it
> work.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development