Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Alireza Goli
primefaces Captcha doesn't work in liferay portlet
August 22, 2017 11:09 PM
Answer

Alireza Goli

Rank: New Member

Posts: 10

Join Date: July 24, 2017

Recent Posts

Hi,
<p:captcha> doesn't work in liferay 6.2 JSF portlet. When I click submit button, I get these errors:
  108:29:51,386 DEBUG [DebugPhaseListener:64] BEFORE phaseId=[RESTORE_VIEW 1] viewId=[null]
  208:29:51,404 DEBUG [DebugPhaseListener:48] AFTER phaseId=[RESTORE_VIEW 1] viewId=[/views/commentBox.xhtml]
  308:29:51,405 DEBUG [DebugPhaseListener:64] BEFORE phaseId=[APPLY_REQUEST_VALUES 2] viewId=[/views/commentBox.xhtml]
  408:29:51,410 DEBUG [DebugPhaseListener:48] AFTER phaseId=[APPLY_REQUEST_VALUES 2] viewId=[/views/commentBox.xhtml]
  508:29:51,410 DEBUG [DebugPhaseListener:64] BEFORE phaseId=[PROCESS_VALIDATIONS 3] viewId=[/views/commentBox.xhtml]
  608:29:51,413 DEBUG [DebugPhaseListener:48] AFTER phaseId=[PROCESS_VALIDATIONS 3] viewId=[/views/commentBox.xhtml]
  708:29:51,414 ERROR [ExceptionHandlerAjaxImpl:68] java.lang.ClassCastException: com.liferay.faces.bridge.filter.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest
  8javax.faces.FacesException: java.lang.ClassCastException: com.liferay.faces.bridge.filter.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest
  9    at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:84)
 10    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
 11    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
 12    at com.liferay.faces.bridge.internal.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:271)
 13    at com.liferay.faces.bridge.internal.BridgeImpl.doFacesRequest(BridgeImpl.java:157)
 14    at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:178)
 15    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:122)
 16    at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:82)
 17    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:116)
 18    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
 19    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
 20    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
 21    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
 22    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 23    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 24    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 25    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 26    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 27    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)
 28    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 29    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 30    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
 31    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
 32    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
 33    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
 34    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:580)
 35    at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:675)
 36    at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:441)
 37    at com.liferay.portlet.PortletContainerImpl._doServeResource(PortletContainerImpl.java:775)
 38    at com.liferay.portlet.PortletContainerImpl.serveResource(PortletContainerImpl.java:149)
 39    at com.liferay.portlet.SecurityPortletContainerWrapper.serveResource(SecurityPortletContainerWrapper.java:166)
 40    at com.liferay.portlet.RestrictPortletContainerWrapper.serveResource(RestrictPortletContainerWrapper.java:166)
 41    at com.liferay.portal.kernel.portlet.PortletContainerUtil.serveResource(PortletContainerUtil.java:164)
 42    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:394)
 43    at com.liferay.portal.action.LayoutAction.doExecute(LayoutAction.java:200)
 44    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:95)
 45    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 46    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
 47    at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:168)
 48    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 49    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
 50    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
 51    at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:557)
 52    at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:534)
 53    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
 54    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
 55    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 56    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 57    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 58    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 59    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 60    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
 61    at com.liferay.portal.servlet.filters.uploadservletrequest.UploadServletRequestFilter.processFilter(UploadServletRequestFilter.java:93)
 62    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
 63    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
 64    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
 65    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
 66    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:308)
 67    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
 68    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
 69    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
 70    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
 71    at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
 72    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
 73    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
 74    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
 75    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)
 76    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 77    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 78    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
 79    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
 80    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
 81    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
 82    at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:161)
 83    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
 84    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
 85    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 86    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 87    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 88    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 89    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
 90    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
 91    at com.liferay.portal.servlet.filters.uploadservletrequest.UploadServletRequestFilter.processFilter(UploadServletRequestFilter.java:93)
 92    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
 93    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
 94    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
 95    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
 96    at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
 97    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
 98    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
 99    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
100    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
101    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:308)
102    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
103    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
104    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
105    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
106    at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:254)
107    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
108    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
109    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
110    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
111    at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
112    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
113    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
114    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
115    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
116    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:268)
117    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
118    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
119    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
120    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
121    at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
122    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
123    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
124    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
125    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
126    at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
127    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
128    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
129    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
130    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
131    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:226)
132    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
133    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
134    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
135    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
136    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
137    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
138    at com.liferay.portal.servlet.filters.urlrewrite.UrlRewriteFilter.processFilter(UrlRewriteFilter.java:57)
139    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
140    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
141    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
142    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
143    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
144    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
145    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
146    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
147    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
148    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)
149    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
150    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
151    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
152    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
153    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
154    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
155    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
156    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
157    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
158    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
159    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
160    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
161    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
162    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
163    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
164    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
165    at java.lang.Thread.run(Thread.java:745)
166Caused by: javax.faces.FacesException: java.lang.ClassCastException: com.liferay.faces.bridge.filter.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest
167    at org.primefaces.component.captcha.Captcha.validateValue(Captcha.java:163)
168    at javax.faces.component.UIInput.validate(UIInput.java:982)
169    at javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
170    at javax.faces.component.UIInput.processValidators(UIInput.java:712)
171    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
172    at javax.faces.component.UIForm.processValidators(UIForm.java:253)
173    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
174    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
175    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
176    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
177    at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
178    at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
179    ... 156 more
180Caused by: java.lang.ClassCastException: com.liferay.faces.bridge.filter.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest
181    at org.primefaces.component.captcha.Captcha.createPostParameters(Captcha.java:193)
182    at org.primefaces.component.captcha.Captcha.validateValue(Captcha.java:152)
183    ... 167 more


Can anyone help me?
thanks,
Alireza
Neil Griffin
RE: primefaces Captcha does'nt work in liferay portlet
August 22, 2017 7:58 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2499

Join Date: July 26, 2005

Recent Posts

Hi Alireza,

What version of PrimeFaces are you using? I just looked at the source for Captcha.java in PrimeFaces 6.1 and I don't see any code in Captcha.validateValue(FacesContext,Object) that does a cast to HttpServletRequest.

If you are not using PrimeFaces 6.1, then please try upgrading and let us know if that fixes the problem for you.

Kind Regards,

Neil
Alireza Goli
RE: primefaces Captcha does'nt work in liferay portlet
August 22, 2017 11:12 PM
Answer

Alireza Goli

Rank: New Member

Posts: 10

Join Date: July 24, 2017

Recent Posts

Hi Neil,

Thank you so much. I solved my problem by upgrading to newer version of Primefaces.

Alireza
Neil Griffin
RE: primefaces Captcha does'nt work in liferay portlet
August 23, 2017 7:32 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2499

Join Date: July 26, 2005

Recent Posts

Hi Alireza,

You're welcome, and thanks for using Liferay Faces.

Neil