Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325901

Summary: JMX:java.rmi.UnmarshalException when invoking "getObjectsInIdentityMap" and "getObjectsInIdentityMapSubCacheAsMap"
Product: z_Archived Reporter: Yiping Zhao <yiping.zhao>
Component: EclipselinkAssignee: Project Inbox <eclipselink.foundation-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: eclipselink.foundation-inbox, michael.f.obrien, sanjeevthasale
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
URL: http://wiki.eclipse.org/EclipseLink/DesignDocs/316513
Whiteboard: JMX
Bug Depends on: 316513    
Bug Blocks:    

Description Yiping Zhao CLA 2010-09-21 16:04:07 EDT
Tested EclipseLink MBean in trunk(2.2.0) recently, found that: these two methods throw "java.rmi.UnmarshalException".

1. exception for "getObjectsInIdentityMap"

java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
	java.lang.ClassNotFoundException: org.eclipse.persistence.testing.models.jpa.relationships.Customer (no security manager: RMI class loader disabled)
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178)
	at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)

2. exception for "getObjectsInIdentityMapSubCacheAsMap"

java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
	java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.eclipse.persistence.internal.helper.linkedlist.ExposedNodeLinkedList
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173)
	at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
	at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:993)
	at com.jrockit.mc.console.ui.mbeanbrowser.operations.OperationModel.invokeOperation(OperationModel.java:81)
	at com.jrockit.mc.console.ui.mbeanbrowser.operations.InvokeOperationAction.invokeMBeanOperation(InvokeOperationAction.java:84)
	at com.jrockit.mc.console.ui.mbeanbrowser.operations.InvokeOperationAction.run(InvokeOperationAction.java:55)
	at com.jrockit.mc.console.ui.mbeanbrowser.operations.OperationsSectionPart$InvokeSelection.widgetSelected(OperationsSectionPart.java:54)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:229)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3474)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at com.jrockit.mc.rcp.application.Application.start(Application.java:27)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
Comment 1 Yiping Zhao CLA 2010-09-21 16:07:44 EDT
Note: 
(1). the exceptions stated here for WebLogic, exceptions on GlassFish are exactly same as WebLogic's
(2). For JBOSS, the first operation returns "[org.eclipse.persistence.testing.models.jpa.relationships.Customer@b63ed5]" which seems right; the second operation returns "org.eclipse.persistence.internal.helper.linkedlist.ExposedNodeLinkedList@1bdacbe" which seems wierd
Comment 2 Michael OBrien CLA 2010-09-21 16:39:31 EDT
>This exception does not occur on a JRockit/JRMC combination - so far
>I need to retest my SSB application on SUN/JConsole to see if it is app related
However, I do get the CNFException if I do not do a [getNumberOfObjectsInIdentityMap()] first
In this case I get 55 null entries (which is still wrong)
Comment 3 Michael OBrien CLA 2010-09-23 14:09:31 EDT
>verify on SUN-JConsole/JRockit-JRMC and formal-test-EAR/tutorial-EAR
as there are differences between the EAR architecture and possibly the JVM/JMX-viewer combination
Scheduled for more in-depth investigation (debug session) and possible inclusion in the next release.
Tracking of this issue will be in conjuction with the other 23 open issues on parent bug # 316513
Comment 4 Michael OBrien CLA 2010-09-23 15:53:36 EDT
>The 2nd error I get on WebLogic/JRMC - even though my Entity is serializable
Caused by: java.io.NotSerializableException: org.eclipse.persistence.internal.helper.linkedlist.ExposedNodeLinkedList

public class Cell implements Serializable {
    private static final long serialVersionUID = -8865917134914502125L;

>It is not related to the model - it is the IdentityMap which used ExposedNodeLinkedList in the WeakIdentityMap

public class HardCacheWeakIdentityMap extends WeakIdentityMap {
    /** A subset of cache entries have hard references maintained in this list to reduce garbage collection frequency */
    protected ExposedNodeLinkedList referenceCache;

>where the class is not serializable because the fields are transient
public class ExposedNodeLinkedList implements List {
    private transient LinkedNode header;
    private transient int size;

>Summary: Since the object needs to be transmitted to JRMC via RMI - it needs to be serializable
However, serialization will introduce performance and security hits on general caching if we implement Serializable in ExposedNodeLinkedList

>See line 363 - we are returning a List of ENLinkedList instances
subCache = ((HardCacheWeakIdentityMap)map).getReferenceCache();

>Either returning the LinkedList for all identityMap operations never worked
>Or ExposedNodLinkedList was modified so that serialization is no longer possible

>Fix:
1) convert to another serializable ArrayList
2) convert to an array of strings (will change function definition)

>An alternative would be to transmit a String representation of the List instead
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:03:20 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink