I did a migration of my Client WebApp. Previously, it was running on Glassfish 2.1 and JDK 1.6. Now, it's on Glassfish 4.1 and 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. The two Glassfish are running on local.
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. So I think the matter is in the tuning of Glassfish 4.1. problably on the 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. I think it can fix your problem