2013-09-22 100 views
1

使用atmosphere-runtime-2.0.0與glassfish 4和primefaces-4.0.RC1一起使用下面的錯誤堆棧跟蹤垃圾郵件。這隻發生在我的glassfish-4安裝(linux + openjdk)之一,但不是另一個在Windows 7上運行相同的應用程序(我真的不認爲它的操作系統問題..)primefaces-push with glassfish-4和Atmosphere:不支持異步操作的過濾器或servlet

在glassfish配置我有爲http-listener-1啓用了彗星和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 [email protected]]] 

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

回答

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>