尝试在GlassFish Server 4.1上运行PrimeFaces推送时,当来自atmosphere-runtime-libs-2.4.0-RC6-distribution
zip的以下JAR文件被添加到类路径时,我得到以下异常。
我从分发zip包中添加了以下JAR文件。
或者尝试使用atmosphere-jersey-libs-2.4.0-RC6-distribution.zip
,但无济于事。
Warning: StandardWrapperValve[Push Servlet]: Servlet.service() for servlet Push Servlet threw exception
java.lang.IncompatibleClassChangeError: Found interface org.atmosphere.cpr.AtmosphereRequest, but class was expected
at org.primefaces.push.impl.PushEndpointMapper.computePath(PushEndpointMapper.java:54)
at org.primefaces.push.impl.PushEndpointMapper.map(PushEndpointMapper.java:78)
at org.atmosphere.cpr.AsynchronousProcessor.map(AsynchronousProcessor.java:381)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:179)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:109)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:68)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2310)
at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:190)
at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:176)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:295)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
以下Servlet已在web.xml
中注册。
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/websockets/*</url-pattern>
</servlet-mapping>
已成功部署应用程序。例外情况发生在运行时,即请求有问题的网页时。
PrimeFaces 5.2 user guide表示以下Maven依赖(我不使用Apache Maven来松散地/手动地构建和部署应用程序维护库)。
在您的
pom.xml
中运行PrimeFaces Push需要大气层 将依赖项定义为;<dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-runtime</artifactId> <version>2.3.RC6 or newer</version> </dependency>
因此,它应该与2.4.0-RC6
一起使用。
有什么问题?它应该根据用户指南兼容。它是否需要<p:socket>
的其他一些库才能工作?
在GlassFish Server 4.1上使用Mojarra 2.2.12 / PrimeFaces 5.2(社区发布)。
更新:
尝试使用以下库时,
网页留空,服务器在请求页面时记录以下消息。
Info: Installed AtmosphereInterceptor Atmosphere LifeCycle with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor Track Message Size Interceptor using | with priority BEFORE_DEFAULT
Info: Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation
Info: AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$ServletContainerInitializerAnnotationProcessor being used
Info: Found Annotation in class org.primefaces.push.impl.PushEndpointProcessor being scanned: interface org.atmosphere.config.AtmosphereAnnotation
Info: Found Annotation in class org.primefaces.push.impl.PushEndpointInterceptor being scanned: interface org.atmosphere.config.service.AtmosphereInterceptorService
Info: Found Annotation in class org.primefaces.push.impl.PushEndpointMapper being scanned: interface org.atmosphere.config.service.EndpointMapperService
Info: Found Annotation in class primefaces.push.Push being scanned: interface org.primefaces.push.annotation.PushEndpoint
Info: Installed AtmosphereHandler org.primefaces.push.impl.PushEndpointHandlerProxy mapped to context-path /notify and Broadcaster Class org.atmosphere.cpr.DefaultBroadcaster
Info: Installed AtmosphereInterceptor [@PushEndpoint Interceptor] mapped to AtmosphereHandler org.primefaces.push.impl.PushEndpointHandlerProxy
Info: Auto detecting WebSocketHandler in /WEB-INF/classes/
Info: Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
Info: Installing Default AtmosphereInterceptors
Info: org.atmosphere.interceptor.CorsInterceptor : CORS Interceptor Support
Info: org.atmosphere.interceptor.CacheHeadersInterceptor : Default Response's Headers Interceptor
Info: org.atmosphere.interceptor.PaddingAtmosphereInterceptor : Browser Padding Interceptor Support
Info: org.atmosphere.interceptor.AndroidAtmosphereInterceptor : Android Interceptor Support
Info: org.atmosphere.interceptor.HeartbeatInterceptor : Heartbeat Interceptor Support
Info: org.atmosphere.interceptor.SSEAtmosphereInterceptor : SSE Interceptor Support
Info: org.atmosphere.interceptor.JSONPAtmosphereInterceptor : JSONP Interceptor Support
Info: org.atmosphere.interceptor.JavaScriptProtocol : Atmosphere JavaScript Protocol
Info: org.atmosphere.interceptor.WebSocketMessageSuspendInterceptor : org.atmosphere.interceptor.WebSocketMessageSuspendInterceptor
Info: org.atmosphere.interceptor.OnDisconnectInterceptor : Browser disconnection detection
Info: org.atmosphere.interceptor.IdleResourceInterceptor : org.atmosphere.interceptor.IdleResourceInterceptor
Info: Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults to disable them.
Info: Installed AtmosphereInterceptor Atmosphere LifeCycle with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor Track Message Size Interceptor using | with priority BEFORE_DEFAULT
Info: Installed AtmosphereInterceptor CORS Interceptor Support with priority FIRST_BEFORE_DEFAULT
Info: Installed AtmosphereInterceptor Default Response's Headers Interceptor with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor Browser Padding Interceptor Support with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor Android Interceptor Support with priority AFTER_DEFAULT
Info: HeartbeatInterceptor configured with padding value 'X', client frequency 60 seconds and server frequency 0 seconds
Info: Installed AtmosphereInterceptor Heartbeat Interceptor Support with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor SSE Interceptor Support with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor JSONP Interceptor Support with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor Atmosphere JavaScript Protocol with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor org.atmosphere.interceptor.WebSocketMessageSuspendInterceptor with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor Browser disconnection detection with priority AFTER_DEFAULT
Info: Installed AtmosphereInterceptor org.atmosphere.interceptor.IdleResourceInterceptor with priority BEFORE_DEFAULT
Info: Using EndpointMapper class org.primefaces.push.impl.PushEndpointMapper
Warning: No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache
Info: Default Broadcaster Class: org.atmosphere.cpr.DefaultBroadcaster
Info: Broadcaster Shared List Resources: false
Info: Broadcaster Polling Wait Time 100
Info: Shared ExecutorService supported: true
Info: Messaging Thread Pool Size: Unlimited
Info: Async I/O Thread Pool Size: 200
Info: Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
Info: Using AtmosphereResurceFactory: org.atmosphere.cpr.DefaultAtmosphereResourceFactory
Info: Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
Info: Invoke AtmosphereInterceptor on WebSocket message true
Info: HttpSession supported: false
Info: Atmosphere is using org.atmosphere.inject.InjectableObjectFactory for dependency injection and object creation
Info: Atmosphere is using async support: org.atmosphere.container.GlassFishServ30WebSocketSupport running under container: GlassFish Server Open Source Edition 4.1 with WebSocket enabled.
Info: Atmosphere Framework 2.3.0-RC6 started.
Info:
For Atmosphere Framework Commercial Support, visit
http://www.async-io.org/ or send an email to support@async-io.org
Info: Installed AtmosphereInterceptor @PushEndpoint Interceptor with priority AFTER_DEFAULT
Info: Latest version of Atmosphere's JavaScript Client 2.2.12
Info:
Current version of Atmosphere 2.3.0-RC6
Newest version of Atmosphere available 2.2.8
更新2:
使用PrimeFaces 5.3 final(社区发布)也会发生同样的事情。