gpt4 book ai didi

websocket - javax.websocket.DeploymentException : org. glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer

转载 作者:行者123 更新时间:2023-12-02 22:19:30 30 4
gpt4 key购买 nike

我正在尝试使用 tyrus 项目创建一个 websocket。我收到以下错误:

java.lang.RuntimeException: javax.websocket.DeploymentException: org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer

at org.glassfish.tyrus.client.ClientManager.<init>(ClientManager.java:272) ~[bundlefile:na]
at org.glassfish.tyrus.client.ClientManager.createClient(ClientManager.java:240) ~[bundlefile:na]
at org.glassfish.tyrus.client.ClientManager.createClient(ClientManager.java:219) ~[bundlefile:na]

我的 pom 依赖项如下所示:

<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-client</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-core</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-spi</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-client-api</artifactId>
<version>1.1</version>
</dependency>

非常简单的java代码:

    logger.info("Creating web socket for url {}", getWebSocketUrl(currentApic.IPAddress, port));
echoUri = new URI(getWebSocketUrl(currentApic.IPAddress, port));
client = ClientManager.createClient();
client.connectToServer(APICWebClient.class, echoUri);

如果我尝试添加容器依赖项

<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-grizzly-server</artifactId>
<version>1.12</version>
</dependency>

我的 mvn clean 安装失败,提示:

 Failed to read artifact descriptor for org.glassfish.tyrus:tyrus-container-grizzly-server:jar:1.4: Could not transfer artifact org.glassfish.tyrus:tyrus-container-grizzly-server:pom:1.4 from/to central (http://repo1.maven.org/maven2): repo1.maven.org: unknown error: Unknown host repo1.maven.org: unknown error -> [Help 1]

已编辑: mvn clean 后上述问题已解决。添加服务器容器和客户端容器包。但我仍然遇到相同的运行时错误 java.lang.RuntimeException:javax.websocket.DeploymentException:org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer

我正在使用OSGi环境。我该如何解决这个问题。需要一些帮助。

最佳答案

类路径中缺少容器org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer。添加 Maven 模块 tyrus-container-grizzly-client

是的,tyrus 抛出的异常可能更准确。

关于websocket - javax.websocket.DeploymentException : org. glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37843644/

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