GlassFish 3 and long polling problem

UI Components for JSF
Post Reply
rabiter
Posts: 12
Joined: 11 Nov 2014, 13:24

24 Nov 2014, 13:33

Hello Dear All,

I have a problem with long polling run on GlassFish 3.1.2 (WebSockets suppors should be explicitly switched off in GlassFish admin panel to reproduce this issue).
The problem:
when the long polling connection is active and we are going to change the page (or refresh by F5), the page is not switched (refreshed) immediately. Glassfish holds the connection for about 10 seconds and then responds with 0 bytes.
Got this error in logs (happens when I press F5)

Code: Select all

PWC1406: Servlet.service() for servlet FacesServlet threw exception
java.lang.IllegalStateException
        at org.apache.catalina.connector.ResponseFacade.setBufferSize(ResponseFacade.java:275)
        at com.sun.faces.context.ExternalContextImpl.setResponseBufferSize(ExternalContextImpl.java:799)
        at com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:268)
        at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:125)
        at org.primefaces.application.resource.PrimeResourceHandler.handleResourceRequest(PrimeResourceHandler.java:74)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:591)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)...........
I have created a minimalistic example WAR project (the link is below). The application consists of a single page with explanation steps how to reproduce the problem.

Reproducible on GlassFish 3.1.2 (the latest build 5) with switched off WebSocket support (important! because we need long polling, not WebSockets).
Cannot reproduce on JBoss 7 - as usual, JBoss works fine.
Firefox, Chrome and IE9 suffers from this issue (but I'm sure that the problem is on the server side).

I tried to reproduce it on GlassFish 4.1 but I failed because it is impossible to switch off the WebSocket support for GlassFish 4.1 (glassfish bug).

I used PrimeFaces 5.1 with atmosphere-runtime 2.2.2.

The example application (with src) can be downloaded from here:
https://drive.google.com/file/d/0B7XVxg ... sp=sharing

I would highly appreciate any help because we're going to migrate to PrimeFaces and the PMPush working on GF3.1.2 is a vital condition for us.
Thanks in advance and kind regards.

rabiter
Posts: 12
Joined: 11 Nov 2014, 13:24

03 Feb 2015, 10:54

Can anybody help me with this issue? Might it be that the problem is in GF3.1.2?
Does it make sense to try another version of atmosphere-runtime (not 2.2.2)?

rabiter
Posts: 12
Joined: 11 Nov 2014, 13:24

03 Feb 2015, 16:28

If I try to use WebSockets instead of comet I get another exception when trying to send a message from the server to client:

Code: Select all

java.lang.AbstractMethodError: com.sun.grizzly.websockets.ServerNetworkHandler$WSServletRequestImpl.isAsyncSupported()Z
    at org.atmosphere.cpr.AtmosphereRequest.isAsyncSupported(AtmosphereRequest.java:917)
    at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:120)
    at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:98)
    at org.atmosphere.container.GrizzlyServlet30WebSocketSupport.service(GrizzlyServlet30WebSocketSupport.java:73)
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1809)
    at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:434)
    at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:187)
    at org.atmosphere.container.GlassFishWebSocketHandler.onConnect(GlassFishWebSocketHandler.java:132)
    at com.sun.grizzly.websockets.DefaultWebSocket.onConnect(DefaultWebSocket.java:140)
    at com.sun.grizzly.websockets.WebSocketEngine.upgrade(WebSocketEngine.java:189)
    at com.sun.grizzly.websockets.WebSocketAsyncFilter.doFilter(WebSocketAsyncFilter.java:54)
    at com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:171)
    at com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:143)
    at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:102)
    at com.sun.grizzly.http.TaskBase.run(TaskBase.java:193)
    at com.sun.grizzly.http.TaskBase.execute(TaskBase.java:175)
    at com.sun.grizzly.arp.DefaultAsyncHandler.handle(DefaultAsyncHandler.java:145)
    at com.sun.grizzly.arp.AsyncProtocolFilter.execute(AsyncProtocolFilter.java:210)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:744)
It is said that this bug is resolved in atmosphere 2.3.RC2:
https://github.com/Atmosphere/atmospher ... 5525eab6e3
But I cannot use atmosphere 2.3 because this is incompatible with primefaces 5.1.

It looks like PrimeFaces 5.1 Push cannot be used with GlassFish 3.1.2 (build 5) at all (neither Comet nor WebSockets due to different reasons).
Last edited by rabiter on 04 Feb 2015, 10:53, edited 1 time in total.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

04 Feb 2015, 00:27

Pf 2.1? Time to migrate as you start to experience now

rabiter
Posts: 12
Joined: 11 Nov 2014, 13:24

04 Feb 2015, 09:45

I'm sorry, I meant PrimeFaces 5.1, of course (not 2.1) :)
So, to conclude, it makes me thinking that PrimeFaces 5.1 Push cannot be used with GlassFish 3.1.2 the latest build 5 (neither Comet nor WebSockets due to different reasons described above).

rabiter
Posts: 12
Joined: 11 Nov 2014, 13:24

05 Feb 2015, 10:21

Ok, looks like I've got Comet working. I set parameter 'org.atmosphere.useNative' = true:

Code: Select all

    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <init-param>
            <param-name>org.atmosphere.useNative</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>
Also I have Commet Support switched to on in the Glassfish admin panel. Hope this help somebody in future.

anmol94
Posts: 1
Joined: 18 Feb 2015, 21:05

18 Feb 2015, 21:07

I tried to reproduce it on GlassFish 4.1 but I failed because it is impossible to switch off the WebSocket support for GlassFish 4.1 (glassfish bug).
**SignaturE**

next801
Posts: 5
Joined: 27 Jan 2017, 20:57

27 Jan 2017, 21:03

Thanks for the useful information! I helped your advice!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests