简体   繁体   English

从Glassfish 2.1迁移到Glassfish 4.1后,无法发送电子邮件

[英]Failed to send an email after migration from Glassfish 2.1 to Glassfish 4.1

I did a migration of my Client WebApp. 我进行了客户端WebApp的迁移。 Previously, it was running on Glassfish 2.1 and JDK 1.6. 以前,它在Glassfish 2.1和JDK 1.6上运行。 Now, it's on Glassfish 4.1 and jdk 1.8. 现在,它在Glassfish 4.1和jdk 1.8上。

When I try to send an email from my WebApp, the same ".war" packaged in JDK 1.6 (Project facets 1.6) works perfectly on Glassfish 2.1 and doesn't work on Glassfish 4.0. 当我尝试从WebApp发送电子邮件时,JDK 1.6(Project Facets 1.6)中打包的相同“ .war”在Glassfish 2.1上可以正常使用,而在Glassfish 4.0上则不能使用。 The two Glassfish are running on local. 两条Glassfish正在本地运行。

The exception is : 例外是:

    13917 [http-listener-1(4)] ERROR com.myClient.web.action.myAction- Failed to send email
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: ismtp.corp.capgemini.com, 25; timeout -1;
  nested exception is:
    java.net.SocketException: Network is unreachable: connect
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2053)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697)
    at javax.mail.Service.connect(Service.java:364)
    at javax.mail.Service.connect(Service.java:245)
    at javax.mail.Service.connect(Service.java:194)
    at javax.mail.Transport.send0(Transport.java:253)
    at javax.mail.Transport.send(Transport.java:124)
    at com.labco.web.action.ValiderOubliMdpAction.sendMail(ValiderOubliMdpAction.java:296)

I tried to send email from the cmd.exe with telnet and it works. 我尝试使用telnet从cmd.exe发送电子邮件,并且可以正常工作。 So I think the matter is in the tuning of Glassfish 4.1. 因此,我认为问题在于调整Glassfish 4.1。 problably on the http-listeners. 可能在http-listeners上。

Do you have some recommandations or any ideas about my problem? 您对我的问题有一些建议或想法吗?

Thanks, 谢谢,

On glassfish Instead of "Default-configuration" add Djava.net.preferIPv4Stack=true to server-config. 在glassfish上,在服务器配置中添加Djava.net.preferIPv4Stack=true而不是“ Default-configuration”。 I think it can fix your problem 我认为它可以解决您的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM