Make Atmosphere a JBoss 7.x module
bigsmall Oct 10, 2013 8:54 AMHi.
I'm trying to make Atmosphere a JBoss 7.x module. I want to use this framework to run Primefatses Push in my application.
I'm using JBoss 7.1.3 and Primefaces 4.0.
So:
1) I created Atmosphere module directory $JBOSS_HOME/modules\org\atmosphere\2.0\
2) Сopied Atmosphere jars into it:
- atmosphere-compat-tomcat-2.0.0.jar
- atmosphere-compat-tomcat7-2.0.0.jar
- atmosphere-compat-jbossweb-2.0.0.jar
- atmosphere-runtime-native-2.0.2.jar
3) Edited the Atmosphere module.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.atmosphere" slot="2.0">
<resources>
<resource-root path="atmosphere-compat-tomcat-2.0.0.jar"/>
<resource-root path="atmosphere-compat-tomcat7-2.0.0.jar"/>
<resource-root path="atmosphere-compat-jbossweb-2.0.0.jar"/>
<resource-root path="atmosphere-runtime-native-2.0.2.jar"/>
</resources>
<dependencies>
<module name="org.slf4j" export="true"/>
</dependencies>
</module>
4) Added Atmosphere dependence in Primefaces module.xml file:
<module xmlns="urn:jboss:module:1.1" name="org.primefaces" slot="4">
<resources>
<resource-root path="primefaces-4.0.jar"/>
</resources>
<dependencies>
<module name="javax.api" export="true"/>
<module name="org.atmosphere" slot="2.0" export="true"/>
<module name="javax.faces.api" />
<module name="org.apache.commons.fileupload" optional="true"/>
<module name="org.apache.commons.io" optional="true"/>
<module name="com.lowagie.itext" optional="true"/>
<module name="org.apache.poi" optional="true"/>
</dependencies>
</module>
5) Edited my JBoss configuration.xml:
I changed
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
to
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="true">
6) Added jboss-deployment-structure.xml in my application's war\WEB-INF:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.primefaces" slot="4" meta-inf="export">
<imports>
<include path="META-INF" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
7) Start JBoss and deploy my application. JBoss deploys my application without error:
12:02:50,845 INFO [org.atmosphere.cpr.DefaultAnnotationProcessor] (MSC service thread 1-8) AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$BytecodeBasedAnnotationProcessor being used
12:02:50,889 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Auto detecting atmosphere handlers /WEB-INF/classes/
12:02:50,891 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Auto detecting WebSocketHandler in /WEB-INF/classes/
12:02:50,892 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
12:02:50,898 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Installing Default AtmosphereInterceptor
12:02:50,899 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) org.atmosphere.interceptor.DefaultHeadersInterceptor : Default Response's Headers Interceptor
12:02:50,901 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) org.atmosphere.interceptor.PaddingAtmosphereInterceptor : Browser Padding Interceptor Support
12:02:50,902 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) org.atmosphere.interceptor.AndroidAtmosphereInterceptor : Android Interceptor Support
12:02:50,903 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) org.atmosphere.interceptor.SSEAtmosphereInterceptor : SSE Interceptor Support
12:02:50,905 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) org.atmosphere.interceptor.JSONPAtmosphereInterceptor : JSONP Interceptor Support
12:02:50,907 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) org.atmosphere.interceptor.JavaScriptProtocol : Atmosphere JavaScript Protocol
12:02:50,908 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) org.atmosphere.interceptor.OnDisconnectInterceptor : Browser disconnection detection
12:02:50,909 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults to disable them.
12:02:50,914 WARN [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache
12:02:50,917 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Broadcaster Polling Wait Time 100
12:02:50,917 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Shared ExecutorService supported: true
12:02:50,918 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) HttpSession supported: false
12:02:50,918 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
12:02:50,919 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
12:02:50,922 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster
12:02:50,923 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Atmosphere is using async support: org.atmosphere.container.JBossWebCometSupport running under container: JBoss Web/7.0.17.Final
12:02:50,924 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Atmosphere Framework 2.0.2 started.
12:02:50,927 INFO [org.atmosphere.cpr.AtmosphereServlet] (MSC service thread 1-8) AtmosphereServlet with native support for Tomcat 6/7 and JBossWeb Installed.
12:02:50,928 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Installed AtmosphereInterceptor Atmosphere LifeCycle with priority AFTER_DEFAULT
12:02:50,931 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Installed AtmosphereInterceptor Heartbeat Interceptor Support with priority AFTER_DEFAULT
12:02:50,933 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Installed AtmosphereInterceptor Track Message Size Interceptor using | with priority AFTER_DEFAULT
12:02:50,934 INFO [org.atmosphere.cpr.AtmosphereFramework] (MSC service thread 1-8) Installed AtmosphereInterceptor UUID Tracking Interceptor with priority AFTER_DEFAULT
8) But when I run my application, I get an error:
Make sure atmosphere-compat-jboss.jar is not under your WEB-INF/lib and You must use the atmosphere-native-runtime dependency in order to use native Comet Support
there is no context.xml under WEB-INF Is the NIO or APR Connector enabled?
12:05:32,595 ERROR [org.atmosphere.cpr.AtmosphereFramework] (http-127.0.0.1/127.0.0.1:8080-1) If you have more than one Connector enabled, make sure they both use the same protocol, e.g NIO/APR or HTTP for all. If not, org.atmosphere.container.BlockingIOCometSupport will be used and cannot be changed.
12:05:32,596 WARN [org.atmosphere.cpr.AtmosphereFramework] (http-127.0.0.1/127.0.0.1:8080-1) Using org.atmosphere.container.BlockingIOCometSupport
Atmosphere's support says the problem is that JBoss/Tomcat is unable to detect the org.apache.tomcat.comet.CometSupport class and so Atmosphere cannot use the native API.
In what could be the problem?
When I add Atmosphere jars in my application's war\WEB-INF\lib, everything deploys and runs without errors.