Hi all - looking for a bit of help or direction.
I'm having a bit of a problem trying to bind an Object-type implementing Referenceable to JNDI. There's a requirement here that the object can't be saved in a Serialized way, it needs to be a reference so it's kept alive in memory even after I've disconnected to it.
Hopefully someone can help - i've tried to lay it out below as simply as I can.
-> I've got an Object-Type that implements Referenceable (I've implemented the getReference() function appropriately I hope:
public Reference getReference(){ // the ObjectTreeRefAddr is a class I wrote implementing RefAddr // so that I can store away a whole "live" object, and not just String props ObjectTreeRefAddr refAddr = new ObjectTreeRefAddr("objecttree", this); Reference myRef = new Reference(ObjectTree.class.getName(), refAddr, ObjectTreeFactory.class.getName(), null); // debug-code, below will return the Reference correctly ObjectTreeRefAddr newRefAddr = (ObjectTreeRefAddr)myRef.get(0); return myRef; }
// Following code breaks... context.bind("objecttree", myObj); // ...With the following error: /* Problem binding: javax.naming.CommunicationException [Root exception is java.rmi.MarshalException: error marshalling arguments; nested exception is: java.io.NotSerializableException: com.company.work.ObjectTree] */