Hi,
I'm trying to implement a small mail sender to test the resource injection feature. The problem is... it doesn't work :(
I'm using the latest version (b55)
The Mail session is defined in the server under the JNDI name "mail/test/myMailer"
@Resource(name = "mail/test/myMailer")
private Session session;
In the doGet method, I have :
// Create a MimeMessage
out.write("-->" + session + "<--<br>");
Message msg = new MimeMessage(session);
I tried using the eclipse plugin, the automatic deployment directory and the "normal" deply button from the gui.
The session object is always null.
If I change the whole thing and use the "normal" way, defining the mail reference in the web.xml and sun-web.xml using
InitialContext ic = new InitialContext();
Session session2 = (Session)ic.lookup("java:comp/env/mail/test/myMailer");
the whole thing is working correctly
I tried to declare the mail session in the web.xml and then also in the sun-web.xml files (also I think it's not needed there) but the result was the same.
anyone?
greets
jeremie
[Message sent by forum member 'granat' (granat)]
http://forums.java.net/jive/thread.jspa?messageID=227121