-
1. Re: RichFaces in WebSphere Portal: success with workarounds
alexsmirnov Feb 12, 2010 4:02 PM (in response to dkroot1)Can you please describe problems with bridge more detailed ? At least, bridge knows how to deal with scripts and styles in portal. -
2. Re: RichFaces in WebSphere Portal: success with workarounds
dkroot1 Feb 12, 2010 5:15 PM (in response to alexsmirnov)Sure. I was getting exceptions with both 1.0.0.CR3 and 2.0.0.CR1 releases of JBoss Portlet Bridge, so I was not able to have my portlet render anything. The RichFaces demo apps (portlet versions) die with Seam exceptions, but my app which is simpler is getting this (for 1.0.0.CR3):
Problem: An exception occurs with PARENT_LAST class loading:
java.lang.ClassCastException: org.jboss.portletbridge.BufferedRenderResponseWrapper incompatible with javax.servlet.ServletResponse at com.sun.facelets.FaceletViewHandler.createResponseWriter(FaceletViewHandler.java:370) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
-
3. Re: RichFaces in WebSphere Portal: success with workarounds
dkroot1 Mar 13, 2010 7:24 PM (in response to dkroot1)Update: I have also tried Apache MyFaces Bridge 1.0.0.beta2. The first problem with not rendering resources in <head> remains. The second problem with NullPointerException goes away, but instead I have a problem where Ajax updates via <a4j:commandButton> replace the body of the portlet page instead of a particular region. I have not spent too much time on solving it given that the first problem is not resolved. Perhaps, it could be resolved by playing with Ajax update regions. -
4. Re: RichFaces in WebSphere Portal: success with workarounds
gunners007 Nov 15, 2010 5:47 AM (in response to dkroot1)Hey,
I'm facing the same issue. My richfaces components arent rendering at all. You spoke about manually hardcoding the js source location.
Can you please given an example of how to do it?
Say I need to render the calender component which is referenced from "faces/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/calendar.js"
Thanks in advance!
<scriptlanguage="javascript" src='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/js/jasi.js") %>'></script> -
5. Re: RichFaces in WebSphere Portal: success with workarounds
dkroot1 Nov 17, 2010 4:44 PM (in response to gunners007)Theirry,
sure.
1. Have your page with calendar component deployed in a pure web app.
2. Render the page, look into HTML source
3. Copy <link> and <script> tags rendering RichFaces components from <head>.
4. Put them into your code after replacing server context path with ${facesContext.externalContext.requestContextPath} or similar construct.
In my cases, I ended up with the following snippet in my Facelet page template:
{code:xml}
<!-- === FIXME Workaround: RichFaces resource rendering in <head> hardcoded for Portlet === --><link class="component"href="${facesContext.externalContext.requestContextPath}/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAGbo7-tNnT5DGkAEXoDrg__"rel="stylesheet" type="text/css" /><link class="component"href="${facesContext.externalContext.requestContextPath}/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAGbo7-tNnT5DGkAEXoDrg__"media="rich-extended-skinning" rel="stylesheet" type="text/css" /><link class="component"href="${facesContext.externalContext.requestContextPath}/a4j/s/3_3_2.SR1/org/richfaces/skin.xcss/DATB/eAGbo7-tNnT5DGkAEXoDrg__"rel="stylesheet" type="text/css" /><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.PrototypeScript"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.AjaxScript"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/events.js"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/utils.js"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/json/json-dom.js"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/scriptaculous/effects.js"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/jquery/jquery.js"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/JQuerySpinBtn.js"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/calendar.js"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.ImageCacheScript"type="text/javascript"></script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/browser_info.js"type="text/javascript"></script><script src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1scripts/panelbar.js"type="text/javascript"></script><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON = true;</script><scriptsrc="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/skinning.js"type="text/javascript"></script><!-- === /Workaround === --><!-- === FIXME Workaround: RichFaces resource rendering in <head> hardcoded for Portlet === -->
<link class="component"
href="${facesContext.externalContext.requestContextPath}/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAGbo7-tNnT5DGkAEXoDrg__"
rel="stylesheet" type="text/css" />
<link class="component"
href="${facesContext.externalContext.requestContextPath}/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAGbo7-tNnT5DGkAEXoDrg__"
media="rich-extended-skinning" rel="stylesheet" type="text/css" />
<link class="component"
href="${facesContext.externalContext.requestContextPath}/a4j/s/3_3_2.SR1/org/richfaces/skin.xcss/DATB/eAGbo7-tNnT5DGkAEXoDrg__"
rel="stylesheet" type="text/css" />
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.PrototypeScript"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.AjaxScript"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/events.js"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/utils.js"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/json/json-dom.js"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/scriptaculous/effects.js"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/jquery/jquery.js"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/JQuerySpinBtn.js"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/calendar.js"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org.ajax4jsf.javascript.ImageCacheScript"
type="text/javascript"></script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/browser_info.js"
type="text/javascript"></script>
<script src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1scripts/panelbar.js"
type="text/javascript"></script>
<script type="text/javascript">
window.RICH_FACES_EXTENDED_SKINNING_ON = true;
</script>
<script
src="${facesContext.externalContext.requestContextPath}/a4j/g/3_3_2.SR1org/richfaces/renderkit/html/scripts/skinning.js"
type="text/javascript"></script>
<!-- === /Workaround === -->
{code}
I hope it helps.
-
6. Re: RichFaces in WebSphere Portal: success with workarounds
gunners007 Nov 18, 2010 2:42 AM (in response to dkroot1)Hey thanks a lot for your response.
After converting from web app to portal app my links look something like this ...
<link class="component" href="${facesContext.externalContext.requestContextPath}/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/calendar.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__" rel="stylesheet" type="text/css" />
This on portal gets generated as...
<link class="component" href=" /.JasiRichfacesOnWAS7/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/calendar.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__" rel="stylesheet" type="text/css" />
which it is again not able to resolve to
Pls do help!!!
It also tries to insert an icon for calender with this markup ... which also isnt resolved ...
<img alt="" class="rich-calendar-button " id="viewns_JasiRichfacesOnWAS7_default_:form1:calendar1PopupButton" style="vertical-align: middle" src="/.JasiRichfacesOnWAS7/faces/a4j/g/3_3_0.GAorg.richfaces.renderkit.html.iconimages.CalendarIcon/DATB/eAH7cW0fw6znAA8XBA4_" />
Thanks again in advance!
-
7. Re: RichFaces in WebSphere Portal: success with workarounds
dkroot1 Nov 18, 2010 1:37 PM (in response to gunners007)Make sure to configure your application properly. It's quite tricky. Here is my complete experience report. I hope it helps. I'm also attaching web.xml.
----------
1.1 Architecture
Phase 2 of RIA TPoC converted pure web application into a portlet using JSF portlet bridge approach that does not add portlet specifics into the code. This approach adds portlet bridge into the MVC layer. Four portlet bridge implementations were tried: IBM JWL Portlet Bridge 3.1.3, JBoss Portlet Bridge 1.0.0 Beta (CR3) and 2.0.0 Beta (CR1) and Apache MyFaces Bridge. MyFaces Bridge was tried on a branch, after Phase 3 and without performance testing. The best results but not a complete success were achieved with IBM Bridge and MyFaces Bridge.
1.1.1 EPT Environment
[skipped]
1.1.2 Local Development Environment
Local development environment switched to use WebSphere Portal that runs on top of WAS 7.0:
- Hardware / OS
- MacBook Pro under Windows XP Pro (BootCamp)
- Application Server
- WebSphere Portal 6.1.5
1.2 Tools
- IDE
- IBM Rational Application Developer (RAD) 7.5.5 – was not used for development. IBM JWL Portlet Bridge 3.1.3 was extracted from RAD 7.5.5.
1.3 Development Experience
It was a very challenging iteration. RichFaces had many issues when used in WSPortal portlets. RichFaces do not support WSPortal officially, and documentation about its use in WSPortal is next to non-existent as of this writing, e.g. only one blog post about a particular problem (http://random-thoughts-vortex.blogspot.com/2009/07/porting-richfaces-portlets-in-websphere.html) was found. Some problems required workarounds and permanent solutions are yet to be found. Exception stack traces listed below are abbreviated to the first 5 lines. Specific lessons learned include the following:
- Problem: An exception occurs with PARENT_LAST class loading, and JBoss Portlet Bridge 1.0.0.CR3:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.apache.xalan.processor.TransformerFactoryImpl incompatible with javax.xml.transform.TransformerFactory at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:214) at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:199) at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1663) at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:364)
Recommendation: Remove local xml-api*.jar - Problem: An exception occurs with PARENT_LAST class loading, and JBoss Portlet Bridge 1.0.0.CR3:
java.lang.ClassCastException: org.jboss.portletbridge.BufferedRenderResponseWrapper incompatible with javax.servlet.ServletResponse at com.sun.facelets.FaceletViewHandler.createResponseWriter(FaceletViewHandler.java:370) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
Recommendation: Replace portlet bridge - Problem: An exception occurs with PARENT_LAST class loading, and IBM Bridge 3.1.x or JBoss Portlet Bridge 1.0.0.CR3:
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.lifecycle.LifecycleFactory at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)
Recommendation: Switch to PARENT_FIRST for IBM Bridge. Deploy JSF implementation locally for JBoss Bridge. - Problem: An exception occurs with IBM Bridge 3.1.x and/or RichFaces not rendering images and other resources:
javax.faces.FacesException: Resources framework is not initialised, check web.xml for Filter configuration
at org.ajax4jsf.resource.ResourceBuilderImpl.getWebXml(ResourceBuilderImpl.java:116)
at org.ajax4jsf.resource.ResourceBuilderImpl.getUri(ResourceBuilderImpl.java:323)
at org.jboss.portletbridge.richfaces.PortalResourceBuilder.getUri(PortalResourceBuilder.java:29)
at org.ajax4jsf.resource.InternetResourceBase.getUri(InternetResourceBase.java:218)
Recommendation: Change web.xml as discussed in http://random-thoughts-vortex.blogspot.com/2009/07/porting-richfaces-portlets-in-websphere.html - Problem: RichFaces not rendering JavaScript and other resources in portlet <head>. Tested with PARENT_FIRST, IBM Bridge 3.1.x and MyFaces Bridge 1.0.0.beta2
Workaround:
Hardcode JavaScript source references (<script src=”…”>) that RichFaces render kit generates into the portlet page template. Sources have to be reverse-engineered by copying-and-pasting from HTML source generated by same page(s) deployed in a pure web application. See discussion at http://community.jboss.org/message/531840
6. Problem: An exception occurs with IBM Bridge 3.1.x and PARENT_FIRST class loading, on <a4j:commandButton>:
java.lang.NullPointerException at org.ajax4jsf.renderkit.AjaxRendererUtils.buildEventOptions(AjaxRendererUtils.java:267) at org.ajax4jsf.renderkit.AjaxRendererUtils.buildEventOptions(AjaxRendererUtils.java:251) at org.ajax4jsf.renderkit.AjaxRendererUtils.buildOnEvent(AjaxRendererUtils.java:220) at org.ajax4jsf.renderkit.AjaxRendererUtils.buildOnClick(AjaxRendererUtils.java:165)
Solution: Replace IBM Bridge with Apache MyFaces Bridge. See discussion at http://community.jboss.org/message/5318407. Problem: Ajax updates with Apache MyFaces Bridge submitted via <a4j:commandButton> replace the body of the page instead of a particular region
Workaround: No workaround found. See discussion at http://community.jboss.org/message/5318401.4 Developer Reference
1.4.1 Building and Deploying RIA TPoC, Release 2
[skipped]
1.4.2 Web Application configuration
- Dependencies. Two additional dependencies have been added in Release 2.0:
- <dependency org="javax.portlet" name="portlet-api" rev="2.0" conf="compile->default"/>
- Added jsf-portletbridge.jar (from IBM JWL 3.1.3) to WEB-INF/lib
2. web.xml configuration
See attached
-
web.xml 8.6 KB
- Hardware / OS
-
8. Re: RichFaces in WebSphere Portal: success with workarounds
vedat May 12, 2011 10:33 AM (in response to dkroot1)for resource loading, there is an interesting thing.
look at the preEncodeBegin function in HeaderResourcesRenderBase class in richfaces. this method commented out ! just oben this function and you will see all resources are loading. By this way all richfaces components are being loaded. But when i try to use any A4J action (e.g. a4j:commandButton), i get HTTP 400 . is there anyone who able to use ajax functions on ibm portal server ?
-
9. Re: RichFaces in WebSphere Portal: success with workarounds
dkroot1 May 14, 2011 5:11 PM (in response to vedat)My prototype used a limit number of a4j tags, namely <a4j:include> and <a4j:repeat>, but off top of my head there were issues with <a4j:commandButton>.