Websocket 客户端找不到实现类 [英] Websocket Client Could not find an implementation class

查看:80
本文介绍了Websocket 客户端找不到实现类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将以我没有使用任何 maven 依赖项作为开头,但我知道我缺少一个 jar 文件 wls-api.jar(至少这是我读过的).

I will preface this with I am not using any maven dependencies, yet I know that I am missing a jar file wls-api.jar (at least that is what I have read).

为了解决这个问题,我下载了 oracle-weblogic-7.9.jar 但问题仍然存在.

To remedy this I downloaded the oracle-weblogic-7.9.jar but the problem persists.

在这一行抛出异常

 WebSocketContainer container = ContainerProvider.getWebSocketContainer();

谁能告诉我为什么这条线总是失败?

Can anyone tell me why this line continuously fails?

更新:进一步阅读示例后,我看到使用此依赖项

UPDATE: upon further reading the examples I see use this dependency

<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>

我在服务器和客户端的构建路径中有 javax.websocket-api.jar ,因为它是必需的.我在这里缺少什么?

I have javax.websocket-api.jar in the build path of the server and the client as it is required. What am I missing here?

其他更新:我忘了包括抛出的错误!

Other update: I forgot to include the error thrown!

Exception in thread "main" java.lang.RuntimeException: Could not find an implementation class.
at javax.websocket.ContainerProvider.getWebSocketContainer(ContainerProvider.java:73)
at connect.<init>(connect.java:21)
at test.main(test.java:11)

推荐答案

javax.websocket api 只是规范没有完整的实现你可能需要拿 jar 文件 tyrus-standalone-client-1.9.jar 并尝试应该解决您的问题的相同示例.我用我的例子测试过,它工作正常.

javax.websocket api is only the specification don't have full implementation you may need to take the jar file tyrus-standalone-client-1.9.jar and try the same example that should solve your problem. i tested with my example and it is working fine.

希望对您有所帮助.

这篇关于Websocket 客户端找不到实现类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆