我试图使旧的Java 7 EE WebSocket应用程序:https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/HomeWebsocket/WebsocketHome.html在Payara Server 5.184 #badassfish(build 89)中工作
但是,WebSocket(@ServerEndpoint)无法实例化。
Severe: Exception in thread "glassfish-web-async-thread-1" Severe:
java.lang.NullPointerException at
org.apache.catalina.connector.InputBuffer$ReadHandlerImpl.processAllDataRead(InputBuffer.java:492) at
org.apache.catalina.connector.InputBuffer$ReadHandlerImpl.access$800(InputBuffer.java:385) at
org.apache.catalina.connector.InputBuffer$ReadHandlerImpl$2.run(InputBuffer.java:475) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at
java.lang.Thread.run(Thread.java:748)
通过启用CDI开发模式,我看到:
WARN: WELD-001703: Unable to determine the @Intercepted Bean<?> for
[UnbackedAnnotatedField] @Inject @Intercepted private
org.jboss.weld.probe.InvocationMonitor.interceptedBean WARN:
PROBE-000020: A problem occured during monitoring of bean instance
construction: null java.lang.RuntimeException: at
com.magicpigeon.websocket.DeviceWebSocketServer.<init>(DeviceWebSocketServer.java:1) at
com.magicpigeon.websocket.DeviceWebSocketServer$Proxy$_$$_WeldSubclass.<init>(Unknown Source) at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
DeviceWebSocketServer
是我的@ServerEndpoint类。有没有与CDI有关的错误?我能错过什么?
代码在这里:https://github.com/DanielMerchan/WebsocketHome如果有人想尝试一下。这在我以前使用Glassfish的旧Netbeans中工作(不记得版本)。
谢谢。
如果我保留Java EE 7,它就可以工作。升级到Java EE 8时不知道发生了什么。