Combination View Flat View Tree View
Threads [ Previous | Next ]
Maxim B
Mixing plain JSF2 and Portlets on JBossPortal
February 27, 2013 7:25 AM

Maxim B

Rank: New Member

Posts: 3

Join Date: November 19, 2012

Recent Posts

Hi, im using Liferay Faces Bridge on JBoss Portal (and not Liferay). However i encounter the following problem.

Portlets are working without issues and Exceptions however when im trying to access a facelets file by using the context-root it doesnt work:

Accessing the xhtml via http://localhost/MyAppWebRoot/faces/customfacelets/homepage.xhtml

Interestingly if i just write plain text "hello world" it works, however i need Facelets emoticon

 1<?xml version="1.0" encoding="UTF-8" ?>
 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 3  "">
 5    xmlns=""
 6    xmlns:ui=""
 7    xmlns:c=""
 8    xmlns:h=""
 9    xmlns:f=""
10    xmlns:p="">
12    <h:head>
13    </h:head>
15    <body>
17        <a>Hello World<a/>
20 </body>
21 </html>

1Error Rendering View[/customfacelets/homepage.xhtml]
2java.lang.ClassCastException: javax.faces.component.UIViewRoot cannot be cast to javax.portlet.faces.component.PortletNamingContainerUIViewRoot
3    at com.liferay.faces.bridge.renderkit.html_basic.HeadRendererBridgeImpl.encodeBegin(
4    at javax.faces.component.UIComponentBase.encodeBegin(
5    at javax.faces.component.UIComponent.encodeAll(
6    at javax.faces.component.UIComponent.encodeAll(

web.xml (the important stuff)
 2    <servlet>
 3        <servlet-name>Faces Servlet</servlet-name>
 4        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
 5        <load-on-startup>1</load-on-startup>
 6    </servlet>
 8  <servlet-mapping>
 9    <servlet-name>Faces Servlet</servlet-name>
10    <url-pattern>/faces/*</url-pattern>
11  </servlet-mapping>
13   <servlet-mapping>
14    <servlet-name>Faces Servlet</servlet-name>
15    <url-pattern>/customfacelets/*</url-pattern>
16  </servlet-mapping>

Any ideas? Is it possible to disable Liferay Faces Bridge completely when using the context-root and not the Portlets/Portal.
Thank you for help.
Neil Griffin
RE: Mixing plain JSF2 and Portlets on JBossPortal
February 28, 2013 6:56 AM

Neil Griffin


Rank: Liferay Legend

Posts: 2503

Join Date: July 26, 2005

Recent Posts

This might be more of an issue with using Liferay Faces Bridge with JBoss AS, rather than JBoss Portal. For example, this looks like an error message that could happen with Liferay Portal + JBoss AS as well.

Since JBoss AS is a Java EE compliant application server, JBoss is required to bundle a JSF API and Implementation in the global classpath. JBoss AS bundles Mojarra rather than MyFaces. The ClassCastException makes me think that the version of the JSF API that ships with JBoss AS is not compatible with the version of JSF that Liferay Faces Bridge compiles against. I would recommend upgrading JBoss AS to Mojarra 2.1.19. Here are some instructions for doing that posted by Stan Silvert of JBoss: