Getting ICEfaces to work with Spring Web Flow and Facelets on a WebSphere Portal Server
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
Getting ICEfaces to work with Spring Web Flow and Facelets on a WebSphere Portal Server  XML
Forum Index -> Portals & Portlets
Author Message
pbodsk

Joined: 17/08/2007 00:00:00
Messages: 8
Offline


Having spent quite some time getting ICEfaces working together with Facelets and Spring Web Flow on a WebSphere Portal server, I thought I'd share my results with you, hoping that this will make it easier for anybody else dumb enough to actually try combining these technologies on a WebSphere Portal :-)

Please note that this is not "The Official Guide", if you find any errors or things not necessary, please do not hesitate to post a message.

The versions I've used are:

ICEfaces version 1.7.1
Spring Web Flow 2.0.3
WebSphere Portal Server 6.0 (meaning JDK 1.4)

OK, let's get started. You'll need:

1) The following jars:
  • backport-util-concurrent.jar
  • cglib-nodep.jar
  • commons-beanutils.jar
  • commons-collections.jar
  • commons-digester.jar
  • commons-fileupload.jar
  • commons-logging.jar
  • el-api.jar
  • el-ri.jar
  • icefaces-comps.jar
  • icefaces-facelets.jar
  • jsf-api.jar (since we're running JDK 1.4, we're talking JSF version 1.1 here!)
  • jsf-impl.jar
  • jsf-portlet.jar (version 1.1.5)
  • ognl.jar (version 2.6.9)
  • org.springframework.binding.jar
  • org.springframework.faces.jar
  • org.springframework.js.jar
  • spring.jar (version 2.5.5)
  • spring-aop.jar
  • spring-beans.jar
  • spring-webmvc.jar
  • spring-webmvc-portlet.jar
  • xercesImpl.jar
  • xml-apis.jar

    (I'm not quite sure if you need all these jars, if you find some that can be left out, please post)

    2) A patched version of icefaces.jar
    You need to patch:

  • FacesContextFactoryImpl.java
  • SwfLifecycleExecutor.java
  • MainPortlet.java
  • Constants.java

    I've included the patched versions in the zip file attached to this post (folder 'Modified files from ICEfaces 1.7.1'). Search for '//peb patch start'.

    (And also, please see http://jira.icefaces.org/browse/ICE-3560)

    3) Lots of coffee/tea/whatever gets you through the day.
    4) Some soothing music. Could be Boards Of Canada, some old Depeche Mode, Audioslave, Tool or Mars Volta (I know...not that soothing :-))
    5) And of course a WebSphere Portal server :-) (IMPORTANT: Remember to set the classloader mode to PARENT_LAST on your WAR file, and WAR classloader policy to APPLICATION)

    I've attached the files used in the project as a zip file to this post (folder 'Files used in the project').

    The included files are:

  • web.xml (where the various servlets needed by ICEfaces and SWF are declared and various parameters are added)
  • portlet.xml (where the portlet itself is initialised)
  • faces-config.xml (nothing much going on here, just telling JSF to use the D2DFaceletViewHandler, and a Spring Bean variable resolver)

    If you take a closer look at portlet.xml you'll notice that I've added a init-param:

    Code:
     <init-param>
             <name>org.springframework.webflow.FlowId</name>
     	<value>welcome</value>
     </init-param>
     


    This is the name of the flow used when launching execution of a new flow.
    Normally, in a normal web app, this is read from the URL by SwfLifecycleExecutor like so:

    Code:
     flowId = firstSegment(servletRequest.getPathInfo());
     


    But this is portlets so...of course things can not be done with that easy :-)

    Therefore I've taken the liberty of adding this parameter to the portlet.xml file. The MainPortlet then reads this parameter and stores it as an attribute for the SwfLifecycleExecutor to retrieve when needed.
    This is probably not the best solution. If you have a better way of doing this, I would very much like to hear it.

    If you take a quick look at the top of web.xml you'll see that we've included the spring config file like so:

    Code:
     <!-- Location of master Spring config file -->
     	<context-param>
     		<param-name>contextConfigLocation</param-name>
     		<param-value>
     			/WEB-INF/config/springMasterConfig.xml
     		</param-value>
     	</context-param>
     


    This file is just a reference to a bunch of other files, where all the configuration is set up, hopefully you'll understand
    what's going on, othervise let me know, and I'll try to clarify. And also, if you find that any of these parameters are
    not needed, please post :-)

    Just at few more stops to make. I've included our view files and a flow file. I admit, it's not the most advanced of flow files,
    but it is nevertheless a flow, and more important, it's a working flow :-)

    Finally, I've added our ViewFlowHandler, referenced from springPortletConfig.xml.

    Well, that just about does it. I hope that this is of any use, and that you are able to get anything running from using these files. Once again,
    this is not "The Official Guide" to getting ICEfaces, Facelets and Spring Web Flow running on WebSphere Portal server. If you have any changes or comments, please post :-)

    Oh....and finally....good luck ;-)
     Filename ICEfacesPortletExample.zip [Disk] Download
     Description Example files
     Filesize 18 Kbytes
     Downloaded:  581 time(s)

  • ted.goddard

    Joined: 26/10/2004 00:00:00
    Messages: 684
    Offline


    This is excellent ... and a lot of work, thanks for providing this to the community. The next step is to look at which parts should be integrated into ICEfaces 1.8.
    [Email]
    kito99

    Joined: 30/01/2007 00:00:00
    Messages: 24
    Offline


    So.. is this going to be in ICEfaces 1.72 instead of 1.8?? That would be my preference :-).

    --
    Kito D. Mann -- Author, JavaServer Faces in Action
    http://twitter.com/kito99
    http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
    http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

    * Sign up for the JSF Central newsletter! http://oi.vresp.com/?fid=ac048d0e17 *

    ~~~
    Kito D. Mann - Author, JavaServer Faces in Action
    http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
    http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
    ted.goddard

    Joined: 26/10/2004 00:00:00
    Messages: 684
    Offline


    ICEfaces 1.7.2 is essentially complete (we're only making small fixes on top of the release candidate) but 1.8 will follow very quickly as it contains more significant changes developed in parallel.
    [Email]
    kito99

    Joined: 30/01/2007 00:00:00
    Messages: 24
    Offline


    ICEfaces 1.7.2 is essentially complete (we're only making small fixes on top of the release candidate) but 1.8 will follow very quickly as it contains more significant changes developed in parallel. 


    Ah, that's good to hear. Is the solution in this thread currently the best way to get ICEfaces to work in WebSphere Portal?

    --
    Kito D. Mann -- Author, JavaServer Faces in Action
    http://twitter.com/kito99
    http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
    http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

    * Sign up for the JSF Central newsletter! http://oi.vresp.com/?fid=ac048d0e17 *

    ~~~
    Kito D. Mann - Author, JavaServer Faces in Action
    http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
    http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
    pbodsk

    Joined: 17/08/2007 00:00:00
    Messages: 8
    Offline


    Is the solution in this thread currently the best way to get ICEfaces to work in WebSphere Portal?
     


    The solution posted here is for getting ICEfaces AND Spring Web Flow working together in WebSphere Portal Server. The patches described, mostly concerns getting the Spring Web Flow "integration" code in ICEfaces (more specific the SwfLifecycleExecutor class) to work in a portlet environment.

    So as I see it, the solution in this thread might be overkill (or perhaps not working at all) if you're "only" interested in getting ICEfaces working on a WebSphere Portal Server. Actually, I think you should be able to get ICEfaces running on a WebSphere Portal Server by just using the ICEfaces MainPortlet, but perhaps Ted Goddard can verify this?
    forever696


    Joined: 06/10/2008 00:00:00
    Messages: 4
    Offline


    Hi All,

    I would like some examples on how to integrate Spring MVC with Icefaces.
    Any help would be appreciated.
    Thanks in advance
    pbodsk

    Joined: 17/08/2007 00:00:00
    Messages: 8
    Offline


    I've just managed to patch (ruin? ;-) version 1.7.2 too. Patched classes and a description can be found at the previously created Jira issue

    http://jira.icefaces.org/browse/ICE-3560
    pbodsk

    Joined: 17/08/2007 00:00:00
    Messages: 8
    Offline


    Just out of curiosity, how are things going with integrating/including this patch in ICEfaces 1.8?
    simon.erhardt

    Joined: 15/01/2009 00:00:00
    Messages: 9
    Offline


    Hello,

    so can anyone describe how to get ICEfaces 1.7.2 get running on a WPS 6 (without facelets and swf)?
    It would be great to have a working web.xml, portlet.xml and a list of libraries that have to be included.

    Thanks!

    Simon
    jeremy.barth@gmail.com

    Joined: 06/08/2010 12:15:06
    Messages: 1
    Offline


    I was able to get this to run, but navigation doesn't seem to work. When you click the buttons 'nothing happens' meaning, no visible changes in the browser and no logs.
    erixb

    Joined: 28/07/2009 00:00:00
    Messages: 3
    Offline


    I´ve got a similar problem. When i start the portlet following exception occurs:
    [21.06.11 16:17:45:437 CEST] 00000028 lifecycle I JSF1027: [icefacesportlet.portlet.web] The ELResolvers for JSF were not registered with the JSP container.
    [21.06.11 16:17:47:858 CEST] 00000028 ServletWrappe E SRVE0068E: Es wurde eine Ausnahme angefangen, die in einer der Servicemethoden des Servlet icefacesportlet.portlet. ausgelöst wurde. Ausgelöste Ausnahme: java.lang.NullPointerException
    at com.ibm.wps.pe.pc.waspc.cache.FragmentCacheHelper.updateDynamicCacheScope(FragmentCacheHelper.java:208)
    at com.ibm.wps.pe.pc.waspc.core.impl.PortletServletCollaboratorImpl.doDispatch(PortletServletCollaboratorImpl.java:125)
    at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:74)
    at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.dispatch(PortletServlet.java:208)
    at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.service(PortletServlet.java:165)
    ........

    any Idea??
     
    Forum Index -> Portals & Portlets
    Go to:   
    Powered by JForum 2.1.7ice © JForum Team