users@glassfish.java.net

LdapCtxFactory Properties In A Custom Resource

From: <glassfish_at_javadesktop.org>
Date: Mon, 22 Feb 2010 18:11:33 PST

GlassFish v2.1.1

I set up a Custom Resource, but my question are more concerned with the GlassFish handling of the property lists related to the resource:

     Resource Type: javax.naming.directory.Directory
     Factory Class: com.sun.jndi.ldap.LdapCtxFactory

I added values for the usual properties using the Admin GUI property list, including among others:

     java.naming.provider.url

I then relied on GlassFish resource injection to provide a context within a stateless session bean, which I expected to have these properties as part of its environment.

The first problem is the exception below:

Caused by: javax.naming.ConfigurationException: Reference contains no valid addresses
        at com.sun.jndi.ldap.LdapCtxFactory.getURLs(LdapCtxFactory.java:115)
        at com.sun.jndi.ldap.LdapCtxFactory.getObjectInstance(LdapCtxFactory.java:38)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:414)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:1001)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:407)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287

However, if I use just "URL" instead of "java.naming.provider.url", then I can proceed past this exception. But "java.naming.provider.url" is pretty standard and if it makes it to the factory class I believe it would be used there. So:

     1. Is this expected behavior, since GlassFish must be the one passing on the properties to the factory class of the resource?
     2. Out of curiosity, how and why would plain "URL" make it through, but none of the other properties?

Using "URL" I got past the exception above and the injection appeared to succeed the stateless session bean, indicates that the LdapContext's environment properties does not contain the properties which were part of the Admin GUI property list.

     3. Aren't all of the properties in the Admin GUI property list supposed to be passed to the factory class, so that in this case they make up part of the environment properties of the LdapContext, which was injected to a stateless session bean by GlassFish?

Thanks

Joe
[Message sent by forum member 'teknomad' (joe.isaac_at_tolven.org)]

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