Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

EntrySerializationException with HashSet

I have the following class with a reference to a HashSet:

@SpaceClass(replicate=true,persist=false,fifo=false)
public class Clazz1 {
    .
    .
    .
    HashSet t;
    .
    .
.

}

But, when I try to write a Clazz1 object using IJSpace.write, i??m getting:

GRAVE com.gigaspaces.lrmi: LRMI transport protocol over NIO connection 3">NIO:///192.168.4.138:8683/280710018810093 caught unexpected exception: com.j_spaces.core.EntrySerializationException: Failed to serialize Entry field.
Entry Classname : Clazz1
Field Type : HashSet
com.j_spaces.core.EntrySerializationException: Failed to serialize Entry field.
Entry Classname : Clazz1
Field Type : HashSet
    at com.j_spaces.core.EntryPacket.writePrimitiveObject(SourceFile:234)
    at com.j_spaces.core.EntryPacket.writeExternal(SourceFile:453)
    at java.io.ObjectOutputStream.writeExternalData(Unknown Source)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
    at com.j_spaces.obf.ic.marshalValue(SourceFile:307)
    at com.gigaspaces.lrmi.nio.RequestPacket.writeExternal(SourceFile:124)
    at com.j_spaces.obf.jq.b(SourceFile:102)
    at com.j_spaces.obf.jq.c(SourceFile:90)
    at com.j_spaces.obf.mm.invoke(SourceFile:198)
    at com.j_spaces.obf.mp.invoke(SourceFile:64)
    at com.gigaspaces.lrmi.DynamicSmartStub.invokeRemote(SourceFile:357)
    at com.gigaspaces.lrmi.DynamicSmartStub.invoke(SourceFile:345)
    at $Proxy24.update(Unknown Source)
    at com.j_spaces.core.lrmi.LRMIRemoteSpaceImpl.update(SourceFile:253)
    at com.j_spaces.core.cluster.action.AbstractClusterSpaceUpdateActionListener.internalUpdate(SourceFile:110)
    at com.j_spaces.core.cluster.action.AbstractClusterSpaceUpdateActionListener.update(SourceFile:51)
    at com.j_spaces.core.cluster.action.ClusterSpaceWriteActionListener.onAction(SourceFile:60)
    at com.j_spaces.core.cluster.action.ClusterSpaceWriteActionListener.onAction(SourceFile:39)
    at com.j_spaces.core.client.AbstractSpaceProxy.write(SourceFile:430)
at com.j_spaces.core.client.AbstractSpaceProxy.write(SourceFile:420)

.
.
.
Caused by: java.io.NotSerializableException: Clazz1
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
    at java.util.HashSet.writeObject(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
    at com.j_spaces.obf.ic.a(SourceFile:471)
    at com.j_spaces.core.EntryPacket.writePrimitiveObject(SourceFile:219)
... 42 more

Attachments

  1. complexAttributeQuery.zip
  2. ParentChildExample.zip

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2008-03-05 15:54:01 -0600

nullcipher2 gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

2 options to resolve this:
- The space class non primitive fields (nested classes or classes within collection objects) should be part of space JVM classpath (simply copy these to <GigaSpaces root>\lib\ext)
- Run in Light serialization mode (1). Will impact a bit the performance.

Shay

Attachments

  1. complexAttributeQuery.zip
  2. ParentChildExample.zip

answered 2008-03-05 16:43:49 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Comments

What about if the HashSet is a Set of Clazz1 objects????, What about references in the space ... h4. Attachments

[complexAttributeQuery.zip|/upfiles/13759718081211777.zip]

[ParentChildExample.zip|/upfiles/13759718087229077.zip]

nullcipher2 gravatar imagenullcipher2 ( 2008-03-05 17:48:51 -0600 )edit

You should have the POJO class as part of the space classpath. The collection object will be serialized once stored within the space as part of its parent space object. The collection objects are not introduced as separate space objects. They do not have space id as their parent space object. Shay h4. Attachments

[complexAttributeQuery.zip|/upfiles/13759718082420599.zip]

[ParentChildExample.zip|/upfiles/1375971808296199.zip]

shay hassidim gravatar imageshay hassidim ( 2008-03-05 17:57:27 -0600 )edit

Thanks Shay. In the case that the HashSet is a Set of Clazz1 objects, Clazz1 must be serializable?

Attachments

  1. complexAttributeQuery.zip
  2. ParentChildExample.zip
nullcipher2 gravatar imagenullcipher2 ( 2008-03-06 08:10:19 -0600 )edit
shay hassidim gravatar imageshay hassidim ( 2008-03-08 16:36:35 -0600 )edit

Hi,

I use Set because I have 2 objects where there are a dependance because of Set.

This is more simple to put my POJO:

      • md5-b15141e93c6a05c2375556555f1b558f

private Integer tradePartyInfoId;
private String partyReference;
private String partyName;
private String partyMnemo;
private String partyContact;
private String partyComment;

public TradePartyInfo(){}

}

}*************************************************
public class Trade{
private Set tradePartyInfos = new HashSet();

private String tradeId;
private String buyerPartyReference;
private String sellerPartyReference;
private String internalTradeDirection;
private String productReference;

private Integer productUniqueID;
private Double productQuantity;
private Date valueDate;
private Date tradeDate;
private Float productPrice;
private Float productCoupon;
private String productQuotationMode;
private String productCurrency;
private String status;

private Integer productId;
private String securitySettlementInfoId;

public Trade(){

}
}

As you can see, I have a dependance between these objects. Indeed, one Trade associated to many tradePartyInfo that's why there are a Set in trade. And I get the same error that you. I try to follow the advice :

- serializable (to Trade and TradePartyInfo)

- move class (Trade.java and TradePartInfo.java) to %gs_home%/lib/ext

but I get this error :

com.j_spaces.core.EntrySerializationException: Failed to deserialize Entry main.java.org.esme.object.hibernate.wfb.Trade
    at com.j_spaces.core.EntryPacket.readExternal(SourceFile:662)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    at com.j_spaces.obf.id.unmarshalValue(SourceFile:352)
    at com.gigaspaces.lrmi.nio.RequestPacket.readExternal(SourceFile:104)
    at com.j_spaces.obf.it.a(SourceFile:150)
    at com.j_spaces.obf.it.fu(SourceFile:71)
    at com.j_spaces.obf.jo.dispatch(SourceFile:97)
    at com.j_spaces.obf.bz.run(SourceFile:62)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: main.java.org.esme.object.hibernate.wfb.TradePartyInfo
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
    at com.j_spaces.obf.mb.resolveClass(SourceFile:198)
    at com.j_spaces.obf.ck.resolveClass(SourceFile:98)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    at java.util.HashSet.readObject(HashSet.java:278)
    at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585 ...





































(more)

cbe gravatar imagecbe ( 2008-06-13 09:05:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2008-03-05 15:54:01 -0600

Seen: 94 times

Last updated: Mar 05 '08