3 Replies Latest reply on Jan 11, 2016 6:21 PM by brett.williamson

    Issue with Richfaces 4.5.12.final and atmosphere dependency

    brett.williamson

      Hello,
      I am currently upgrading from richfaces 4.3 to Richfaces 4.5.12.final
      I am running it on Tomcat 7.0.54
      I've included the new Richfaces dependency as follows:

       

      <dependency>
      <groupId>org.richfaces</groupId>
      <artifactId>richfaces</artifactId>
      <version>4.5.12.Final</version>
      </dependency>

       

      But on start up I get the following exception:

       

      Caused by: java.lang.NoClassDefFoundError: org/atmosphere/cpr/AtmosphereServlet
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2957)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)

       

      I thought the atmosphere dependency should be automatically bought in by the richfaces dependency, but anyway
      I tried adding it manually as follows:

       

      <dependency>
      <groupId>org.atmosphere</groupId>
      <artifactId>atmosphere-runtime</artifactId>
      <version>2.4.1</version>
      </dependency>


      And now when I load a page with push component I get a new exception:

       

      36294 [http-bio-8010-exec-4] ERROR AsynchronousProcessor.action|No AtmosphereHandler found. Make sure you define it inside WEB-INF/atmosphere.xml or annotate using @___Service
      Jan 11, 2016 5:00:32 PM org.apache.catalina.core.StandardWrapperValve invoke
      SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/farmconnectPortal] threw exception
      org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler found. Make sure you define it inside WEB-INF/atmosphere.xml or annotate using @___Service
      at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:147)
      at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:115)
      at org.atmosphere.container.BlockingIOCometSupport.service(BlockingIOCometSupport.java:63)
      at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2285)
      at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:191)
      at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:177)
      at org.richfaces.webapp.PushFilter.doFilter(PushFilter.java:91)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)


      Thanks for any feedback/suggestions/help etc

      Brett

        • 1. Re: Issue with Richfaces 4.5.12.final and atmosphere dependency
          michpetrov

          Atmosphere is not included automatically, as described in the docs you need to add org.richfaces:richfaces-push-depchain; although that is just an alias for the atmosphere dependecy and the servlet should be registered automatically, I guess you can try setting it anyway.

          • 2. Re: Issue with Richfaces 4.5.12.final and atmosphere dependency
            brett.williamson

            Hi Michal, thanks for the reply.  I've switched to the dependency as suggested in the doc to:

              <dependency>
               <groupId>org.richfaces</groupId>
               <artifactId>richfaces-push-depchain</artifactId>
               <type>pom</type>
               <version>4.5.12.Final</version>
               <scope>runtime</scope>
              </dependency>

             

            Servlet api is 3.0 so I've tried just with this modification.  The following exceptions are thrown when
            loading a page with push component:

            java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) ~[catalina.jar:7.0.54]
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ~[catalina.jar:7.0.54]
            at org.atmosphere.util.IOUtils.loadClass(IOUtils.java:354) ~[atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.detectSupportedFramework(AtmosphereFramework.java:1583) [atmosphere-runtime-2.4.1.jar:2.4.1]

            AND

             

            80920 [http-bio-8010-exec-10] INFO  AtmosphereFramework.initWebSocket|Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
            80936 [http-bio-8010-exec-10] TRACE JSR356AsyncSupport.<init>|JSR356 Path mapping Size 5
            80936 [http-bio-8010-exec-10] ERROR IOUtils.guestRawServletPath|
            java.lang.IllegalStateException: Unable to configure jsr356 at that stage. No Servlet associated with PushFilter
            at org.atmosphere.util.IOUtils.guestRawServletPath(IOUtils.java:274) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.util.IOUtils.guestServletPath(IOUtils.java:248) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.container.JSR356AsyncSupport.<init>(JSR356AsyncSupport.java:63) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.container.JSR356AsyncSupport.<init>(JSR356AsyncSupport.java:40) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.7.0_60]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [na:1.7.0_60]
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [na:1.7.0_60]
            at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [na:1.7.0_60]
            at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:234) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolveWebSocket(DefaultAsyncSupportResolver.java:306) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolve(DefaultAsyncSupportResolver.java:292) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.autoDetectContainer(AtmosphereFramework.java:2080) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:914) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFrameworkInitializer.configureFramework(AtmosphereFrameworkInitializer.java:75) [atmosphere-runtime-2.4.1.jar:2.4.1]

            So, I've then modified web.xml as follows (from RF doc)

            <servlet>
                 <servlet-name>Push Servlet</servlet-name>
                 <servlet-class>org.richfaces.webapp.PushServlet</servlet-class>
                 <load-on-startup>1</load-on-startup>
                 <async-supported>true</async-supported>
            </servlet>
            <servlet-mapping>
                 <servlet-name>Push Servlet</servlet-name>
                 <url-pattern>/__richfaces_push</url-pattern>
            </servlet-mapping>
            <context-param>
                  <param-name>org.richfaces.push.handlerMapping</param-name>
                  <param-value>/__richfaces_push</param-value>
            </context-param>

            Which now causes the following exception on start up:

             

            5172 [localhost-startStop-1] INFO  AtmosphereFramework.autoDetectAtmosphereHandlers|Auto detecting atmosphere handlers /WEB-INF/classes/
            5188 [localhost-startStop-1] TRACE AtmosphereFramework.detectSupportedFramework|
            java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) ~[catalina.jar:7.0.54]
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ~[catalina.jar:7.0.54]
            at org.atmosphere.util.IOUtils.loadClass(IOUtils.java:354) ~[atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.detectSupportedFramework(AtmosphereFramework.java:1583) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.loadConfiguration(AtmosphereFramework.java:1560) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:909) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFrameworkInitializer.configureFramework(AtmosphereFrameworkInitializer.java:75) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:84) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:80) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.richfaces.webapp.PushServlet.init(PushServlet.java:67) [richfaces-core-4.5.12.Final.jar:4.5.12.Final]
            at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [catalina.jar:7.0.54]
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) [catalina.jar:7.0.54]
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) [catalina.jar:7.0.54]

            AND

             

            5235 [Thread-2] DEBUG AtmosphereFramework$5.run|Retrieving Atmosphere's latest version from http://async-io.org/version.html
            5235 [localhost-startStop-1] ERROR AtmosphereFramework.init|Failed to initialize Atmosphere Framework
            java.lang.ClassCastException: java.util.HashMap$KeySet cannot be cast to java.util.Iterator
            at org.richfaces.webapp.ServletConfigDefaultsFacade.getInitParameterNames(ServletConfigDefaultsFacade.java:76) ~[richfaces-core-4.5.12.Final.jar:4.5.12.Final]
            at org.atmosphere.cpr.AtmosphereFramework$4.getInitParameterNames(AtmosphereFramework.java:1002) ~[atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.info(AtmosphereFramework.java:1030) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:940) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereFrameworkInitializer.configureFramework(AtmosphereFrameworkInitializer.java:75) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:84) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:80) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75) [atmosphere-runtime-2.4.1.jar:2.4.1]
            at org.richfaces.webapp.PushServlet.init(PushServlet.java:67) [richfaces-core-4.5.12.Final.jar:4.5.12.Final]
            at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [catalina.jar:7.0.54]
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) [catalina.jar:7.0.54]

            I checked to see if somehow it might be working even with these startup exceptions but its not.

            Any ideas?  If no one else is having problems there must be something fundamentally wrong with my environment but I'm a bit stuck...
            Thanks alot
            Brett

            • 3. Re: Issue with Richfaces 4.5.12.final and atmosphere dependency
              brett.williamson

              Found the issue.  I still had the following declared in my web.xml from when I was dependent of RF 4.3:

                   <filter>
                      <filter-name>PushFilter</filter-name>
                      <filter-class>org.richfaces.webapp.PushFilter</filter-class>
                      <async-supported>true</async-supported>
                  </filter>
                  <filter-mapping>
                      <filter-name>PushFilter</filter-name>
                      <servlet-name>Faces Servlet</servlet-name>
                  </filter-mapping>
                    

              After removing this it works perfectly by just including the richfaces-push-depchain dependency (no servlet declaration required).

              Thanks again

              Brett