javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at cn.com.sparknet.oa.controller.email.SimpleMailSender.sendTextMail(SimpleMailSender.java:68)
at cn.com.sparknet.oa.controller.email.SendEmailController.sendemail(SendEmailController.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at cn.com.sparknet.support.spring.controller.AbstractController.handlerPost(AbstractController.java:80)
at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:421)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:136)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at cn.com.sparknet.oa.controller.commons.SystemManageFilter.doFilter(SystemManageFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
... 50 more
17:12 DEBUG [cn.com.sparknet.support.spring.controller.json.AbstractControllerJson] 设置contentType为:text/html; charset=utf-8
17:12 DEBUG [cn.com.sparknet.support.spring.controller.json.AbstractControllerJson] result is null
5 个解决方案
#1
收完邮件,在发邮件时就报错了
是不是有些资源没有关闭造成的?
是不是有些资源没有关闭造成的?
#2
javaMail中有
Session.getDefaultInstance(props);
session.getInstance(props);
你是不是用的上面的 改为下面的
它每次都创建一个新的session 就不会出现这种问题
Session.getDefaultInstance(props);
session.getInstance(props);
你是不是用的上面的 改为下面的
它每次都创建一个新的session 就不会出现这种问题
#3
我也这样感觉的,但我不知道该关闭什么,我刚接触这个对javaMailApi还不是很了解,由于手上的任务比较多,基本上都是在网上照抄的,我看了一下,收发邮件都用到了Message 来保存邮件信息的
#4
我来试下
#5
对了,是这个原因,谢谢这们大侠!
我还想请教一下,javamail pop3协议有没有收最近几天的邮件的方法啊!期待中……
我还想请教一下,javamail pop3协议有没有收最近几天的邮件的方法啊!期待中……
#1
收完邮件,在发邮件时就报错了
是不是有些资源没有关闭造成的?
是不是有些资源没有关闭造成的?
#2
javaMail中有
Session.getDefaultInstance(props);
session.getInstance(props);
你是不是用的上面的 改为下面的
它每次都创建一个新的session 就不会出现这种问题
Session.getDefaultInstance(props);
session.getInstance(props);
你是不是用的上面的 改为下面的
它每次都创建一个新的session 就不会出现这种问题
#3
我也这样感觉的,但我不知道该关闭什么,我刚接触这个对javaMailApi还不是很了解,由于手上的任务比较多,基本上都是在网上照抄的,我看了一下,收发邮件都用到了Message 来保存邮件信息的
#4
我来试下
#5
对了,是这个原因,谢谢这们大侠!
我还想请教一下,javamail pop3协议有没有收最近几天的邮件的方法啊!期待中……
我还想请教一下,javamail pop3协议有没有收最近几天的邮件的方法啊!期待中……