users@glassfish.java.net

JNDI and Serializable objects

From: <glassfish_at_javadesktop.org>
Date: Tue, 21 Apr 2009 11:02:54 PDT

Hello;

I am implementing the LifecycleListener interface in an implementation class called [b]RuleServerLifecycleImpl[/b]. The [b]RuleServerLifecycleImpl [/b]will create an object called [b]RuleServer [/b]that will perform some remote messaging to a RV listener. The RV listener then publishes back to the [b]RuleServer [/b]object. Once the application is up and running and the Client call into my application an EJB will be called which will then get a reference to the [b]RuleServer [/b]bean via the JNDI tree and the EJB will call methods on the RuleServer object.

When my [b]RuleServerLifecycleImpl [/b]starts up I register the [b]RuleServer [/b]into the JNDI tree. When doing so I get a Serializable exception on one of the objects my [b]RuleServer [/b]has a reference to called [b]MultiConnectionMessageServer[/b]. [b]MultiConnectionMessageServer [/b]is the object that establishes the RV connection with the outside world.

Since my [b]RuleServerLifecycleImpl [/b]bean runs inside the same JVM that the EJBs will be accessing it I didn't think I needed to implement the Serializable interface.

To get around this Serializable Exception I made the [b]MultiConnectionMessageServer [/b]instance [i]transient [/i]and it solved the problem, but when the EJB went to retrieve the [b]RuleServer [/b]instance from the JNDI tree and call its methods I get a NullPointerException on the [b]MultConnectionMessageServer [/b]instance because of the [i]transient [/i]modifer. which is where the important RV communication happens.

Any thoughts?
Thanks in advanced.
Peter
[Message sent by forum member 'peterdelaney' (peterdelaney)]

http://forums.java.net/jive/thread.jspa?messageID=343119