1

atmosphere-runtime-2.0.0与 glassfish 4 一起使用,我primefaces-4.0.RC1收到以下错误堆栈跟踪的垃圾邮件。这仅发生在我的 glassfish-4 安装之一(linux + openjdk)上,但不会发生在 Windows 7 上运行相同应用程序的另一个上(我真的不认为这是操作系统问题..)

在 glassfish 配置中,我为 http-listener-1 启用了 comet 和 websockets。除此之外,一切都应该是默认的 glassfish-4 设置(不同的数据库等,但我希望这真的不相关)。

是否有一些我忘记了导致不同行为的 gf4 实例之一的设置?

[#|2013-09-21T23:38:23.159+0200|INFO|glassfish 4.0||_ThreadID=20;_ThreadName=Thread-3;_TimeMillis=1379799503159;_LevelValue=800;|
  2013-09-21 23:38:23,159 [p-listener-1(2)] ERROR AtmosphereFramework            - AtmosphereFramework exception
java.lang.IllegalStateException: Request is within the scope of a filter or servlet that does not support asynchronous operations
    at org.apache.catalina.connector.Request.startAsync(Request.java:4259)
    at org.apache.catalina.connector.Request.startAsync(Request.java:4236)
    at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1044)
    at org.atmosphere.cpr.AtmosphereRequest.startAsync(AtmosphereRequest.java:505)
    at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:128)
    at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:103)
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1675)
    at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:177)
    at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:163)
    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:253)
    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:357)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:724)|#]

在错误之前只有正常的大气启动痕迹,在windows和linux上看起来非常相似

INFO  AtmosphereFramework            - Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation]]
INFO  DefaultAnnotationProcessor     - AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$ServletContainerInitializerAnnotationProcessor being used]]
ERROR DefaultAnnotationProcessor     - No @AtmosphereService annotation found. Annotation won't work.]]
INFO  AtmosphereFramework            - Auto detecting atmosphere handlers /WEB-INF/classes/]]
INFO  AtmosphereFramework            - Auto detecting WebSocketHandler in /WEB-INF/classes/]]
INFO  AtmosphereFramework            - Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol]]
INFO  AtmosphereFramework            - Installing Default AtmosphereInterceptor]]
INFO  AtmosphereFramework            -  org.atmosphere.interceptor.DefaultHeadersInterceptor : Default Response's Headers Interceptor]]
INFO  AtmosphereFramework            -  org.atmosphere.interceptor.PaddingAtmosphereInterceptor : Browser Padding Interceptor Support]]
INFO  AtmosphereFramework            -  org.atmosphere.interceptor.AndroidAtmosphereInterceptor : Android Interceptor Support]]
INFO  AtmosphereFramework            -  org.atmosphere.interceptor.SSEAtmosphereInterceptor : SSE Interceptor Support]]
INFO  AtmosphereFramework            -  org.atmosphere.interceptor.JSONPAtmosphereInterceptor : JSONP Interceptor Support]]
INFO  AtmosphereFramework            -  org.atmosphere.interceptor.JavaScriptProtocol : Atmosphere JavaScript Protocol]]
INFO  AtmosphereFramework            -  org.atmosphere.interceptor.OnDisconnectInterceptor : Browser disconnection detection]]
INFO  AtmosphereFramework            - Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults to disable them.]]
WARN  AtmosphereFramework            - No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache]]
INFO  AtmosphereFramework            - Broadcaster Polling Wait Time 100]]
INFO  AtmosphereFramework            - Shared ExecutorService supported: true]]
INFO  AtmosphereFramework            - HttpSession supported: false]]
INFO  AtmosphereFramework            - Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory]]
INFO  AtmosphereFramework            - Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor]]
INFO  AtmosphereFramework            - Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster]]
INFO  AtmosphereFramework            - Atmosphere is using async support: org.atmosphere.container.JSR356AsyncSupport running under container: GlassFish Server Open Source Edition  4.0  using javax.servlet/3.0 using javax.servlet/3.0 and jsr356/WebSocket API]]
INFO  AtmosphereFramework            - Atmosphere Framework 2.0.0 started.]]
INFO  AtmosphereFramework            - 

    For Atmosphere Framework Commercial Support, visit 
    http://www.async-io.org/ or send an email to support@async-io.org]]

INFO  AtmosphereFramework            - Installed AtmosphereInterceptor Atmosphere LifeCycle with priority AFTER_DEFAULT]]
4

1 回答 1

8

添加<async-supported>true</async-supported>解决Push Servlet了这个问题。没有解释为什么它对我的 glassfish 实例起作用。

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaeehttp://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
... 
    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>
...
</web-app>
于 2013-10-07T17:47:16.997 回答