通过GMail从Glassfish发送邮件会抛出java.net.UnknownHostException

时间:2014-07-07 07:38:45

标签: java email glassfish gmail javamail

我有一个发送电子邮件的Glassfish v3应用程序。它已经运行了很多年,但从7月2日开始,它失败了java.net.UnknownHostException。

请在下面找到我的JavaMail配置和Glassfish日志条目。

任何想法都将不胜感激。

  

JavaMail会话配置

     

邮件主持人:imap.gmail.com

     

默认用户:mailrobot-se @ s **** x.se

     

默认回邮地址:mailrobot-se @ s **** x.se

     

状态:已启用

     

存储协议:imap

     

存储协议类:com.sun.mail.imap.IMAPStore

     

传输协议:smtp

     

传输协议类:com.sun.mail.smtp.SMTPTransport

     

调试:未启用

     

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

和日志条目

  

日志条目明细

     

时间戳2014-jul-07 08:31:12.392

     

日志级别严重

     

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

     

名称 - 值对{_ThreadName = Thread-1,_ThreadID = 57

     

记录编号1734

     

消息ID javax.mail.MessagingException

     

完整邮件未知SMTP主机:smtp.gmail.com;嵌套异常是: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)在javax.mail.Service.connect(Service.java:291)的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.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。在org.glassfish.ejb.secur的org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)上反映.Method.invoke(Method.java:616)位于com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5243)的ity.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)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位于sun.reflect.DelegatingMethodAccessorImpl.invoke的sun.reflect.GeneratedMethodAccessor56.invoke(未知来源)的com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)中的.doAround(SystemInterceptorProxy.java:157) (DelegatingMethodAccessorImpl.java:43)位于com.sun的com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)的java.lang.reflect.Method.invoke(Method.java:616)中。 ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java :797)com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)at com.sun.ejb.containers.BaseContainer .__ intercept(BaseContainer.java:5215)at com.sun.ejb。 container.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)位于se.saljex.sxserver.SxServerMainBean.handleJobbTimer(SxServerMainBean.java:229)的$ Proxy143.handleJobb(未知来源)at se.saljex.sxserver.SxServerMainBean.handleTimer(SxServerMainBean.java:102)at sun.reflect.GeneratedMethodAccessor394。在org.glassfish.ejb.security.application.EJBSecurityManager的java.lang.reflect.Method.invoke(Method.java:616)的sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中调用(未知来源)。 org.gl上的runMethod(EJBSecurityManager.java:1052) com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5243)中的assfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)位于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位于sun.reflect的sun.reflect.GeneratedMethodAccessor393.invoke(未知来源)的com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundTimeout(SystemInterceptorProxy.java:144)中的.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157) 。在java.sng.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)中的java.lang.reflect.Method.invoke(Method.java:616)中删除了MethodAethorAccess.Ivin(驱动方法。 com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(INTE rceptorManager.java:797)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 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)在java.lang.Thread.run上的java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:603) Thread.java:636)由java.net.SocksSocketImpl.connect(SocksSocketImpl.java:381)引起的java.net.UnknownHostException:java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:158)中的smtp.gmail.com at java..Socket.connect(Socket.java:537)at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:570)at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)at at Com.sun.mail.util.SmailFetcher.createSocket(SocketFetcher.java:284)位于com.sun.mail.util.SmailFetcher.getSocket(SocketFetcher.java:227)的com.sun.mail.smtp.SMTPTransport.openServer( SMTPTransport.java:1672)..61 more

1 个答案:

答案 0 :(得分:0)

问题解决了。

毕竟,事实证明这是一个dns问题。