1
votes

I have a Glassfish v3 application that sends e-mail. It has worked fine for many years, but starting from July 2 it fails with java.net.UnknownHostException.

Below please find my JavaMail configuration and the Glassfish log entry.

Any ideas would be appreciated.

JavaMail Session configuration

Mail Host: imap.gmail.com

Default User: mailrobot-se@s****x.se

Default Return Address: mailrobot-se@s****x.se

Status: Enabled

Store Protocol: imap

Store Protocol Class: com.sun.mail.imap.IMAPStore

Transport Protocol: smtp

Transport Protocol Class: com.sun.mail.smtp.SMTPTransport

Debug: Not Enabled

mail-smtps-host smtp.gmail.com

mail-smtps-password ****

mail-smtps-socketFactory-class javax.net.ssl.SSLSocketFactory

mail-smtps-auth true

mail-smtps-socketFactory-port 465

mail-smtps-socketFactory-fallbac false

mail-smtps-port 465

mail-smtps-user mailrobot-se@s****x.se

mail-smtps-starttls-enable true

And the log entry

Log Entry Detail

Timestamp 2014-jul-07 08:31:12.392

Log Level SEVERE

Logger javax.enterprise.system.std.com.sun.enterprise.v3.services.impl

Name-Value Pairs {_ThreadName=Thread-1, _ThreadID=57

Record Number 1734

Message ID javax.mail.MessagingException

Complete Message Unknown SMTP host: smtp.gmail.com; nested exception is: java.net.UnknownHostException: smtp.gmail.com at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1704) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525) at javax.mail.Service.connect(Service.java:291) at javax.mail.Service.connect(Service.java:172) at se.saljex.sxserver.SendMail.sendMail(SendMail.java:190) at se.saljex.sxserver.SendMail.sendMailTextHtmlPdf(SendMail.java:180) at se.saljex.sxserver.JobbHandler.sendFakturaEpost(JobbHandler.java:147) at se.saljex.sxserver.JobbHandler.handleSandFakturaEpost(JobbHandler.java:119) at se.saljex.sxserver.SxServerMainBean.handleJobb(SxServerMainBean.java:278) at sun.reflect.GeneratedMethodAccessor387.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052) at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124) at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5243) at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797) at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139) at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797) at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367) at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5215) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5203) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84) at $Proxy143.handleJobb(Unknown Source) at se.saljex.sxserver.SxServerMainBean.handleJobbTimer(SxServerMainBean.java:229) at se.saljex.sxserver.SxServerMainBean.handleTimer(SxServerMainBean.java:102) at sun.reflect.GeneratedMethodAccessor394.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052) at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124) at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5243) at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797) at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundTimeout(SystemInterceptorProxy.java:144) at sun.reflect.GeneratedMethodAccessor393.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797) at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367) at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5215) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5203) at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:3916) at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1667) at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:98) at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:2485) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636) Caused by: java.net.UnknownHostException: smtp.gmail.com at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:158) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:381) at java.net.Socket.connect(Socket.java:537) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:570) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:284) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1672) ... 61 more

1
Are you behind a proxy?unwichtich
No, not behind proxy. I can telnet smtp.gmail.com 465Ulf Berg
The telnet is run on the same machine as the application? Has someone installed a new firewall or anti-virus? Have you rebooted the application machine? "Unknown host" usually means it's a name service (DNS) lookup problem.Bill Shannon
Thanks Bill! It was a dns problem after all.Ulf Berg

1 Answers

0
votes

Problem solved.

It turned out to be a dns problem after all.