users@glassfish.java.net

Re: Problem on configuring Java Mail Session

From: <glassfish_at_javadesktop.org>
Date: Tue, 11 Mar 2008 03:38:30 PST

The Java Mail session created on Glassfish works well if it is injected as @Resource (name="mail/myMail"), but it fails on direct using JNDI as following,
...
InitialContext ctx = new InitialContext();
Session session = (Session)ctx.lookup("mail/myMail");
...
the exceptioin is exactly the same as the spring case. MailConfiguration can not be cast to MailSession etc. Can someone give some lights on this?
[Message sent by forum member 'dabaner' (dabaner)]

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