Working with JBoss eap 6.4.12
Getting error:
Error looking up ${email.jndi.lookup.binding} in JNDI
Mapping this JNDI name in my java class:
@Resource(mappedName = "${email.jndi.lookup.binding}")
private Session session;
I define this property in my build properties:
email.jndi.lookup.binding=java:/jboss/mail/Default
(removing \
after :
in my build properties definition doesn't make a difference)
This is happened before to me on another project, in which changing the annotation property replacement
property to true worked. But not this time.
ended up just adding a local bean
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
@Stateless
@LocalBean
public class DefaultEmailManager {
public static final String JNDI_NAME = "java:jboss/mail/Default";
}
Then where I create my Session
object:
private Session session;
try {
InitialContext ic = new InitialContext();
session = (Session)ic.lookup(DefaultEmailManager.JNDI_NAME);
} catch (NamingException e) {
e.printStackTrace();
}