users@glassfish.java.net

JNDI namespaces and serialization while binding

From: <glassfish_at_javadesktop.org>
Date: Wed, 05 Mar 2008 01:09:38 PST

Hi folks,

following isssue:

I'd like to place an object, more specific a HibernateSession, dynamically(by ID) within the InitialContext from a SessionBean like:

[code]Context ctx = new InitialContext();
ctx.rebind("path"+ID,session);[/code]

This works fine, but I like the session to be placed as a reference in the InitialContext and not be serialized. But the session is allways serialized while binding it.

[b]First Question:[/b] [i]Is the serialization the standard procedure of binding objects to the InitialContext?[/i]

[b]Second Question:[/b] [i]Is it possible to place just references in the InitialContext? More precise, does the serialization depend on the JNDI namespace choosen, or can I prevent the serialization with a special namespace?[/i]

To check this, i tried to place the session in the namespace. I got the following Exception:

[code]javax.naming.NamingException: java:comp namespace cannot be modified
        at com.sun.enterprise.naming.java.javaURLContext.bind(javaURLContext.java:244)
        at com.sun.enterprise.naming.SerialContext.bind(SerialContext.java:399)
        at javax.naming.InitialContext.bind(InitialContext.java:400)[/code]

Looking forward for any hints.

Cheers Tino
[Message sent by forum member 'ezekiel12' (ezekiel12)]

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