如何修复java.lang.NoSuchMethodError:sun.security.ssl.SSLSessionImpl

时间:2018-04-07 16:51:46

标签: java java-ee java-8

应用程序通过使用jsf格式读取参数来发送信件。我不明白为什么以及如何解决它,因为当你从开发环境运行时一切正常。 当我将我的应用程序放在VPS服务器上时,我得到了下一个错误堆栈(尽管应用程序可以根据需要在本地主机上运行):

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NoSuchMethodError: sun.security.ssl.SSLSessionImpl.<init>(Lsun/security/ssl/ProtocolVersion;Lsun/security/ssl/CipherSuite;Ljava/util/Collection;Lsun/security/ssl/SessionId;Ljava/lang/String;I)V
	at sun.security.ssl.ClientHandshaker.serverHello(ClientHandshaker.java:709)
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:984)
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:919)
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:619)
	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:393)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2160)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:726)
	at javax.mail.Service.connect(Service.java:366)
	at org.spirtus.controllers.CustomMailSenderController.sendfromFixedMail(CustomMailSenderController.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at javax.el.ELUtil.invokeMethod(ELUtil.java:304)
	at javax.el.BeanELResolver.invoke(BeanELResolver.java:535)
	at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
	at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
	at org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
	at org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
	at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:107)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
	at javax.faces.component.UICommand.broadcast(UICommand.java:330)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:870)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1418)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1580)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:338)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:652)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
	at java.lang.Thread.run(Unknown Source)

4 个答案:

答案 0 :(得分:2)

我创建并编译了使用版本jdk_8u151和JRE的项目。那时,在服务器上,项目是在后来的jre下启动的。使用相同的版本jre解决了这个问题。 TY。

答案 1 :(得分:1)

我认为这是由于您的JRE中未安装Unlimited Strength Java Cryptography Extension而导致的。

尝试在JRE lib / security文件夹中安装(复制JAR)。从here获取。

只需下载并解压缩内容。您应该获得两个文件 local_policy.jar US_export_policy.jar 。将其复制到$JAVA_HOME/jre/lib/security文件夹。

如果这样可以解决问题,您应该考虑升级Java 8版本。此问题已在Java 8u161或更高版本中得到解决。

答案 2 :(得分:0)

据我了解,缓存库和添加的库之间存在冲突。所以我试图清理缓存,效果很好。在Android Studio中,您应该尝试“文件”->“使缓存无效/重新启动”。

答案 3 :(得分:0)

在我这边,我卸载了jdk版本,然后安装了最新版本的jdk,它像一个魅力一样起作用。因此,请将您的jre或jdk更新到最新版本,即可解决问题。