javax.mail.MessagingException:无法连接到SMTP主机:xxxxxxxx port:xx; 嵌套异常是: javax.net.ssl.SSLException:java.lang.RuntimeException:无法生成DH密钥对 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1706) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525) 在javax.mail.Service.connect(Service.java:291) 在javax.mail.Service.connect(Service.java:172) 在javax.mail.Service.connect(Service.java:121) 在javax.mail.Transport.send0(Transport.java:190) 在javax.mail.Transport.send(Transport.java:120) 在com.loyauty.web.struts.action.user.CustomerSignUp.execute(CustomerSignUp.java:111) at sun.reflect.GeneratedMethodAccessor3375.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:601) 在com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441) 在com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) 在com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) 在com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) 在com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) 在com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) 在org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) 在com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) 在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) 在org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) 在org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 在com.loyauty.web.filter.JsessionFilter.doFilter(JsessionFilter.java:72) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 在com.loyauty.web.filter.LocaleFilter.doFilter(LocaleFilter.java:62) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 在com.loyauty.web.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:60) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) 在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) 在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:565) 在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) 在java.lang.Thread.run(Thread.java:722) 引起:javax.net.ssl.SSLException:java.lang.RuntimeException:无法生成DH密钥对 at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) 在sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1868) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1826) at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1809) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1328) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1305) at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:503) 在com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:234) 在com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1672) ......还有62个 引起:java.lang.RuntimeException:无法生成DH密钥对 在sun.security.ssl.DHCrypt。(DHCrypt.java:123) at sun.security.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:618) 在sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:202) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868) 在sun.security.ssl.Handshaker.process_record(Handshaker.java:804) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:998) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1321) ......还有66个 引起:java.security.InvalidAlgorithmParameterException:Prime大小必须是64的倍数,并且只能是512到1024(含) 在com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:120) at java.security.KeyPairGenerator $ Delegate.initialize(KeyPairGenerator.java:658) 在sun.security.ssl.DHCrypt。(DHCrypt.java:117)
答案 0 :(得分:0)
SSL层出现了问题。
您曾能够连接到此主机吗?
此主机是否使用有效的SSL证书?
您使用的是哪种版本的JDK?
This stackoverflow entry可能有所帮助。 (您在发布前搜索了错误消息,对吗?)