我完成了客户端WebApp的迁移。以前,它运行在Glassfish 2.1和JDK 1.6上。现在,它在Glassfish 4.1和jdk 1.8上。
当我尝试从我的WebApp发送电子邮件时,JDK 1.6中打包的相同“.war”(Project facets 1.6)在Glassfish 2.1上完美运行,并且不适用于Glassfish 4.0。两条Glassfish在当地运行。
例外是:
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)
我尝试使用telnet从cmd.exe发送电子邮件,但它确实有效。所以我认为问题在于Glassfish 4.1的调整。关于http听众的问题。
您对我的问题有什么建议或想法吗?
谢谢,
答案 0 :(得分:2)
在玻璃鱼上而不是"默认配置"将Djava.net.preferIPv4Stack=true
添加到server-config。我认为它可以解决你的问题