gpt4 book ai didi

java.lang.NoClassDefFoundError : javax/websocket/ClientEndpointConfig$Configurator from StandardWebsocketClient 错误

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:20:53 28 4
gpt4 key购买 nike

我需要编写 websocket 客户端。我开始学习本教程:https://github.com/eugenp/tutorials/blob/master/spring-boot/src/main/java/org/baeldung/websocket

在运行 StomClient 之后我收到了:

    java.lang.NoClassDefFoundError: javax/websocket/ClientEndpointConfig$Configurator

at WebSocketTester.testConnection(WebSocketTester.java:16)

Caused by: java.lang.ClassNotFoundException: javax.websocket.ClientEndpointConfig$Configurator at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 23 more

我的pom只有这个依赖:

    <dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>

客户端和 session 处理程序是从附加链接下的 github 复制的。从客户端类中的 WebSocketClient client = new StandardWebSocketClient(); 这一行抛出异常

最佳答案

尝试添加以下依赖项。它对我有用。

<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>1.9</version>
</dependency>

关于java.lang.NoClassDefFoundError : javax/websocket/ClientEndpointConfig$Configurator from StandardWebsocketClient 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48309357/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com