seam 发mail
代码@Name("mail")
@Scope(ScopeType.APPLICATION)
public class MailBase
{
@Logger
private Log log;
@In
private FacesMessages facesMessages;
@In(create=true)
private Renderer renderer;
@In(value="org.jboss.seam.mail.mailSession")
@Out(value="org.jboss.seam.mail.mailSession")
private MailSession mailSession;
public void send(Strin username,String password) {
try {
mailSession.setPassword(password);
mailSession.setUsername(username);
renderer.render("/mail/易做图.xhtml");
facesMessages.add("Email sent successfully");
} catch (Exception e) {
log.error("Error sending mail", e);
facesMessages.add(FacesMessage.SEVERITY_INFO, "Email sending failed: " + e.getMessage());
}
}
}
调用send方法后出的错误信息
Caused by: java.lang.IllegalArgumentException: Can not set org.jboss.seam.mail.MailSession field com.chexperts.comm.mail.MailBase.mailSession to javax.mail.Session
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
at java.lang.reflect.Field.set(Unknown Source)
at org.jboss.seam.util.Reflections.set(Reflections.java:71)
... 75 more
该如何解决啊??
在线等待 seam email MailSession
补充:Java , Java EE