I find it hugely frustrating that the Vaadin directory provides a pom download, but that pom doesn’t include what dependencies are actually required for the add-on to function.
Hi, Thomas. Thanks so much for this terrific add-on! I have a chat “sub-application” that appears to be working correctly when the context path is “/*” but I’m afraid I missing something when it comes to associating an alternative context path with the chat app so as to have multiple contexts handled by multiple applications. I would like to have the contexts like so:
main app at /main/*
chat app at /chat/*
I’m not using auto-push, so /main is a Navigator7 servlet, and /chat is a standard Vaadin servlet with listener-based “manual” push()es. I’ve tried what seems like every combination of context settings in atmosphere.xml, context.xml and web.xml. I’d be very grateful for any guidance from you or the group!
Can you tell me more about your app? Are you using multiple web contexts or are
/main/* and
/chat/* in the same context? and if so, what is that context? i’ll be happy to provide you the correct config if you can supply me this information. Here is an example assuming you are using manual push and the context path of your app is /foo.
You can copy the atmosphere.xml and web.xml from the zip file as templates. This will make the URL for push
/foo/server-push
Now use the constructor of ServerPush that accepts a String value, which is set as the context path. Since the context path of the web application is
/foo , call
new ServerPush(“/foo”)
Everything should work fine now
The important thing is to match the context path constructor param to the AtmosphereServlet’s servlet mapping url pattern (minus
/server-push ). Please note that this path is
independent of the Vaadin application path; thus, you can have
/chat/* point to the Vaadin app and
/push/server-push configured for the atmosphere servlet. Using this path the servlet mapping url pattern in web.xml for the AtmosphereServlet would be
/push/server-push , the
context-root attribute in atmosphere.xml would be the same, and you would instantiate the ServerPush widget using
new ServerPush(“/push”) .
Being able to specify the context path in the ServerPush constructor is powerful as you do not have to actually specify the exact context path. Here’s another example (assume context path is /web:
In
WEB-INF/web.xml :
So the URL mapping is really irrelevant as long as the config files match and you are using manual push. This cannot currently be done with automatic push as it always uses
/server-push as the path; however, if there is enough interest i can add that in.
Hope this helps you Elliot. Send me any questions you may have.
Henri, is there any way to view what is currently in the Vaadin Maven repo? Does Vaadin copy the dependencies into its own Maven repo or does it just copy the dependencies section of the pom.xml so the dependencies are retrieved from Maven central or any other configured repo?
Why would the content of the Vaadin repository matter ? If Vaadin and atmosphere are in the Maven Central repository (which they are), your POM should not include any repository directives (same goes for the usual common-* libraries and suchlike that your code directly depends on).
Also, your POM should likely mark Vaadin as optional – whoever includes your add-on should be responsible for deciding which version they want
This stems from my ignorance of Maven, which I do not use. I’m an Apache Ivy guy ;0) As this add-on stands right now, the user is free to pull-in whichever version of Vaadin they want as well as other libraries. I like that better as it is more flexible for developers. For those Ivy users, you can find this add-on in the
Ivy RoundUp repository.
Hi,
I am using this add on. It works fine on Tomcat 6.0.33 but gives the following error on Tomcat 7.0.22
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
O
What extra do I need to do to make it working on Tomcat 7
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
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.
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.
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?
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)
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.