MailEngine と MailServiceUtil の両方を使用してフックからメールを送信しようとしていますが、まだ送信できていません。私のコードは以下の通りです:
InternetAddress from=null;
InternetAddress to=null;
try {
from = new InternetAddress("test@test.com", "Admin admin");
to = new InternetAddress(newUser.getEmailAddress(), newUser.getFirstName());
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MailMessage mailMessage = new MailMessage();
mailMessage.setFrom(from);
mailMessage.setTo(to);
mailMessage.setBody(body);
mailMessage.setSubject(subject);
MailServiceUtil.sendEmail(mailMessage);
これで、次のエラーが発生します。
java.lang.LinkageError: loader constraint violation: when resolving method "com.liferay.portal.kernel.mail.MailMessage.setFrom(Ljavax/mail/internet/InternetAddress;)V" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/lftechnology/sbworkbench/hooks/createaccount/CustomCreateAccountAction, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, com/liferay/portal/kernel/mail/MailMessage, have different Class objects for the type javax/mail/internet/InternetAddress used in the signature
liferay インストールで mail.jar ファイルを見つけましたが、使用できません。アーティファクト ID com.sun を使用して pom ファイルに javax.mail をインポートしようとしましたが、それでもこのエラーが発生します。ここに誰か問題が何であるか知っていますか?
ありがとう