J'essaie d'envoyer un courrier à partir de l'application de printemps. J'ai inclus tous les fichiers jar mais cela montre cette exception:
javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.Sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.Java:1611)
at com.Sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.Java:1369)
at com.Sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.Java:412)
at javax.mail.Service.connect(Service.Java:310)
at javax.mail.Service.connect(Service.Java:169)
at javax.mail.Service.connect(Service.Java:118)
at javax.mail.Transport.send0(Transport.Java:188)
at javax.mail.Transport.send(Transport.Java:118)
at org.symb.leavemanagement.mail.SampleMail.sentMail(SampleMail.Java:65)
at org.symb.leavemanagement.controller.AdminController.processRegistratingUser(AdminController.Java:196)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:601)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.Java:175)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.Java:421)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.Java:409)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.Java:774)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.Java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.Java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.Java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.Java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.Java:722)
at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:305)
at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:210)
at org.Apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.Java:224)
at org.Apache.catalina.core.StandardContextValve.invoke(StandardContextValve.Java:169)
at org.Apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.Java:472)
at org.Apache.catalina.core.StandardHostValve.invoke(StandardHostValve.Java:168)
at org.Apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.Java:98)
at org.Apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.Java:927)
at org.Apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.Java:118)
at org.Apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.Java:407)
at org.Apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.Java:987)
at org.Apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.Java:579)
at org.Apache.Tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.Java:309)
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:722)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at Sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.Java:541)
at Sun.security.ssl.InputRecord.read(InputRecord.Java:374)
at Sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.Java:893)
at Sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.Java:1294)
at Sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.Java:848)
at Sun.security.ssl.AppInputStream.read(AppInputStream.Java:102)
at com.Sun.mail.util.TraceInputStream.read(TraceInputStream.Java:110)
at Java.io.BufferedInputStream.fill(BufferedInputStream.Java:235)
at Java.io.BufferedInputStream.read(BufferedInputStream.Java:254)
at com.Sun.mail.util.LineInputStream.readLine(LineInputStream.Java:88)
at com.Sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.Java:1589)
... 38 more
Vous essayez d'établir une connexion SSL avec un point de terminaison non SSL. Si vous changez cela devrait fonctionner.
J'ai constaté que la plupart des didacticiels sur l'intégration de votre messagerie avec Outlook/Thunderbird/etc appellent SSL/TSL à une connexion non SSL. En général, ce que j'ai découvert (et cela peut changer mais c'est la norme), c'est que seul le port smtp 465 est SSL. 587 est TSL (pas de SSL) et 25 est simple.