Granite DS 2.2.0.GA + Atmosphere 0.6.3 in one webapp results in: Not in a valid Comet configuration (use an APR or NIO connector)

43 views
Skip to first unread message

rockhowse

unread,
Dec 8, 2010, 3:00:28 PM12/8/10
to Granite Data Services Forum
Environment:
Mac OS X 10.6
Tomcat 6.0.29
Atmosphere 0.6.3
GraniteDS 2.2.0.GA

Simple Explanation:

We can run the graniteds-chat example as a standalone webapp. Inside
Tomcat 6.0.29. To do this we needed to compile and configure the
native AJP connector. But when trying to run the exact same
configuration inside our current app that includes Atmosphere 0.6.3,
it gives us this exception on start up.

javax.servlet.ServletException: Not in a valid Comet configuration
(use an APR or NIO connector)
at
org.granite.gravity.tomcat.AbstractCometProcessor.service(AbstractCometProcessor.java:
179)
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.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:
88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)

We have tracked it down to the inclusion of the atmosphere 0.6.3 jars
in our WEB-INF/lib directory. If we remove the jars, the default
gravity implementation works fine. If we include them, we get the
error =( This can be replicated using the graniteds-chat application
and moving the following jars into the WEB-INF/lib directory of the
generated war:

atmosphere-compat-jbossweb-0.6.3.jar
atmosphere-compat-tomcat-0.6.3.jar
atmosphere-compat-weblogic-0.6.3.jar
atmosphere-runtime-0.6.3.jar

It's almost like Atmosphere is forcing the tomcat connector to not use
AJP for the entire webapp?

Detailed Explanation:

We have been Atmosphere 0.6.3 as our Comet implementation to push
Spring 3.0 created JSON to our HTML 5 and iOS based interfaces. We are
currently looking to use GraniteDS + gravity to implement similar
functionality against Flex Burrito (Android AIR apps) based mobile
interface.

What works:

1. AJP Compiled/configured correctly

Dec 8, 2010 1:28:43 PM
org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.20.
Dec 8, 2010 1:28:43 PM
org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept
filters [false], random [true].
Dec 8, 2010 1:28:43 PM
org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 8, 2010 1:28:43 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 648 ms

2. Example graniteds-chat example compiled and deployed and working
fine
3. Added the graniteds configuration to our existing web app

WEB-INF/flex/services-config.xml - no changes from the
graniteds-chat example project
WEB-INF/granite/granite-config.xml - no changes from the
graniteds-chat example project
WEB-INF/web.xml - added the listener/
servlet/servlet mapping from the graniteds-chat example

4. GraniteDS appears to start up correctly

2010-12-08 13:29:03,821 [main] INFO
org.granite.config.GraniteConfigListener - Initializing GraniteDS...
2010-12-08 13:29:04,068 [main] INFO
org.granite.jmx.GraniteMBeanInitializer - Registering MBean:
org.granite:type=GraniteConfig,context=PlayfieldDemo
2010-12-08 13:29:04,110 [main] INFO
org.granite.config.GraniteConfigListener - GraniteDS initialized
2010-12-08 13:29:04,110 [main] INFO
org.granite.config.GraniteConfigListener - GraniteDS initialized
2010-12-08 13:29:04,142 [main] INFO
org.granite.gravity.Gravity - Starting Gravity...
2010-12-08 13:29:04,145 [main] INFO
org.granite.gravity.GravityPool - Starting Gravity Pool
(corePoolSize=5, maximumPoolSize=20, keepAliveTimeMillis=10000,
queueCapacity=2147483647)...
2010-12-08 13:29:04,147 [main] INFO
org.granite.gravity.Gravity - Registering MBean:
org.granite:type=Gravity,context=/PlayfieldDemo
2010-12-08 13:29:04,155 [main] INFO
org.granite.gravity.Gravity - Gravity successfully started.

5. After checking the localhost.xx.log file we see the following
exception

SEVERE: Servlet.service() for servlet GravityServlet threw exception
javax.servlet.ServletException: Not in a valid Comet configuration
(use an APR or NIO connector)
at
org.granite.gravity.tomcat.AbstractCometProcessor.service(AbstractCometProcessor.java:
179)
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.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:
88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:
109)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:
83)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:
97)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:
100)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:
78)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:
54)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:
35)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:
177)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:
188)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:
105)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:
79)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:
149)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:
237)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:
167)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:
77)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:
113)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
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.Http11AprProcessor.process(Http11AprProcessor.java:
861)
at org.apache.coyote.http11.Http11AprProtocol
$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:
1584)
at java.lang.Thread.run(Thread.java:680)

Being fairly new to GraniteDS any assistance in integrating the two
would be highly appreciated. Thank you in advance!

-rOcK

Franck Wolff

unread,
Dec 9, 2010, 9:20:11 AM12/9/10
to gran...@googlegroups.com
Hi,

Try to remove the atmosphere-compat-tomcat-0.6.3.jar. There is maybe a class loader problem: if the GravityTomcatServlet class implements the CometProcessor interface from the compat jar and not the original one from Tomcat, it may be considered as standard servlet...

Franck.

2010/12/8 rockhowse <rock...@gmail.com>

rockhowse

unread,
Dec 9, 2010, 2:56:29 PM12/9/10
to Granite Data Services Forum
This was spot on Franck. I was going down this road anyways because
of this thread in the atmosphere mailing list:

http://atmosphere-users-mailling-list.2493822.n2.nabble.com/Can-t-get-NIO-working-with-chat-sample-app-in-Tomcat-6-td4577189.html

The changes I made were to add the atmosphere-tomcat-comat reference
from my maven pom file:

<!-- needed for Atmosphere Async Push -->
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>0.6.3</version>
<exclusions>
<!-- exclude this jar because we will be running on tomcat
using APR (native connector) -->
<exclusion>
<artifactId>atmosphere-compat-tomcat</artifactId>
<groupId>org.atmosphere</groupId>
</exclusion>
</exclusions>
</dependency>

And to comment out the section of my AtmopshereServlet in the web.xml
that forced blocking io since we are using the APR connector now:

<!-- Uncomment if you are using a WebServer that doesn't
support Comet or you want to use blocking I/O
we are going to be using the APR connector
<init-param>
<param-name>org.atmosphere.useBlocking</param-name>
<param-value>true</param-value>
</init-param>
-->

I hope this helps someone else out in getting Atmosphere 0.6.3 and
GraniteDS 2.2.0.GA both working in the same web application.

-rOcK

On Dec 9, 8:20 am, Franck Wolff <wo...@adequatesystems.com> wrote:
> Hi,
>
> Try to remove the atmosphere-compat-tomcat-0.6.3.jar. There is maybe a class
> loader problem: if the GravityTomcatServlet class implements the
> CometProcessor interface from the compat jar and not the original one from
> Tomcat, it may be considered as standard servlet...
>
> Franck.
>
> 2010/12/8 rockhowse <rockho...@gmail.com>
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages