我计划开始使用PrimeFaces 5.0附带的PrimeFaces Push。我试图运行相同的例子在这里http://www.primefaces.org/showcase/push/notify.xhtml使用Wildfly 8.1,但我不能从后端bean收到任何推送消息。
这是我在wildfly控制台上的内容:
[p] [01:50:34 . 926]最新版本的Atmosphere的JavaScript客户端2.2.201:50:34 . 926 INFO [org.atmosphere.cpr.]当前版本的Atmosphere 2.2.0-RC3最新版Atmosphere可用2.1.7
01:50:37,447 ERROR [org.atmosphere.interceptor.JavaScriptProtocol] (default task-61) Invalid Atmosphere Version 2.2.0-javascript01:50:37 . 448警告[org.atmosphere.websocket.protocol.](default task-61)状态码大于或等于400状态501消息OK01:50:41,957 INFO [stdout] (default task-62)发送消息
[p] 01:55:37,760 ERROR [org.atmosphere.cpr.][异步处理器](默认任务-63)取消资源失败:8cf3d711-00c2-4e52-9d78-97cd04c0b585: java.lang.NullPointerException .PushEndpointHandlerProxy.java:241) [primefaces-5.0.jar:5.0]在org.atmosphere. rpc . asynchronousprocessor . invokeatmospherehandler (AsynchronousProcessor.java:492) [atmosphere-runtime-2.2.0-RC3.jar:2.2.0-RC3][atmosphere-runtime-2.2.0-RC3.jar:2.2.0-RC3]at org.atmosphere. rpc . asynchronousprocessor . endrequest (AsynchronousProcessor.java:548) [atmosphere-runtime-2.2.0-RC3.jar:2.2.0-RC3][atmosphere-runtime-2.2.0-RC3.jar:2.2.0-RC3][atmosphere-runtime-2.2.0-RC3.jar:2.2.0-RC3]在org.atmosphere.container.JSR356Endpoint.onClose(JSR356Endpoint.java:221) [atmosphere-runtime-2.2.0-RC3.jar:2.2.0-RC3][websocket -jsr-1.0.15. jar:1.0.15.Final][endnoter.com] [endnoter.com .jsr. jsr. endnoter.com][au:] [under -websockets-jsr .jar:1.0.15.Final]$1.run(ServerWebSocketContainer.java:303) [undertow-websockets-jsr-1.0.15.Final.jar:1.0.15.Final]$ExecutorTask.run(orderedexexecutor .java:49) [underdow -websockets-jsr-1.0.15.Final.jar:1.0.15.Final]at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55]在java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55]at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55]
这是我的web.xml配置的PrimeFaces推送:
<context-param> <param-name>primefaces.PUSH_SERVER_URL</param-name> <param-value>http://127.0.0.1:8080</param-value> </context-param> <servlet> <servlet-name>Push Servlet</servlet-name> <servlet-class>org.primefaces.push.PushServlet</servlet-class> <load-on-startup>0</load-on-startup> <async-supported>true</async-supported> </servlet> <servlet-mapping> <servlet-name>Push Servlet</servlet-name> <url-pattern>/primepush/*</url-pattern> </servlet-mapping>
我很感谢你帮我解决这个问题。
我在使用Primefaces 5.0和Atmosphere Runtime 2.2.0时也遇到了同样的问题。
解决了这个问题,通过更改为Atmosphere 2.1.7(根据日志输出,这仍然是最新版本)。