Websocket Client Could not find an implementation class

前端 未结 3 1520
温柔的废话
温柔的废话 2021-02-13 09:28

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).

To

相关标签:
3条回答
  • 2021-02-13 10:11

    Adding

    // https://mvnrepository.com/artifact/org.glassfish.tyrus.bundles/tyrus-standalone-client

    compile group: 'org.glassfish.tyrus.bundles', name: 'tyrus-standalone-client', version: '1.9'

    to my build.gradle file worked for me.

    0 讨论(0)
  • 2021-02-13 10:22

    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.

    hope this will help you.

    0 讨论(0)
  • 2021-02-13 10:24

    I think the RuntimeException you are experiencing is fortunately not generated by any direct coding fault of your own.

    The method getWebSocketContainer(), as described here, simply tries to load other classes and get the static instance of the ContainerProvider in the server.

    The method looks for the ContainerProvider implementation class in the order listed in the META-INF/services/javax.websocket.ContainerProvider file, returning the WebSocketContainer implementation from the ContainerProvider implementation that is not null.

    This, unfortunately, means that your project is not configured correctly. Double check to make sure this file is included in your project's build path.

    If other projects you are looking at are using the Maven dependency you described, I would try to set up your project to do the same.

    Hope this helped!

    0 讨论(0)
提交回复
热议问题