Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Maxim B
Mixing plain JSF2 and Portlets on JBossPortal
27 de febrero de 2013 7:25
Respuesta

Maxim B

Ranking: New Member

Mensajes: 3

Fecha de incorporación: 19 de noviembre de 2012

Mensajes recientes

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  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 4<html
 5    xmlns="http://www.w3.org/1999/xhtml"
 6    xmlns:ui="http://java.sun.com/jsf/facelets"
 7    xmlns:c="http://java.sun.com/jsp/jstl/core"
 8    xmlns:h="http://java.sun.com/jsf/html"
 9    xmlns:f="http://java.sun.com/jsf/core"
10    xmlns:p="http://primefaces.org/ui">
11      
12    <h:head>
13    </h:head>
14   
15    <body>
16   
17        <a>Hello World<a/>
18
19
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(HeadRendererBridgeImpl.java:62)
4    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
5    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
6    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)


web.xml (the important stuff)
 1
 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>
 7   
 8  <servlet-mapping>
 9    <servlet-name>Faces Servlet</servlet-name>
10    <url-pattern>/faces/*</url-pattern>
11  </servlet-mapping>
12 
13   <servlet-mapping>
14    <servlet-name>Faces Servlet</servlet-name>
15    <url-pattern>/customfacelets/*</url-pattern>
16  </servlet-mapping>
17


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
28 de febrero de 2013 6:56
Respuesta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 2179

Fecha de incorporación: 26 de julio de 2005

Mensajes recientes

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: https://community.jboss.org/thread/203257