users@glassfish.java.net

_at_Resource for MailSession in JSF Container

From: <glassfish_at_javadesktop.org>
Date: Sat, 15 Dec 2007 21:07:38 PST

Hi,

I'm trying to use the @Resource annotation to inject the Mail Session pre created in Glassfish.
The JNDI name is [i]mail/testmail[/i] (as it shown in the JNDI Browser under mail node).

annotation in Managed Bean used like this:

@Resource(name = "mail/testmail")
    javax.mail.Session mailSession;

The mailSession is never initialized, looks like the @Resource annotation is ignored by JSF Container.

I tried to use the JNDI Lookup for name [i]java:comp/env/mail/testmail[/i] but [i]null[/i] is returned..

Is it implemented in Glassfish?

Thanks,
Dmitry.
[Message sent by forum member 'dmitrys' (dmitrys)]

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