Pessoal, estou com o seguinte problema: eu tenho uma aplicação JSP que funciona 100% no tomcat do windows, mas quando a rodo no linux (no servidor onde tem q ficar) ele não envia e-mails. Esse é o c´dogio da minha classe
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public abstract class EMail {
public static final void enviarEMailSimples(String servidor, String assunto,
String para,String de, String mensagem)
throws AddressException, MessagingException {
Properties mailProps = new Properties();
mailProps.put("mail.smtp.host", servidor);
Session mailSession = Session.getDefaultInstance(mailProps, null);
InternetAddress destinatario = new InternetAddress (para);
InternetAddress remetente = new InternetAddress (de);
Message message = new MimeMessage (mailSession);
message.setFrom(remetente);
message.setRecipient( Message.RecipientType.TO, destinatario );
message.setSubject (assunto);
message.setContent (mensagem.toString(), "text/html");
Transport.send(message);
}
}
Ele dá o seguinte erro:
java.lang.ClassCastException: gnu.mail.handler.TextHtml
at javax.activation.MailcapCommandMap.getDataContentHandler(MailcapCommandMap.java:596)
at javax.activation.MailcapCommandMap.createDataContentHandler(MailcapCommandMap.java:550)
at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:611)
at javax.activation.DataHandler.writeTo(DataHandler.java:315)
at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:181)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1055)
at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1841)
at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1822)
at javax.mail.Transport.send(Transport.java:80)
at br.gov.dprf.nit8.intranet.util.EMail.enviarEMailSimples(EMail.java:71)
at br.gov.dprf.nit8.intranet.servlet.IntranetServlet.processRequest(IntranetServlet.java:126)
at br.gov.dprf.nit8.intranet.servlet.IntranetServlet.doPost(IntranetServlet.java:175)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Se alguém puder me ajudar eu agradeço muito