Foren

Unable to set the response

thumbnail
Malek Tarboush, geändert vor 13 Jahren.

Unable to set the response

Junior Member Beiträge: 30 Beitrittsdatum: 19.09.10 Neueste Beiträge
Hello

I'm trying to run jsf 2 portlet in liferay 6.0.5 CE bundled with tomcat
it worked fine but after 2 deploy i dont know why it start throw this exception


The FacesServlet cannot have a url-pattern of /*. Please define a different url-pattern.


and in liferay log it is

ERROR [ExternalContextImpl:1040] Unable to set the response {0} for portletResponse=[com.liferay.portlet.RenderResponseImpl] because it i
s not a ResourceResponse.


but when i put the DebugPhaseListener class which exist in the portletfaces example
this exception is not throws and the jsf page rendered fine
just the part that i dont call managed bean !!
and also it throws exception in liferay log

java.lang.ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be cast to javax.servlet.http.Ht
        at com.sun.faces.util.OnOffResponseWrapper.<init>(OnOffResponseWrapper.java:58)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:94)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at BridgeImpl.java.doFacesRequest(BridgeImpl.java:299)
        at org.portletfaces.bridge.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:173)
        at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:119)
        at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
        at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</init>


i'm using portletfaces beta3 from svn
i used the beta2 and its the same

any idea about this problem ?

thankx
thumbnail
Neil Griffin, geändert vor 13 Jahren.

RE: Unable to set the response

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Malek, I looked for OnOffResponseWrapper.java in the Mojarra 2.0.4-b02 source tree but couldn't find it. What version of Mojarra are you using?
thumbnail
Malek Tarboush, geändert vor 13 Jahren.

RE: Unable to set the response

Junior Member Beiträge: 30 Beitrittsdatum: 19.09.10 Neueste Beiträge
Hi Neil

I'm using jsf 2.0.2 that came with netbeans 6.9.1 i think that why i have this exception

when i used 2.0.3 it didn't throw any exception
but when i click on any submit this message appear in tomcat console
ERROR [ExternalContextImpl:1040] Unable to set the response {0} 
for portletResponse=[com.liferay.portlet.RenderResponseImpl] because it is not a ResourceResponse

and the portlet works fine after refresh the page

but when i used jsf 2.0.4b2 that came with your portlet example everything works fine
without any exception
i checked out this class OnOffResponseWrapper.java its not exist in jsf 2.0.3 nor in jsf 2.0.4

Regards
thumbnail
Neil Griffin, geändert vor 13 Jahren.

RE: Unable to set the response

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
OK very glad to hear it is working with Mojarra 2.0.4b2
thumbnail
Neil Griffin, geändert vor 13 Jahren.

RE: Unable to set the response

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.