org.eclipse.jetty.util.ssl.SslContextFactory $ Client ClassNotFoundException升级到Jetty Server 9.4.16 [英] org.eclipse.jetty.util.ssl.SslContextFactory$Client ClassNotFoundException upgrading to Jetty Server 9.4.16
问题描述
我有一个正在使用Jetty服务器版本 9.4.15.v20190215
的应用程序。由于漏洞扫描发现了Jetty服务器依赖项中的问题,我打算升级我的应用程序以使用Jetty服务器 9.4.19-v20190610
(我是最新版本) m写这个。
I have a working application that's been using jetty-server version 9.4.15.v20190215
. Due to a vulnerability scan that found issues in jetty-server dependencies, I looked into upgrading my app to use jetty-server 9.4.19-v20190610
, the latest release as I'm writing this.
我尝试再次编译应用程序,并且在启动过程中遇到此错误:
I tried to compile the application again, and I'm getting this error during startup:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/util/ssl/SslContextFactory$Client
at org.eclipse.jetty.websocket.client.HttpClientProvider.get(HttpClientProvider.java:49)
at org.eclipse.jetty.websocket.client.WebSocketClient.<init>(WebSocketClient.java:261)
at org.eclipse.jetty.websocket.jsr356.ClientContainer.<init>(ClientContainer.java:140)
at org.eclipse.jetty.websocket.jsr356.server.ServerContainer.<init>(ServerContainer.java:94)
at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.configureContext(WebSocketServerContainerInitializer.java:152)
at it.kahoot.merlin.jetty.JettyServer.main(JettyServer.java:53)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.ssl.SslContextFactory$Client
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
我知道 org.eclipse.jetty.util.ssl.SslContextFactory $ Client
类是
我该如何进行?
推荐答案
追溯到导致此问题的第一个码头服务器版本,我发现它是码头服务器版本 9.4.16.v20190411
,其发行说明中提到以下内容:
By tracing back the jetty-server versions to the first one that causes this issue, I found that it's jetty-server version 9.4.16.v20190411
, whose release notes mention the following:
jetty-9.4.16.v20190411 - 11 April 2019
...
+ 3464 Split SslContextFactory into Client and Server
...
给出类名,我认为我需要将 jetty-util
添加到我的依赖项( pom.xml
),所以我这样做了:
Given the class name, I figured I needed to add jetty-util
to my dependencies (pom.xml
), so I did:
<!-- pom.xml -->
...
<properties>
<jetty-version>9.4.19.v20190610</jetty-version>
</properties>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty-version}</version>
</dependency>
<!-- Needed for the SSLContextFactory$Client class -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty-version}</version>
</dependency>
现在,最新的码头可以重新进行编译和启动。
Compilation and startup now work again with the newest Jetty.
这篇关于org.eclipse.jetty.util.ssl.SslContextFactory $ Client ClassNotFoundException升级到Jetty Server 9.4.16的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!