Problems serializing a complex linked list
Hello,
I am working with calls to remote methods in Jbuilder X with session beans.
i have some problems marshaling a complex linked list.
This linked list is a list of nodes. Every node has some atributes and one of this atributes is a reference to another linked list. The code of all this structure is:
public class NodeList implements java.io.Serializable{
private LinkedList list; //List of nodes
.....
....
}
public class Node implements java.io.Serializable{
//Atributes
private String NodeId; //Description (name) of SR
private Object Address; //Reference to the Address
private ConnectionsList conect_list; // Reference to an instance
// of ConnectionList
....
....
}
public class ConnectionsList implements java.io.Serializable{
// Attributes
private LinkedList list; //List of conections of one node
....
....
}
I thought that to marshal this structure it was enough with implements java.io.seriazable, but Jbuilder does not think the same
Any idea about how to solve it?
Thank you very much
> I thought that to marshal this structure it was enough with implements java.io.seriazable,
It should be. Serializing a Serializable will serialize its entire state, meaning it will store the entire linked object graph and take care of internal references. Every class involved would have to be Serializable (this seems to be the case in the code you posted).
For future reference, please post code within [ code ] tags, it looks so much nicer that way :-)
> but Jbuilder does not think the same
Interesting. How does it tell you this? Can you post the exact and complete error message you see?
Lokoa at 2007-7-13 23:32:51 >

Thank you for the answer and sorry for not use the code tags :(.
The complete error message is:
java.rmi.MarshalException: CORBA MARSHAL 0[]; nested exception is:
org.omg.CORBA.MARSHAL:vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.inprise.vbroker.rmi.CORBA.UtilImpl.newInstance(UtilImpl.java:125)
at com.inprise.vbroker.rmi.CORBA.UtilImpl._mapSystemException(UtilImpl.java:399)
at com.inprise.vbroker.rmi.CORBA.UtilImpl.mapSystemException(UtilImpl.java:826)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
at subreconfiguration._Subreconfiguration_Stub.copyTopology(_Subreconfiguration_Stub.java:111)
at subreconfiguration.Initializator.getMessage(Initializator.java:215)
at subreconfiguration.Initializator.main(Initializator.java:517)
Caused by: org.omg.CORBA.MARSHAL:vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at com.inprise.vbroker.orb.SE.read(SE.java:28)
at com.inprise.vbroker.orb.DelegateImpl.handleReply(DelegateImpl.java:803)
at com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:689)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
at subreconfiguration._Subreconfiguration_Stub.copyTopology(_Subreconfiguration_Stub.java:26)
... 2 more
i really do not understand why it does not work. My main program just invoke a remote method passing it the complex linked list. It should work.
I write here some other code lines that maybe help you:
/********************/
/* Remote Interface */
/********************/
public interface Subreconfiguration
extends EJBObject{
public void copyTopology(NodeList nodeList) throws RemoteException;
}
/*Call to remote method*/
public static String getMessage(Integer ID) {
....
....
try {
((Subreconfiguration)(nodeList.GetAddress("SR1"))).copyTopology(nodeList);
}
}
Thank you in advance.
I don't see anything specific to serialization in the error trace. Sorry, I may have misunderstood the context of your question; I thought you were having an issue with just serializing the object. I can't say what is causing this exception you get, or if Serializable is the (only) requirement for CORBA parameters (no-arg constructors perhaps?).
To rule out serialization itself as the cause, you could see if you can serialize/deserialize your object with ObjectInput/OutputStreams. And you can try to send a simpler object and see if that does work.
Lokoa at 2007-7-13 23:32:51 >

Do you mean that maybe my error is not a serialization error?
I think that this error is because of the serialization of the "complex" linked list, because if i change the parameter nodeList for an Integer all is working perfectly.
Anyway, I also think that the complex structure is not all the problem, because some minutes ago, i reduced the complex structure to a "simple" linked list and i obtained the same error.
> Do you mean that maybe my error is not a
> serialization error?
>
> I think that this error is because of the
> serialization of the "complex" linked list, because
> if i change the parameter nodeList for an Integer all
> is working perfectly.
I mean that I don't see anything pointing at serialization specifically. There are probably other differences between your class and Integer that play a role in CORBA parameters. And that you can find out by trying just to serialize and deserialize outside of the CORBA context. If that works, serialization is not the cause. If it doesn't, you should get a more specific error description and take it from there.
Lokoa at 2007-7-13 23:32:51 >

Some minutes ago, I solved the problem with serialization of the complex structure. It was just a "Jbuilder error",touching the adequate options in Jbuilder I solved the problem (clean and rebuild). So at summary I can say that to pass a structure over the network if is enough with serialized it (all the classes which participates in the structure).
Anyway thanks Loko.
hello, have you solved you problem regarding the Corba Marshal?
I'm also having the same errors with your's.
java.rmi.MarshalException: CORBA MARSHAL 0[]; nested exception is:
org.omg.CORBA.MARSHAL:vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.inprise.vbroker.rmi.CORBA.UtilImpl.newInstance(UtilImpl.java:125)
at com.inprise.vbroker.rmi.CORBA.UtilImpl._mapSystemException(UtilImpl.java:399)
at com.inprise.vbroker.rmi.CORBA.UtilImpl.mapSystemException(UtilImpl.java:826)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)