users@glassfish.java.net

Hot to lookup custom JNDI resource from within a deployed Resource Adapter?

From: <glassfish_at_javadesktop.org>
Date: Sat, 09 Oct 2010 01:01:59 PDT

I'm failing to lookup a global custom resource in glassfish v3.0.1 from within a deployed RAR.

I have used the "create-custom-resource" command to provide access to an LDAP server using the JNDI name of "ldap/userstore".

However if I attempt to lookup this resource from within the deployed RAR using:
  new InitialContext().lookup("ldap/userstore")

It fails with:
  javax.naming.NamingException: Lookup failed for 'java:ldap/userstore' in SerialContext [Root exception is javax.naming.NameNotFoundException: No object bound to name java:ldap/userstore]

I've tried variations on the lookup string ("ldap/userstore", "java:global/ldap/userstore", "java:global/jca/ldap/userstore") to no avail.

Can I (or do I need to) map a reference within the RAR to the global custom resource in JNDI?
(similar to mapping EJB references)
[Message sent by forum member 'cosmic']

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