Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[Glassfish] PWC3990: getWriter() has already been called for this response #722

Closed
smithh032772 opened this Issue · 19 comments

5 participants

@smithh032772

This is maybe my 3rd or 4th time attempting to use PrimeFaces Push (FacesMessage example) in my app which consists of MyFaces 2.1.9, PrimeFaces 3.4.1 and Glassfish Open Source 3.1.2.2 (build 5), and OmniFaces 1.3-SNAPSHOT (for gzip, etc...).

Within the last 1 or 2 hours, I downloaded atmosphere-runtime along with atmosphere-compat jbossweb, tomcat, tomcat7, and they all were 1.1.0.beta1 JARs.

Ever since my first attempt, I have always experienced the following (unacceptable behavior/exceptions):

  1. my JSF page (in a client/browser) being replaced by a JSON message, which includes the FacesMessage being pushed to client browsers

  2. some facesmessages would be pushed to client browsers, and some would not; behavior listed in #1 would occur so much from user attempting to push message to any/all users

  3. the following exception in my server log:

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: PWC3990: getWriter() has already been called for this response
at org.apache.catalina.connector.Response.getOutputStream(Response.java:674)
at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:206)
at org.omnifaces.servlet.GzipHttpServletResponse$GzipThresholdOutputStream.createGzipOutputStreamIfNecessary(GzipHttpServletResponse.java:248)
at org.omnifaces.servlet.GzipHttpServletResponse$GzipThresholdOutputStream.write(GzipHttpServletResponse.java:184)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
at java.io.Writer.write(Writer.java:127)
at org.omnifaces.io.ResettableBufferedWriter.close(ResettableBufferedWriter.java:94)
at java.io.PrintWriter.close(PrintWriter.java:339)
at org.omnifaces.servlet.HttpServletResponseOutputWrapper.close(HttpServletResponseOutputWrapper.java:149)
at org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:149)
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at pf.LoginFilter.doFilter(LoginFilter.java:168)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:459)
at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:316)
at com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:87)
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:722)

Now/today, I test as per suggestions mentioned in the following:

#651

and I get different results. Test result is basically the exception in server log that I copy pasted above, and now only 'one' message is sent successfully (before/after exception in server log, which was copy/pasted above).

On one of my last attempts, I added the following to web.xml:

    <init-param>
        <param-name>org.atmosphere.useNative</param-name>
        <param-value>true</param-value>
    </init-param>

per something mentioned in (maybe) the following discussion:

http://atmosphere-framework.2306103.n4.nabble.com/Push-data-appearing-in-the-responses-of-other-servlets-running-on-the-same-server-td4651309.html

So, my web.xml contains the following:

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<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>
</servlet>
<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>gzipResponseFilter</filter-name>
    <filter-class>org.omnifaces.filter.GzipResponseFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>gzipResponseFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

<filter>
    <filter-name>LoginFilter</filter-name>
    <filter-class>pf.LoginFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>LoginFilter</filter-name>
    <url-pattern>*.jsf</url-pattern>
</filter-mapping>

<filter>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

I have the following xhtml:

<p:growl id="pushedNotifications" for="pushNotifications" globalOnly="false"
         widgetVar="growl"
         life="30000" showDetail="true" showSummary="true" escape="false"/>
<p:socket onMessage="displayPushedMessage" widgetVar="socket"
          channel="/notifications/#{pf_usersController.userPushChannelId}" />

where pf_usersController.userPushChannelId = username or userID (one word, no blankspaces, no special characters, etc...)

I have the following in applicationScopeBean, which is responsible for pushing message to all users except user that initiated/pushing the message:

/*
 * do NOT send to the user 'session' that is pushing the notification
 */
public void pushNotification(String msg, Users userPushingMessage) {
    Boolean sendToUser;
    for (SessionInfo session : sessions) {
        sendToUser = true;
        if (session.getUser().getUserName().equals(userPushingMessage.getUserName()) &&
            session.getUser().getLastLoginDt().equals(userPushingMessage.getLastLoginDt())) {
            sendToUser = false;
        }
        if (sendToUser) {
            PushContext pushContext = PushContextFactory.getDefault().getPushContext();
            pushContext.push("/notifications/" + session.getPushChannelId(),
                             new FacesMessage(FacesMessage.SEVERITY_INFO, "", msg));
        }
    }
}

and I have the following in pf_usersController, which is responsible for users pushing messages/notifications to applicationScopeBean

public void addNotification(String msg) {
    // (p:poll) implementation that works, since PrimeFaces Push does not work
    //applicationScopeBean.addNotification(msg, user);
    // PrimeFaces Push
    applicationScopeBean.pushNotification(msg, user);
}

I think that's all of the code that I need to share here; if I missed anything or if you need me to share anything else, then please let me know.

I cannot express enough... PrimeFaces Push FacesMessage example is very impressive, and I really want this in my app, and maybe even other PrimeFaces Push (or Atmosphere) examples/use-cases. Since myself and other Glassfish users have 'not' had success with PrimeFaces Push, I had to develop my own FacesMessages/notifications implementation via p:poll, and that is working great and has been working great, but better to use Atmosphere (PrimeFaces Push) than p:poll!!! :)

@smithh032772

Below is an example of the JSON (facesmessage) which is the only thing I see in a browser before/after exception in server log (that I mentioned above):

{"data":{"summary":"","detail":"...","severity":"Info","rendered":false}}

This is the only thing I see in the brower, after a user pushes a message (via PrimeFaces Push). of course, this is unacceptable. I just duplicated the exception again (in the server log) and this behavior, so I could provide the JSON facesmessage (above), since I didn't have it earlier at my disposal (to copy/paste).

@smithh032772

@oleksiys

you mentioned the following in http://www.java.net/forum/topic/glassfish/glassfish/glassfish-3122-warning-grizzly0024-and-selectorfactory-atmosphere-and-primefaces-34#comment-826118

can you pls. try to set this system property in Glassfish:
|asadmin create-system-properties java.net.preferIPv4Stack=true|

if it doesn't help - can you pls. try to disable ipv6 support in Windows
and check if it makes any difference?

I added the system property to Glassfish 3.1.2.2 (build 5), but it did not make a difference. I did NOT disable ipv6 support on my windows server 2008(R2) development server.

Also, you stated the following:

Here is a patch for GF 3.1.2.2.
I'm still not understanding why Atmosphere is interrupting threads so aggressively, but there might be a reason.
We reworked the code a bit so when Atmosphere interrupts a thread - the InterruptedException will not be thrown in the code reported above.

I don't see a hyperlink which will allow me to download this patch.

I searched maven.org (URL below), I see updates out there, but honestly, I don't have any instructions about what I should download from there, so I didn't download anything there.

http://search.maven.org/#search%7Cga%7C3%7Cgrizzly

@smithh032772

WOW WOW WOW WOW WOW WOW WOW!

I just logged into java.net, downloaded the patch at the following:

http://www.java.net/forum/topic/glassfish/glassfish/glassfish-3122-warning-grizzly0024-and-selectorfactory-atmosphere-and-primefaces-34?force=957

restarted Glassfish server, and NOW PrimeFaces Push is still pushing ONE message (per application session) WITHOUT EXCEPTIONS in server log, and i am NOT experiencing the behavior that I mentioned before (NO MORE JSON messages taking over the JSF page)!!!!

I still have the following Glassfish system property:

java.net.preferIPv4Stack=true

I wonder if that is necessary. I will remove this property and see if PrimeFaces Push FacesMessage still working in my app...error-free.

NOW, I need to figure out why ONLY ONE message is being pushed.... hmmm...

@smithh032772

Prior to my last post, I removed the following from web.xml:

    <init-param>
        <param-name>org.atmosphere.useNative</param-name>
        <param-value>true</param-value>
    </init-param>

Few minutes ago, I just re-added it back to web.xml, and then I began to experience the unwanted behavior again (JSON messages in browser, and that is only thing displayed in the browser).

So, I'm going to remove that. PrimeFaces Push user guide does NOT include that (above) in web.xml code samples.

Still trying to figure out why only one message is being displayed. I also just corrected my xhtml to be as follows:

<p:growl id="pushedNotifications" widgetVar="growl"
         life="30000" showDetail="true" showSummary="true" escape="false"/>
<p:socket onMessage="displayPushedMessage" widgetVar="socket"
          channel="/notifications/#{pf_usersController.userPushChannelId}" />
@smithh032772

Maybe, I spoke too soon. After the changes above, I restarted Glassfish, and...

  1. the first message was JSON message in browser, no PrimeFaces UI web content at all (unwanted behavior that I communicated earlier)

  2. I hit F5 (refresh) to refresh browser, and then I saw PrimeFaces UI web page content; I did a few things in web app, and that user was able to push messages to the other user (that was on mobile device)

  3. I tried to do some things/actions via mobile device enduser, but messages did not get pushed to the other user (which is logged in on desktop/PC). This has nothing to do with device/platform; android phone with google chrome browser that is accessing the JSF/PrimeFaces web app, same app that is accessed by desktop/PC enduser (myself...testing).

  4. I logged in first via mobile device, and then logged in via PC; PC enduser messages were all sent, but mobile device enduser messages were not sent at all. :(

Hmmm.... I thought this was resolved, but I guess not. Will keep playing with settings/deploys/etc... would love to have this working as-is-demonstrated in PrimeFaces showcase.

@smithh032772

Okay, just duplicated what I mentioned in previous post. the exception in the server log is as follows:

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: PWC3990: getWriter() has already been called for this response
at org.apache.catalina.connector.Response.getOutputStream(Response.java:674)
at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:206)
at org.omnifaces.servlet.GzipHttpServletResponse$GzipThresholdOutputStream.createGzipOutputStreamIfNecessary(GzipHttpServletResponse.java:248)
at org.omnifaces.servlet.GzipHttpServletResponse$GzipThresholdOutputStream.write(GzipHttpServletResponse.java:184)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
at java.io.Writer.write(Writer.java:127)
at org.omnifaces.io.ResettableBufferedWriter.close(ResettableBufferedWriter.java:94)
at java.io.PrintWriter.close(PrintWriter.java:339)
at org.omnifaces.servlet.HttpServletResponseOutputWrapper.close(HttpServletResponseOutputWrapper.java:149)
at org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:149)
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at pf.LoginFilter.doFilter(LoginFilter.java:168)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:459)
at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:316)
at com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:87)
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:722)

@smithh032772

Okay, I removed OmniFaces GzipFilter from web.xml, and I duplicated same unacceptable behavior as mentioned in the last 2 or 3 comments above.

The following is exception in the server log:

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException
    at org.apache.catalina.connector.ResponseFacade.setBufferSize(ResponseFacade.java:275)
    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.setResponseBufferSize(ServletExternalContextImpl.java:586)
    at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.createResponseWriter(FaceletViewDeclarationLanguage.java:2250)
    at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1951)
    at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
    at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:199)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at pf.LoginFilter.doFilter(LoginFilter.java:168)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:459)
    at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:316)
    at com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:87)
    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:722)
@oleksiys

let's follow up on the GF forum for now (pls. attach the testcase there, so we can reproduce the problem)

@tricky10

This is also in 651 - and how it works on my glassfish - you can see the whole configuration and the result - also the firebug and javascript errors
http://www.youtube.com/watch?v=ORaIGk4e3w4&list=HL1352139175&feature=mh_lolz

@jfarcand
Owner

Please, use the mailing list as this has NOTHING to do with the current issue ;-). You forgot to add a dependencies, and that's why it fail. Make sure you have the following dependency defined

       <!-- This is ONLY required if you use Atmosphere's annotation. If you use atmosphere.xml, not required -->
        <dependency>
            <groupId>eu.infomas</groupId>
            <artifactId>annotation-detector</artifactId>
            <version>3.0.0</version>
        </dependency>
@smithh032772

Okay, I changed my web.xml a bit

<filter-mapping>
    <filter-name>AtmosphereFilter</filter-name>
    <!-- Any mapping -->
    <url-pattern>/primepush/*</url-pattern>
</filter-mapping>

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<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>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

and now I get the following:

SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFilter - AtmosphereServlet running as a Filter
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Auto detecting atmosphere handlers /WEB-INF/classes/
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Auto detecting WebSocketHandler in /WEB-INF/classes/
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Atmosphere is using async support: org.atmosphere.container.GlassFishWebSocketSupport running under container: GlassFish Server Open Source Edition 3.1.2.2 with WebSocket enabled.
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Installed Default AtmosphereInterceptor [Android Interceptor Support, SSE Interceptor Support, JSONP Interceptor Support]. Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults in your xml to disable them.
SEVERE: [main] WARN org.atmosphere.cpr.AtmosphereFramework - No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the HeaderBroadcasterCache.
SEVERE: [main] WARN org.atmosphere.cpr.AtmosphereFramework - Neither TrackMessageSizeInterceptor or TrackMessageSizeFilter are installed. atmosphere.js may receive glued and incomplete message.
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - HttpSession supported: false
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster
SEVERE: [main] INFO org.atmosphere.cpr.AtmosphereFramework - Atmosphere Framework 1.0.2 started.

@smithh032772

@jfarcand I reported here because this was the issue that I reported initially, and this was the issue I was having for the longest time until I recently changed my config a bit (as noted above). so, now I'm reporting my results here.

@smithh032772

@jfarcand the following says

I am not using atmosphere's annotation anywhere. I only use PrimeFaces Push code samples that is provided on PrimeFaces showcase and in user guide.

@smithh032772

Interesting, when I add following dependency

    <dependency>
        <groupId>eu.infomas</groupId>
        <artifactId>annotation-detector</artifactId>
        <version>3.0.0</version>
    </dependency>

atmosphere is no longer loaded, and no more atmosphere in server log.

@smithh032772

I removed SLF4J when server log said there are duplicate copies in classpath, and that's when atmosphere stopped loading.

I added SLF4J to classpath (again), and now I am getting the same errors as above about atmosphere.

@jfarcand
Owner

OK let's have the discussion on the mailing list for now....

@jfarcand jfarcand closed this
@Macadoshis

What's up with this issue ? Is it solved ? I'm still getting this error along with Glassfish 4.0 and latest atmosphere (2.1.3).
Still getting this error with or .

This error occurs randomly and rarely (~ 1 time out of 50), when refreshing my jsf page which includes the " (Primefaces Primepush). Serverpush works fine the most of the times.

Note that I'm behind Apache Httpd (proxy_ws_tunnel for websocket ws://mysite/primepush and classical proxy for http://mysite).

I activated CometSupport on HttpListener and even tried several "PushServlet" servlet settings in my web.xml file. Even this one you pointed out : http://forum.primefaces.org/viewtopic.php?f=10&t=25577&start=30#p85058

Why is this issue closed by the way @jfarcand ? Your discussion didn't seem to have fix nor even find a solution :o

Thanks.

@jfarcand
Owner

@Macadoshis This exception is expected and documented in Atmosphere. The application should still work, so just ignore it.

@Macadoshis

@jfarcand @smithh032772 The application indeed keep on working after this error occurs (randomly and very rarely as I said), but it affects the response and when it occurs the client gets a "500 Internal Error".
That would be quite unpleasant for my application which is about to run in production very soon.

Do you think I can catch it in JSF (Mojarra 2.2.6) with in faces-config.xml ?
Or is the stream of the response already commited and I have no hope of catching it and the client will get a "500 Internal Error" each time it occurs ? <-- if so, I'm afraid I don't share with you the same definition the word "working" :)

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.