|
Problem(Abstract) |
Your application uses Java™ 2 Connectivity (J2C). When
starting your Application Server, you receive the exception: "WTRN0086E:
Unable to serialize an object to byte form". This technote addresses the
following questions:
- Does WebSphere® Application Server try to serialize the XAResource
object?
- How do you determine which class needs to be serializable?
- Where is the documentation on writing XAResource in WebSphere
Application Server? |
|
|
|
Resolving the
problem |
Apply APAR PQ69846.
Questions
- Does WebSphere Application Server try to serialize the
XAResource object?
The only resource adapter class that WebSphere Application Server
serializes for recovery is the ManagedConnectionFactory (MCF), so
that is the best place to start. The XAResource is not
serialized.
WebSphere Application Server XARecovery processing saves the MCF,
and some configuration properties (like the Container Authentication
Alias) in the transaction logs. All the configuration information and
the MCF must be serializable for this to work. When WebSphere Application
Server performs the recovery, it deserializes the information and uses the
MCF to create a ManagedConnection, using a NULL
ConnectionRequestInfo. WebSphere Application Server then uses the
ManagedConnection to get an XAResource and uses that to recover
the data.
According to the Java™ 2 Enterprise Edition (J2EE™) Connector Architecture
specification, the ConnectionFactory and
ManagedConnectionFactory must be serializable. This means that
all members of those classes need to either be serializable, or marked
transient. Members that are marked transient will be null when the object
is deserialized, so the code must handle that condition. In general,
members that are not important to the state of the object, or that can be
reinitialized easily, can be marked transient.
- How do you determine which class must be
serializable?
One way to test whether a class is serializable is to inspect the class
and all of its non-transient members to ensure that they all implement
Serializable. This can be tedious because you have to traverse
the entire tree of objects. Most of the java.lang classes are
serializable, so they do not have to be checked.
The only other way to determine if an object is serializable is to write a
Java program that attempts to serialize and deserialize the object.
- Where is the documentation on writing XAResource in
WebSphere Application Server?
See Documentation
on Object Serialization for details and examples.
|
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|