启动时出现Eclipse错误

时间:2018-05-03 05:22:18

标签: eclipse jboss java-8 java-7 wildfly-11

我试图将我的项目从java 7移动到8.当我开始通过wildfly11调试我的项目时,它显示此错误并且我的部署失败。

 DEBUG [io.undertow] (MSC service thread 1-7) JDK9 ALPN not supported: java.lang.NoSuchMethodException: javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;)
at java.lang.Class.getMethod(Unknown Source) [rt.jar:1.8.0_31]
at io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_31]
at io.undertow.protocols.alpn.JDK9AlpnProvider.<clinit>(JDK9AlpnProvider.java:43) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_31]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.8.0_31]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.8.0_31]
at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.8.0_31]
at java.lang.Class.newInstance(Unknown Source) [rt.jar:1.8.0_31]
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source) [rt.jar:1.8.0_31]
at java.util.ServiceLoader$LazyIterator.next(Unknown Source) [rt.jar:1.8.0_31]
at java.util.ServiceLoader$1.next(Unknown Source) [rt.jar:1.8.0_31]
at io.undertow.protocols.alpn.ALPNManager.<init>(ALPNManager.java:40) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at io.undertow.protocols.alpn.ALPNManager.<clinit>(ALPNManager.java:35) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at io.undertow.server.protocol.http.AlpnOpenListener.<init>(AlpnOpenListener.java:68) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at io.undertow.server.protocol.http.AlpnOpenListener.<init>(AlpnOpenListener.java:90) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at io.undertow.server.protocol.http.AlpnOpenListener.<init>(AlpnOpenListener.java:82) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
at org.wildfly.extension.undertow.HttpsListenerService.createAlpnOpenListener(HttpsListenerService.java:101) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.HttpsListenerService.createOpenListener(HttpsListenerService.java:86) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:160) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032) [jboss-msc-1.2.7.SP1.jar:1.2.7.SP1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955) [jboss-msc-1.2.7.SP1.jar:1.2.7.SP1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_31]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_31]

提前致谢。

2 个答案:

答案 0 :(得分:1)

首先,在Java 7或8中都没有Application Layer Protocol Negotiation(ALPN)支持。在类setApplicationProtocols()的文档中没有这样的方法SSLParameters Java 7Java 8。我想知道你的项目如何能够在没有setApplicationProtocols()方法的情况下在Java 7中运行。

然而,自Java 9以来,ALPN已成为Java SE标准的一部分。您可以找到setApplicationProtocols() here的文档。

如果您不想升级到Java 9并仍然使用ALPN,则可以使用提供具有ALPN支持的库的Jetty项目。 Jetty的ALPN启动jar适用于OpenJDK和Oracle的JDK(基于OpenJDK)。如果您在设置Jetty的ALPN jar时遇到任何问题,那么已经有question

答案 1 :(得分:0)

要摆脱错误(从而不使用ALPN),请将enable-http2中的http-listenerhttps-listener设置为false