ServerPush add-on

I would recommend Servlet 3.0. To enable it you need to have your web.xml web-app definition set to 3.0 like so:


<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

Additionally, any servlet filters that sit in front of the Atmosphere servlet must have the
true
element. If you just want to use Tomcat’s Comet support then add


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

to the Atmosphere servlet’s definition.

Please find the attached application. This war file also contains the source file as well and all configuration files I used.

In tomcat 6.0.33 it works fine and detects it as comet application.

The same application does not work in tomcat 7.0.22 and gives following error

WARNING: failed using comet support: org.atmosphere.container.TomcatCometSupport, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.
If that’s not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar
Oct 5, 2011 3:08:39 PM org.atmosphere.cpr.AtmosphereServlet doCometSupport
WARNING: Using BlockingIOCometSupport.

Please see this also for more related issues
https://vaadin.com/forum/-/message_boards/view_message/795678
11956.war (11.6 MB)

I tried servlet 3.0 but got same result.

I dont have any filter for Atmosphere servlet so I use only useNative property to be true but makes no difference.

Hi Mark,
Did you get chance to look at it? I am kind of stuck because of this issue.

thanks
dheeraj

Yes, I looked at it. You have one, potentially two, problems. The first is that the context path in ServerPushApplication is incorrect. there is no /root context in tomcat by default. Your context.xml has the context path as “” which means the root context; however, since you are deploying as a WAR file that context path is overwritten by Tomcat. Since the name of the WAR is ServerPush.war the correct path is /SeverPush/foo/bar.

I’d highly recommend using the ServerPushApplicationServlet; it will eliminate these discrepancies. See https://github.com/markathomas/ServerPush/tree/master/samples for sample projects.

Also, I tested your WAR (after fixing the path) on both tomcat 7.0.22 and 7.0.21. Both worked fine.

Hi Mark,
I am still not able to run it successfully. One difference I see is following

I see the message
INFO: Atmosphere is using comet support: org.atmosphere.container.TomcatCometSupport running under container: Apache Tomcat/7.0.22

Instead of
INFO: Atmosphere is using comet support: org.atmosphere.container.Servlet30Support running under container: Apache Tomcat/7.0.22 using javax.servlet/3.0

Even though I have my web.xml schema pointing to 3.0 as following

And I have following property set in both Vaadin servlet and Atmosphere servlet
true

I dont have any servlet jar in WEB-INF/lib as well

Does it have to use Servlet30Support in order for me to fix this issue? And why is it not using Servlet30Support?

Comment out


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

as that init-param forces the use of the container’s Comet implementation.

Hmm it has become a nightmare for me. When I comment this property I get this error in Tomcat 7.0.22. Yes I do have web.xml using Sevlet 3.0 header

SEVERE: AtmosphereServlet exception
java.lang.IllegalStateException: Not supported.
at org.apache.catalina.connector.Request.startAsync(Request.java:1642)
at org.apache.catalina.connector.Request.startAsync(Request.java:1635)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
at org.atmosphere.container.Servlet30Support.suspend(Servlet30Support.java:137)
at org.atmosphere.container.Servlet30Support.service(Servlet30Support.java:91)
at org.atmosphere.cpr.AtmosphereServlet.doCometSupport(AtmosphereServlet.java:1156)
at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:1138)
at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:1124)

In web.xml…

<?xml version="1.0" encoding="UTF-8"?>

I am sorry for your troubles but I am unable to reproduce your issue. The ISE “Not supported” only occurs when either a servlet or servlet filter accessed as part of a request that calls startAsync() on the HTTP request is not marked as
true
. All standard Tomcat valves support async so the issue would not be there. I suggest you look at your tomcat config and make sure there is not something in your request path not supporting async. As an example, when I first wrote this add-on it worked perfectly on my machine but when I integrated it into my company’s build and pushed it to the test system it did not work with the exact error you have specified. I about pulled my teeth out trying to understand why. It turned out that a third-party library we were using in the app, Java Melody, had included a web-fragment.xml in the JAR’s META-INF/ directory which declared a non-aysnc servlet filter with the mapping of /*. We were already including this filter in our web.xml so it was completely redundant; however, we never noticed it until moving to tomcat 7 and using servlet 3.0. Review your JAR files in WEB-INF/lib and make sure there is nothing like this:


for JAR in WEB-INF/lib/*.jar; do
    if [ `unzip -l $JAR | grep -c web-fragment.xml` -gt 0 ]
; then
        echo "web-fragment.xml found in $JAR"
    fi
done

Also review the context.xml and server.xml in Tomcat’s conf dir.

First, thank you very much for writing this add-on. It is highly needed in several dynamic web applications and should be IMO part of the official vaadin release.
Well, it has already been proposed for vaadin 7 as I see on http://dev.vaadin.com/wiki/Vaadin7/Proposals/ServerPush

However, I have some stability problem with this add-on.

My web application consists of a button and a normal (lazy) table. When I press the button my program starts filling the table in the background. Since I want to present the results as fast as possible I decided to use ServerPush in order to update the table in the browser incrementally. Thereto I use the ServerPush servlet (org.vaadin.addons.serverpush.ServerPushApplicationServlet) so that I do not have to manually call push().
For adding rows to the table I use the normal addItem(content, id) method.

But almost always when I add more than 100 rows to the table the table (or the client-server communication or whatever) crashes. In this case the table does not react anymore on certain user actions. I cannot sort the rows by column anymore and the table does not load new rows anymore when I scroll down via mouse wheel.

Thus, the question is whether the table, the normal GWT communication or the atmosphere communication crashes? But how to find the cause for this problem?

BTW, when I reload the page the table works again normally.

Hello,

I am trying to use the ServerPush add on. I follow the steps in
this post
.
On the third step, I have to create a custom widgetset inheriting the org.vaadin.addons.serverpush.ServerPushWidgetset widgetset, but there is no matching class.The only one avalaible is org.vaadin.addons.serverpush.ServerPush.

How should I do ?

I am using ServerPush 1.06 and Vaadin 6.7.1. on RBD8

Thanks.

Hi and thanks for the awesome addon,

working great for me with JBoss 5 and IE8. Having issues with IE9 though.
Think it might be something that was fixed in atmosphere-gwt-client after 0.7.2: https://github.com/Atmosphere/atmosphere/commit/bd98caa8f3b722981f28b3e39d783694b97788ba

Is anyone else having similar issues?
Is there a plan to update to atmosphere-0.8.1?

Thanks again.

Hi,

You could try DontPush Ozonelayer (co-effort by me and Mark). I just updated it to support atmosphere 0.8.1 release.

cheers,
matti

Hallo
i need some help with the web.xml configuration for tomcat 6. With the example web.xml from the “web/” directory in the add-on archive it doesn’t work for tomcat6 but it works with tomcat7.

When i start the tomcat6 my vaadin application and the web.xml template i get the following error:

ERROR [http-8080-3]
org.atmosphere.cpr.AtmosphereServlet - AtmosphereServlet exception
java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:145)
at org.atmosphere.container.Jetty7CometSupport.service(Jetty7CometSupport.java:78)
at org.atmosphere.cpr.AtmosphereServlet.doCometSupport(AtmosphereServlet.java:1156)
at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:1138)
at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:1124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

Greetz,
Michel

I always get the following warning when I start my application in jetty:

Where can I set this timeout?

Hi Mark,
I know that you do not support this add-on anymore, but I am using it and I hope that you could help me.
I have two “small” issues.

  1. My web-application supports multi - tabs/windows. ServerPush works perfectly but when I close one tab/window, I receive a warn:

    “WARN [org.atmosphere.handler.AbstractReflectorAtmosphereHandler]
    (Atmosphere-AsyncWrite-0) Serializer exception: message: org.atmosphere.gwt.server.impl.Heartbeat@1c0e7b8: ClientAbortException: java.net.SocketException: Software caused connection abort: socket write error”.

    Is there any way to catch that warning or to update the servlet not to commuicate with that particular window/tab?

  2. When a window/tab opens I get this info:

    " INFO [org.vaadin.addons.serverpush.VaadinServerPushHandler]
    (http-localhost-127.0.0.1-8080-1) You have set an infinite timeout for your comet connection this is not recommended"
    .
    Should I worry about that?

My AS Server is JBoss.

Thank you in advance,
Spyros Kollias