users@glassfish.java.net

Re: Mail Session is not injected to member field of my bean

From: <glassfish_at_javadesktop.org>
Date: Sun, 23 Mar 2008 14:23:41 PST

Hi,

Your resource is not mapped to its physical jndi-name, and that may be the reason. Try:

@Resource(name="mail/mobileMailSession", mappedName="mail/mobileMailSession")
private javax.mail.Session mailSession;

Alternatively, you may perform this mapping in sun-ejb-jar.xml with <resource-ref> element.

The reason your lookup worked is it is looking up by its global jndi-name, not its resource reference name.

-cheng
[Message sent by forum member 'cf126330' (cf126330)]

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