Created a mail provider in WAS
Created mail session and selected ‘smtp’ as the protocol
I have a java code which sends out email
Context context = new InitialContext();
Session mailSession = (Session)context.lookup(“mail/mySession”);
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(email)); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(destinationAddress));
// Set the subject and body text
msg.setSubject(subject);
msg.setText(messageBody);
// send message
Transport.send(msg);
I’m getting error as
java.lang.ClassCastException: javax.mail.Session incompatible with javax.mail.Session
My webpshere (C:IBMWebSphereAppServerlib)by default has mailapi.jar. Even navigator.war and taskManagerWeb.war also has the same jar. I think the issue is due to having multiple jars within the same websphere. Can anyone help me on how to solve this issue?