Foros de discusión

Mixing plain JSF2 and Portlets on JBossPortal

Maxim B, modificado hace 11 años.

Mixing plain JSF2 and Portlets on JBossPortal

New Member Mensajes: 3 Fecha de incorporación: 19/11/12 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

<!--?xml version="1.0" encoding="UTF-8" ?-->


      
	<h:head>
	</h:head>
	
	
	
		<a>Hello World</a><a></a>

 
 
 


Error Rendering View[/customfacelets/homepage.xhtml]
java.lang.ClassCastException: javax.faces.component.UIViewRoot cannot be cast to javax.portlet.faces.component.PortletNamingContainerUIViewRoot
	at com.liferay.faces.bridge.renderkit.html_basic.HeadRendererBridgeImpl.encodeBegin(HeadRendererBridgeImpl.java:62)
	at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)


web.xml (the important stuff)

	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  
   <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/customfacelets/*</url-pattern>
  </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.
thumbnail
Neil Griffin, modificado hace 11 años.

RE: Mixing plain JSF2 and Portlets on JBossPortal

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 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