留言板
p:ajax under p:selectBooleanCheckbox causes java.lang.ClassCastException
Eric Chow,修改在7 年前。
p:ajax under p:selectBooleanCheckbox causes java.lang.ClassCastException
Junior Member 帖子: 79 加入日期: 05-2-25 最近的帖子
Hello,
I am testing the Primefaces JSF portlet under Liferay 7.0.
It raises java.lang.ClassCastException when using p:ajax under p:selectBooleanCheckbox.
I am testing the portlet under:
I am testing the Primefaces JSF portlet under Liferay 7.0.
It raises java.lang.ClassCastException when using p:ajax under p:selectBooleanCheckbox.
I am testing the portlet under:
- Liferay Portal 7.0
- Primefaces-5.2
- and the attach images for the Liferay Faces Bridges that from the Liferay Faces Bridge snapshot repository
<p:selectbooleancheckbox id="course" value="#{myBean.course}" style="width: 10px">
<p:ajax listener="#{myBean.selectCourse}" update="@form" />
</p:selectbooleancheckbox>
@ManagedBean(name="myBean")
@ViewScoped
public class MyBean {
public void selectCourse() {
System.out.println("::Select course: " + valueHolder.circular.isCourse());
}
}
09:52:59,369 ERROR [http-nio-8080-exec-7][IPCPhaseListener:226] org.eclipse.equinox.http.servlet.internal.servlet.HttpServletRequestWrapperImpl cannot be cast to javax.portlet.PortletRequest
java.lang.ClassCastException: org.eclipse.equinox.http.servlet.internal.servlet.HttpServletRequestWrapperImpl cannot be cast to javax.portlet.PortletRequest
at com.liferay.faces.bridge.event.internal.IPCPhaseListener.processIncomingPublicRenderParameters(IPCPhaseListener.java:119)
at com.liferay.faces.bridge.event.internal.IPCPhaseListener.afterPhase(IPCPhaseListener.java:68)
at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:123)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletExceptionAdapter.service(ServletExceptionAdapter.java:68)
at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153)
at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:50)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:115)
at com.liferay.portal.osgi.web.wab.extender.internal.adapter.FilterExceptionAdapter.doFilter(FilterExceptionAdapter.java:46)
at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:121)
at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:45)
at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:71)
at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:103)
at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl.doDispatch(HttpServiceRuntimeImpl.java:372)
at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at com.liferay.portal.module.framework.ModuleFrameworkServletAdapter.service(ModuleFrameworkServletAdapter.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142)
at com.liferay.portal.security.sso.ntlm.internal.servlet.filter.NtlmPostFilter.processFilter(NtlmPostFilter.java:107)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142)
at com.liferay.portal.servlet.filters.uploadservletrequest.UploadServletRequestFilter.processFilter(UploadServletRequestFilter.java:93)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:47)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:142)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:260)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
at com.liferay.portal.servlet.filters.urlrewrite.UrlRewriteFilter.processFilter(UrlRewriteFilter.java:65)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:115)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Kyle Joseph Stiemann,修改在7 年前。
RE: p:ajax under p:selectBooleanCheckbox causes java.lang.ClassCastExceptio
Liferay Master 帖子: 760 加入日期: 13-1-14 最近的帖子
Hi Eric,
I cannot reproduce your issue with Primefaces 5.2 or 6.0. However, I am testing with a recent build of Liferay 7. Are you on Liferay 7 GA1? I'll try to test on Liferay 7 GA1 on Monday.
Also, some of the artifacts I'm testing with are newer than yours:
com.liferay.faces.alloy-3.0.0-20160524.222834-17.jar
com.liferay.faces.bridge.api-4.0.0-20160609.174647-9.jar
com.liferay.faces.bridge.ext-5.0.0-20160608.230612-6.jar
com.liferay.faces.bridge.impl-4.0.0-20160609.222642-34.jar
com.liferay.faces.util-3.0.0-20160524.212324-10.jar
commons-fileupload-1.3.1.jar
commons-io-2.2.jar
jsf-api-2.2.13.jar
jsf-impl-2.2.13.jar
primefaces-6.0.jar
- Kyle
I cannot reproduce your issue with Primefaces 5.2 or 6.0. However, I am testing with a recent build of Liferay 7. Are you on Liferay 7 GA1? I'll try to test on Liferay 7 GA1 on Monday.
Also, some of the artifacts I'm testing with are newer than yours:
com.liferay.faces.alloy-3.0.0-20160524.222834-17.jar
com.liferay.faces.bridge.api-4.0.0-20160609.174647-9.jar
com.liferay.faces.bridge.ext-5.0.0-20160608.230612-6.jar
com.liferay.faces.bridge.impl-4.0.0-20160609.222642-34.jar
com.liferay.faces.util-3.0.0-20160524.212324-10.jar
commons-fileupload-1.3.1.jar
commons-io-2.2.jar
jsf-api-2.2.13.jar
jsf-impl-2.2.13.jar
primefaces-6.0.jar
- Kyle
Eric Chow,修改在7 年前。
RE: p:ajax under p:selectBooleanCheckbox causes java.lang.ClassCastExceptio
Junior Member 帖子: 79 加入日期: 05-2-25 最近的帖子
Hi Kyle,
Thanks for your help.
I found that it is my mistake in the code. One of the property in the backing bean is NULL causing this exception. After I fixed it, no exception thrown.
Anyway, why it causes "ClassCastException" even there is some error in the code? Is there any problem about the "Request Wrapper" or they are not compatible ?
Best regards,
Eric
Thanks for your help.
I found that it is my mistake in the code. One of the property in the backing bean is NULL causing this exception. After I fixed it, no exception thrown.
Anyway, why it causes "ClassCastException" even there is some error in the code? Is there any problem about the "Request Wrapper" or they are not compatible ?
Best regards,
Eric
Kyle Joseph Stiemann,修改在7 年前。
RE: p:ajax under p:selectBooleanCheckbox causes java.lang.ClassCastExceptio
Liferay Master 帖子: 760 加入日期: 13-1-14 最近的帖子
Hmm, I'm not sure why a ClassCastException was thrown. There may be a bug in Liferay Faces or Liferay. If you have time, could you post the shortest code reproducing the problem? I'd like to look into it.
- Kyle
- Kyle
Eric Chow,修改在7 年前。
RE: p:ajax under p:selectBooleanCheckbox causes java.lang.ClassCastExceptio
Junior Member 帖子: 79 加入日期: 05-2-25 最近的帖子
Hi Kyle,
I found what causes the ClassCastException.
If I add the error-page in the web.xml as following, it will causes the Exception. It throws nothing if I removed the error-page from the web.xml.
Anyway, I upload the codes that I tested for you to have a look.
Please modify the build.properties for your environment or just copy the WAR into the deploy(Liferay 7GA1 ) folder for testing.
Thanks,
Eric
I found what causes the ClassCastException.
If I add the error-page in the web.xml as following, it will causes the Exception. It throws nothing if I removed the error-page from the web.xml.
Anyway, I upload the codes that I tested for you to have a look.
Please modify the build.properties for your environment or just copy the WAR into the deploy(Liferay 7GA1 ) folder for testing.
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error/error.xhtml</location>
</error-page>
Thanks,
Eric
Kyle Joseph Stiemann,修改在7 年前。
RE: p:ajax under p:selectBooleanCheckbox causes java.lang.ClassCastExceptio
Liferay Master 帖子: 760 加入日期: 13-1-14 最近的帖子
Hi Eric,
As Neil said on your other thread, <error-page> cannot be used in Liferay 7. I'd recommend following Neil's advice and using an ExceptionHandler to customize your portlet's error message.
As an alternative, you could use a hook to change the error page by overriding the portlet_error.jsp or overriding the "is-temporarily-unavailable" language property.
- Kyle
As Neil said on your other thread, <error-page> cannot be used in Liferay 7. I'd recommend following Neil's advice and using an ExceptionHandler to customize your portlet's error message.
As an alternative, you could use a hook to change the error page by overriding the portlet_error.jsp or overriding the "is-temporarily-unavailable" language property.
- Kyle