Support Article
Agent not being updated
Summary
Due to a Declarative page containing a java object which triggers an error with the master agent. Agents are behaving erratically.
Error Messages
2017-07-21 00:00:32,616 [PRPCWorkManager : 14] [ STANDARD] [ PegaRULES:07.10] ( internal.clipboard.XMLStream) ERROR - IOException caught during serialization of Java Object value of property D_RetailImageCache.Content of class java.util.HashMap. Message: com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl
java.io.NotSerializableException: com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1212)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:368)
at java.util.HashMap.writeObject(HashMap.java:1141)
at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1110)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1534)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1470)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1206)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:368)
at com.pega.pegarules.data.internal.clipboard.XMLStream.writeXMLProperty(XMLStream.java:1024)
at com.pega.pegarules.data.internal.clipboard.XMLStream.writeXMLPage(XMLStream.java:740)
at com.pega.pegarules.data.internal.clipboard.XMLStream.clipboardToXML(XMLStream.java:521)
at com.pega.pegarules.data.internal.clipboard.XMLStream.clipboardToXML(XMLStream.java:496)
at com.pega.pegarules.data.internal.clipboard.WorkbenchXMLStream.<init>(WorkbenchXMLStream.java:207)
at com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl.estimateDataSizeWithExpansion(ClipboardPageImpl.java:5286)
at com.pega.pegarules.exec.internal.declare.infengine.pages.DeclarativePageInstanceImpl.size(DeclarativePageInstanceImpl.java:377)
at com.pega.pegarules.data.external.clipboard.SyncDeclarativePageInstanceContainer.estimateDataSize(SyncDeclarativePageInstanceContainer.java:360)
at com.pega.pegarules.session.internal.mgmt.base.AbstractDataPageHandler.estimateDataSize(AbstractDataPageHandler.java:153)
at com.pega.pegarules.session.internal.mgmt.PRNodeImpl.getDeclarativePageSize(PRNodeImpl.java:1752)
at com.pega.pegarules.session.internal.async.MasterForRequestors.run(MasterForRequestors.java:224)
Steps to Reproduce
- Create a Declare page with a java object which is storing a clipboard page.
- Wait for the master agent to run (every 10 minutes) to display some information in PRPC logs such as Declare page size.
Root Cause
The root cause is the use of unseralizable java object via the following scenario:
1. Create a property A of type java object with class: java.util.HashMap
2. Create a declare page which gets populated by an activity which will populate this property A. The hashmap is populated by code as follows:
java.util.HashMap map = new java.util.HashMap();
((java.util.HashMap)map).put("xav",tools.findPage("pxRequestor").copy());
xavobject=map;
3. Run an activity which will trigger the declare page. After 10 minutes maximum, see the error in the logs:
ERROR - IOException caught during serialization of Java Object value of property D_RetailImageCache.Content of class java.util.HashMap. Message: com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl
java.io.NotSerializableException: com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl
The goal there was to use an hashmap instead of a clipboard page for performance reason in order to iterate fast.
But the hashmap can't contain a clipboard property object as otherwise PRPC will raise serializable error.
The solution consists in extracting value needed from the clipboard page and copy it in the hashmap as String (or other serizaliable object) but not as clipboard object.
Resolution
Use the following code to populate the java object is an example which will avoid the serializable error:
java.util.HashMap map = new java.util.HashMap();
ClipboardPage p = tools.findPage("pxRequestor");
java.util.Map container = new java.util.HashMap();
Iterator it = p.keySet().iterator();
while (it.hasNext()) {
String name= (String) it.next();
//oLog.infoForced("this is the name"+name);
String type=String.valueOf(p.getType(name));
//oLog.infoForced("this is the type"+type);
String mode=String.valueOf(p.getMode(name));
//oLog.infoForced("this is the mode"+mode);
//Text and single property only saved
if(String.valueOf(p.getType(name)).equals("T")&&(String.valueOf(p.getMode(name)).equals("s")))
{
//put back into the cache
oLog.infoForced("This is the name of the property we save in the map:"+name);
((java.util.HashMap)map).put( name, p.getProperty(name).getStringValue());
}
}
xavobject=map;
Published July 23, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.