java.rmi.MarshallException: CORBA BAD_PARAM with java.io.NotSerializableException in WebSphere Application Server
 Technote (troubleshooting)
 
Problem(Abstract)
java.io.NotSerializableException:
com.xxxxxxx.OB_Database.business.ejb.EJSLocalCMPD2NodeCostList_213ddc4a is not serializable
 
Cause
An attempt was made to define an EJB LocalHome in a IBM® WebSphere® Application Server object as a class variable, after which an attempt was made to access this class variable within the class methods. The result is the error ObjectNotSerializable.
The attempt to define the EJB LocalHome object as a class variable is not valid and is stated in the EJB 2.1 Specification as follows:

10.3.1 of the EJB 2.1 Spec. ...
"• The Bean Provider must ensure that the Java types assigned to the cmp-fields are restricted to the following: Java primitive types and Java serializable types."

6.2.1 of the EJB 2.1 Spec
"A local home object reference cannot be passed as an argument or result of a method on an enterprise bean’s remote home or remote interface."
 
Resolving the problem
Define the LocalHome objects within the methods that use them.
This code snippet shows the code that causes the problem; specifically, the EJB finder.

nodeCostListHome = (DB2NodeCostListLocalHome) lookupLocalTargetHome(NamingList.HOME_DB2_COST_LIST);

try
{
// The problem is the following finder
lCostCollection =
nodeCostListHome.findByAgentIdAndStoreNumber(aCBLBean.getShipDestination(),
aCBLBean.getStoreNumber());
logMessage("performGetCostCollection4");
lCostIterator = lCostCollection.iterator();
}
catch (Exception e)
{}

This code snippet shows the code solution.

nodeCostListHome = (DB2NodeCostListLocalHome) lookupLocalTargetHome(NamingList.HOME_DB2_COST_LIST);

try
{
Integer lshipmentId = aCBLBean.getShipDestination();
Integer lstoreNumber = aCBLBean.getStoreNumber();
lCostCollection = nodeCostListHome.findByAgentIdAndStoreNumber(lshipmentId,
lstoreNumber);
lCostIterator = lCostCollection.iterator();
}
catch (Exception e)
{}
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > EJB Container
Operating system(s): AIX
Software version: 6.1
Software edition:
Reference #: 1202548
IBM Group: Software Group
Modified date: Feb 27, 2006