1

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,

Hackilltour
  • 113
  • 1
  • 9
  • Have a look at [this](http://stackoverflow.com/questions/18764088/sending-mail-java-net-socketexception-network-is-unreachable-connect) – x80486 Jun 17 '15 at 13:16
  • I tried to add "-Djava.net.preferIPv4Stack=true" to my JVM Options in Glassfish in "Default-configuration" and it didn't work. I disabled IPV6 from network configuration on my computer too – Hackilltour Jun 17 '15 at 13:36

1 Answers1

2

On glassfish Instead of "Default-configuration" add Djava.net.preferIPv4Stack=true to server-config. I think it can fix your problem

Franky
  • 902
  • 2
  • 11
  • 28