users@glassfish.java.net

Is it possible to inject a realm?

From: <glassfish_at_javadesktop.org>
Date: Fri, 06 Jun 2008 14:20:13 PDT

Hello,
   I'm trying to access attributes of an ldap entry. LDAP authentication succeeds just fine. So I have an EJB implementing the Remote interface (the ejb is being called from a static block in the main class of an application client). The first few lines of the ejb class are:

@Stateless
public class GrantAccessBean implements GrantAccessRemote {
   
   @Resource(name="LDAP-realm")
   private LDAPRealm lDAPRealm;

   public String getAttribute(String parameter1, String parameter2, String attributeName) {
...


I 'm getting these exceptions:

com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: LDAP-realm_at_Field-Injectable Resource. Class name = com.flier.client.ejb.GrantAccessBean Field name=lDAPRealm_at_java.lang.String_at_LDAP-realm@@ into class com.flier.client.ejb.GrantAccessBean
...
Caused by: javax.naming.NameNotFoundException: No object bound for LDAP-realm [Root exception is java.lang.NullPointerException]
...

Is it because a realm is perhaps not allowed to be injected? Or should I have proper declarations in certain deployment descriptors? If so, which ones and how to declare it?

Thanks in advance,
Andreas
[Message sent by forum member 'mfg8876' (mfg8876)]

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