我只是按照这里的示例:javax.websocket client simple example
我的maven存储库看起来像:
<!-- https://mvnrepository.com/artifact/javax/javaee-api -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.tyrus/tyrus-container-jdk-client -->
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-jdk-client</artifactId>
<version>1.13</version>
</dependency>
但我无法理解错误信息:
javax.websocket.DeploymentException
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:388)
at pre.Web.<init>(Web.java:19)
at pre.TestApp.main(TestApp.java:10)
Caused by: java.lang.NullPointerException
at org.glassfish.tyrus.core.AnnotatedEndpoint.<init>(AnnotatedEndpoint.java:161)
at org.glassfish.tyrus.core.AnnotatedEndpoint.fromInstance(AnnotatedEndpoint.java:135)
at org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:564)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:871)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:516)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:378)
... 2 more
Exception in thread "main" java.lang.NullPointerException
at pre.Web.sendMessage(Web.java:49)
at pre.TestApp.main(TestApp.java:20)
有什么问题?