Foren

icefaces 2.0 portlet in liferay 5.2.3

Hasika Pamunuwa, geändert vor 13 Jahren.

icefaces 2.0 portlet in liferay 5.2.3

New Member Beiträge: 11 Beitrittsdatum: 21.06.10 Neueste Beiträge
I'm trying to upgrade from icefaces 1.8.2 to icefaces 2.0 in liferay 5.2.3.

Currently one of my portlets have the web.xml config with

<servlet>
		<servlet-name>testPortlet</servlet-name>
		<servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
		<init-param>
			<param-name>portlet-class</param-name>
			<param-value>com.icesoft.faces.webapp.http.portlet.MainPortlet</param-value>
		</init-param>
		<load-on-startup>0</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>testPortlet</servlet-name>
		<url-pattern>/testPortlet/*</url-pattern>
	</servlet-mapping>
      ....
    


So i have already changed my portlet.xml file to use org.portletfaces.bridge.GenericFacesPortlet and followed suggested changes.

However when i remove the above servlet mapping from the web.xml it fails to register portlet. I tried modifying the above config to

<servlet>
		<servlet-name>testPortlet</servlet-name>
		<servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
		<init-param>
			<param-name>portlet-class</param-name>
			<param-value>org.portletfaces.bridge.GenericFacesPortlet</param-value>
		</init-param>
		<load-on-startup>0</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>testPortlet</servlet-name>
		<url-pattern>/testPortlet/*</url-pattern>
	</servlet-mapping>
      ....
    


and then it complains The FacesServlet cannot have a url-pattern of /*. Please define a different url-pattern. Any suggestions to resolve this?
thumbnail
Neil Griffin, geändert vor 13 Jahren.

RE: icefaces 2.0 portlet in liferay 5.2.3

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Note that this same error message "Please define a different url-pattern" was reported here:

http://www.liferay.com/community/forums/-/message_boards/message/7549155

A colleague of mine happened to run into this very same error today. It was caused by the absence of a basic WEB-INF/faces-config.xml file in the portlet, like this:


<!--?xml version="1.0" encoding="UTF-8"?-->
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0">

</faces-config>


One might think that this file is optional with JSF 2.0, but apparently Mojarra has a dependency on the existence of this file for the FaceletViewHandlingStrategy to get instantiated properly.
thumbnail
Neil Griffin, geändert vor 13 Jahren.

RE: icefaces 2.0 portlet in liferay 5.2.3

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
I re-read your post, and I think it *might* be the case that you are modifying the web.xml that is contained in your deployed server, such as tomcat/webapps/foo-portlet/WEB-INF/web.xml

The best practice would be to re-build the portlet WAR, and then copy it to the Liferay /deploy folder and watch it hot-deploy. Liferay will massage the deployed web.xml accordingly and add the servlet and servlet-mapping entries so that it will register properly.

You should also delete the old tomcat/webapps/foo-portlet folder and restart before attempting to deploy the new WAR. Otherwise you might end up with JSF 1.2 and JSF 2.0 JARs in WEB-INF/lib
Hasika Pamunuwa, geändert vor 13 Jahren.

RE: icefaces 2.0 portlet in liferay 5.2.3

New Member Beiträge: 11 Beitrittsdatum: 21.06.10 Neueste Beiträge
Thanks Neil for the response.

However the faces-config.xml was consistent with what you had suggested and we were still getting the error.

Did some more debugging and found the cause for our case.

We were still using .jspx files and hoped that setting the javax.faces.DEFAULT_SUFFIX to .jspx would work. But even then it was still using the JspViewHandlingStrategy.

Seems like it's relying on javax.faces.FACELETS_VIEW_MAPPINGS context parameter now and had to set it to *.jspx
thumbnail
Neil Griffin, geändert vor 13 Jahren.

RE: icefaces 2.0 portlet in liferay 5.2.3

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
OK just to clarify, are you saying that adding the following to web.xml fixed the problem for you?

<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.jspx</param-value>
</context-param>
Hasika Pamunuwa, geändert vor 13 Jahren.

RE: icefaces 2.0 portlet in liferay 5.2.3

New Member Beiträge: 11 Beitrittsdatum: 21.06.10 Neueste Beiträge
yeah... this fixed our issue..