1 2 Previous Next 15 Replies Latest reply on Jul 5, 2011 5:14 PM by dixanms2

    Need to implement Richfaces 4.0 with JSF 2.0

    upen

      I need to migrate my app to use Richfaces 4.0 (currently using Richfaces 3.3.1 and JSF 1.2)

      This is a NON-Maven based project

      IDE: IBM RAD 7.5

      Websphere App Server: 7.0

      Class Loader is changed to Parent_Last.

      Replaced older jar files with below new jars in the project -> Classpath is updated -

      RF4JarStruct.JPG

       

      Getting below Errors when tried a plain JSF page -

       

      [4/27/11 16:07:55:162 IST] 00000024 servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0100E: Uncaught init() exception created by servlet Faces Servlet in application richfaces-startEAR: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

          at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)

          at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)

          at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)

          at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:165)

          at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:628)

          at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)

          at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)

          at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)

          at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)

          at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)

          at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)

          at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)

          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)

          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)

          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)

          at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

          at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

          at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

          at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

          at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

          at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)

          at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)

          at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)

          at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)

          at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

       

      [4/27/11 16:07:55:162 IST] 00000024 webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[Faces Servlet]: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

          at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)

          at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)

          at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)

          at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:165)

          at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:628)

          at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)

          at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)

          at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)

          at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)

          at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)

          at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)

          at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)

          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)

          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)

          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)

          at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

          at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

          at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

          at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

          at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

          at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)

          at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)

          at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)

          at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)

          at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

       

      Note: This is not a Maven based project and it needs to be worked out without Maven.

      As checked with many forums, they say that this should work by replacing the old jars with required ones.

       

      Am I missing something? Please comment.


        • 1. Need to implement Richfaces 4.0 with JSF 2.0
          upen

          The efforts put for this can be tracked on below thread in another forum -

          http://www.ibm.com/developerworks/forums/thread.jspa?threadID=361475

          • 2. Need to implement Richfaces 4.0 with JSF 2.0
            ppitonak

            Hi,

             

            does Websphere AS 7.0 support JSF 2? I suggest you to create a simple JSF 2.0 project and then add RichFaces to the project.

             

            Regards,

            Palo

            • 3. Need to implement Richfaces 4.0 with JSF 2.0
              upen

              Appreciate your response and time.

              Tried with a sample project built on JSF 1.2 jars with Richfaces 3.3.3.

              Replaced the old with new JSF 2.0 jars as shown in screen shot.

              JSF2.JPG

               

              This worked seemlessly on WAS7.0 with Class Loader set as Parent_Last.

              But, when added new RichFaces 4.0 related jars, it fails with previously mentioned error.

              Screen shot for reference.

              JSF2_RF4.JPG

              Please comment.

              • 4. Need to implement Richfaces 4.0 with JSF 2.0
                ilya_shaikovsky

                at first - have you removed richfaces filter definitions from web.xml? It's not required anymore. And your first exception seems were caused by the fact that has JSF 1.2 in classpath(present at first screenshot). Any changes (other log?) after changed libs to JSF 2?

                 

                P.S. there was great blog entry on such migration from one of the community guys across the threads but can't find for now. .if will found - will update you for sure.

                • 5. Re: Need to implement Richfaces 4.0 with JSF 2.0
                  upen

                  I tried earlier by removing the filter definition from web.xml; it didn't work. Now again tried. Still the main problem persists.

                   

                  Also, how can I restrict JSF 1.2 to not to come in classpath.

                   

                  No, with RF3.3.3 when I added JSF 2.0, I did not make any changes other than Class Loader to set Parent_Last as mentioned earlier. It worked fine.

                  When I added RF 4.0 jars without any other change, it did not work.

                   

                  If you have any blog for this kind of migration activity, please share.. That might help.

                  Dont you think, like the Maven based sample project, you should also publish a sample non-Maven based project... Just a thought.

                  • 6. Need to implement Richfaces 4.0 with JSF 2.0
                    upen

                    Anyone has any updates or comments over this?

                    • 7. Need to implement Richfaces 4.0 with JSF 2.0
                      ssamayoagt

                      I dont know if this still exists in WAS 7 but i n 6.x there is an option on the application's deployment to force the class loader to first look for classes in the application's modules then look in application's server jars.

                       

                      Regards.

                      • 8. Re: Need to implement Richfaces 4.0 with JSF 2.0
                        scottyg66

                        I'm new to Rich Faces but I'll give it a shot since I've been dealing with this issue for a couple days:

                         

                        First, you can get rid of the facelets jar file i think, facelets is included in JSF 2.0 by default

                         

                        Here is what I did to force JSF 2.1.1 to load with RAD 8.0/WAS7.

                         

                        In order to override a WAS JSF implementation in Websphere 7 for production follow this article: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/tweb_jsf.html

                         

                        In my development environment I had to do things a bit differently:

                        1. Add JSF 2.0 jars to WEB-INF/lib  - Ensure there are no other IBM jars in the lib folder....RAD likes to add them automatically for you sometimes depending on if you're playing with the "Project Facet" window.

                         

                        2. Change application.xml(on your EAR file) to PARENT_LAST class loading and WAR classloader policy to APPLICATION.

                         

                        You should see something similar in your log file

                         "config        I   Initializing Mojarra 2.1.1 (FCS 20110408) for context"
                        

                         

                        So I then went ahead and added the Rich Faces components and you should see in the log when you start up:

                         

                        [5/20/11 17:17:44:949 CDT] 0000000a Application   I org.richfaces.application.InitializationListener onStart RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0.Final SVN r.22269"
                        

                         

                        Here's what my list of jars looks like:

                        jar_list_jsf2richfaces4.gif

                         

                        Here's the interesting stuff from my web.xml

                         

                         <context-param>
                             <param-name>com.ibm.ws.jsf.JSF_IMPL_CHECK</param-name>
                             <param-value>true</param-value>
                         </context-param>
                            <context-param>
                                <param-name>javax.faces.CONFIG_FILES</param-name>
                                <param-value>/WEB-INF/faces-config.xml</param-value>
                            </context-param>
                        
                        
                            <context-param>
                                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                                <param-value>client</param-value>
                            </context-param>
                        
                        
                            <!-- Making the RichFaces skin spread to standard HTML controls -->
                            <context-param>
                                <param-name>org.richfaces.enableControlSkinning</param-name>
                                <param-value>true</param-value>
                            </context-param>
                            <context-param>
                                <param-name>org.richfaces.enableControlSkinningClasses</param-name>
                                <param-value>false</param-value>
                            </context-param>
                            <context-param>
                                <param-name>org.richfaces.LoadScriptStrategy</param-name>
                                <param-value>ALL</param-value>
                            </context-param>
                            <!-- Plugging the "Blue Sky" skin into the project -->
                            <context-param>
                                <param-name>org.richfaces.skin</param-name>
                                <param-value>blueSky</param-value>
                            </context-param>
                        ...
                            <servlet>
                                <display-name>FacesServlet</display-name>
                                <servlet-name>FacesServlet</servlet-name>
                                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                                <load-on-startup>1</load-on-startup>
                            </servlet>
                        
                            <servlet-mapping>
                                <servlet-name>FacesServlet</servlet-name>
                                <url-pattern>/*.faces</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                                <servlet-name>FacesServlet</servlet-name>
                                <url-pattern>*.faces</url-pattern>
                            </servlet-mapping>
                        

                         

                         

                        Hope this helps....

                         

                        Edit for some web.xml issues and pasted copy of jar files

                        • 9. Re: Need to implement Richfaces 4.0 with JSF 2.0
                          poljovka

                          Hi Gordon,

                          you wrote

                          2. Change application.xml(on your EAR file) to PARENT_LAST class loading and WAR classloader policy to APPLICATION.

                           

                           

                          Can you give here your application.xml  where you added PARENT_LAST and in WAR classloader?

                          I trying few days to implement JSF2.0 into WAS7, only how i get to work is to hardcore rewrite deployment.xml, but that it's not a job!!

                          • 10. Re: Need to implement Richfaces 4.0 with JSF 2.0
                            scottyg66

                            If your using RAD(I'm on 8.0 not sure if it makes a difference), you shoudl be able to open the application.xml with the "Deployment Descriptor Editor".  There is a "Deployment" tab.  On this tab there is an "Application" Section where you can setup your classloading policy.  What this really does is edit the deployment.xml file for you so you don't have to bother with manually editing deployment.xml and keeps all reference IDs in sync for you.

                             

                            applicationXML.gif

                            • 11. Re: Need to implement Richfaces 4.0 with JSF 2.0
                              poljovka

                              THX

                              works perfectly!!

                              • 12. Re: Need to implement Richfaces 4.0 with JSF 2.0
                                upen

                                Thanks for putting your thoughts.

                                As mentioned earlier, we need to make it work on WAS 7.0 in RAD 7.5.

                                As I said earlier, got the simple sample project working with JSF2.0 and RF3.3.3 on WAS7.0 and RAD7.5.

                                This is achieved by updating the Class Loader in EAR Deployment as below (as jsf2.0 is not supported on WAS7.0 by default) -

                                EAR Class Loader mode = Parent_First

                                WAR class loader policy = Module

                                WAR Class Loader mode= Parent_Last

                                 

                                When added RF4.0, tried different combinations for above mentioned configurations.. did not work.

                                Attached is the log file for server start up.

                                Below are the logs for reference when ran the application -

                                 

                                [6/7/11 17:06:23:695 IST] 00000020 servlet   E com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0100E: Uncaught init() exception created by servlet FacesServlet in application richfaces-startEAR: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

                                at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)

                                at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:165)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:628)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)

                                at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)

                                at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)

                                at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)

                                at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)

                                at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)

                                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)

                                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)

                                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)

                                at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

                                at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

                                at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

                                at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

                                at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

                                at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)

                                at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)

                                at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)

                                at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)

                                at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

                                 

                                [6/7/11 17:06:23:726 IST] 00000020 webapp    E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[FacesServlet]: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

                                at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)

                                at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:165)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:628)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)

                                at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)

                                at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)

                                at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)

                                at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)

                                at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)

                                at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)

                                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)

                                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)

                                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)

                                at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

                                at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

                                at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

                                at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

                                at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

                                at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)

                                at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)

                                at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)

                                at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)

                                at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

                                 

                                Please comment.

                                • 13. Re: Need to implement Richfaces 4.0 with JSF 2.0
                                  upen

                                  Hi Igor,

                                  Can you please confirm whether you got this working on with below setup -

                                       1) Non-Maven based project

                                       2) RAD 7.5

                                       3) WAS 7.0

                                   

                                  If YES, can you please share the working project (both project and the EAR, if possible).

                                  Also, let me know other config changes (like, class loader etc.) I need to do after IMPORTing the project in work space.

                                  • 14. Re: Need to implement Richfaces 4.0 with JSF 2.0
                                    scottyg66

                                    Are you certain you have JSF2.0 loading with RF3.3.3, since it works with JSF 1.2 as well(which is the WAS7.0 default implementation)).  Check the log file to be sure thats the JSF version loading in your 3.3.3 sample application.

                                     

                                    What does your web.xml look like?

                                     

                                    I ran into this when either

                                    - I had some conflicting  jsf jar file in my classpath

                                    - I did not set to PARENT_LAST and APPLICATION(like the screen shot in my post)

                                    1 2 Previous Next