Hey Team,
I have some problems with the example of JNDI Resources "JavaMail
Sessions".
I get the error: The constructor MimeMessage(Session) is undefined
A extract from the HOW-TO page:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (Session) envCtx.lookup("mail/Session");
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(request.getParameter("from"));
InternetAddress to[] = new InternetAddress[1];
to[0] = new InternetAddress(request.getParameter("to"));
message.setRecipients(Message.RecipientType.TO, to);
message.setSubject(request.getParameter("subject"));
message.setContent(request.getParameter("content"), "text/plain");
Transport.send(message);
I develop with Eclipse / Tomcat 6.0 and created a new Web Application.
At first I modify my web descriptor (/WebContent/WEB-INF/web.xml) and
include the resource description.
In the next step I downloaded the JavaMail API, included to the
Tomcat-Library and configure the resource factory
(Tomcat/lib/context.xml).
Eclipse find the JavaMail API but it doesn't find the constructor in
this API.
I hope you can help me. This is a new section for me.
Best regards,
Sebastian
|