掲示板

Problem with ajax requests on embedded JSF portlet.

9年前 に Mika Lindelä によって更新されました。

Problem with ajax requests on embedded JSF portlet.

New Member 投稿: 3 参加年月日: 14/07/31 最新の投稿
Hi,

I'm having a problem trying to get embedded JSF(Primefaces) portlets to work in Liferay. Using Liferay Portal 6.1.1-ce-ga2 and Primefaces 4.0. I've tried every solution I can think of and I'm out of options currently.

View.xhtml:

<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
	<h:head />
	<h:outputscript library="primefaces" name="jquery/jquery.js" />
	<h:outputscript library="primefaces" name="jquery/jquery-plugins.js" />
	<h:body>
	<h:form>
		<p:spinner value="#{mgdBean.spinnerValue}" min="0" max="100">
		<p:ajax partialSubmit="true" /></p:spinner>
	</h:form>
	</h:body>
</f:view>


Template:


<runtime-portlet name="Webcontent_Ajax_Testi_WAR_Webcontent_Ajax_Testi100SNAPSHOT" instance="a323" queryString="" />


Stack trace:

12:24:18,418 ERROR [http-bio-8080-exec-178][status_jsp:665] javax.portlet.faces.BridgeException: java.lang.NullPointerException
javax.portlet.faces.BridgeException: java.lang.NullPointerException
	at com.liferay.faces.bridge.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:128)
	at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:128)
	at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:178)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:118)
	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
	at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
	at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:531)
	at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:626)
	at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:436)
	at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:1075)
	at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:719)
	at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:249)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
	at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:176)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
	at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:560)
	at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:537)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
	at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:138)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:241)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:246)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
	at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:216)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
	at com.liferay.faces.bridge.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:74)
	... 132 more
thumbnail
9年前 に Vernon Singleton によって更新されました。

RE: Problem with ajax requests on embedded JSF portlet.

Expert 投稿: 315 参加年月日: 13/01/14 最新の投稿
Hi Mika,

Mika Lindelä:
I'm having a problem trying to get embedded JSF(Primefaces) portlets to work in Liferay. ...

By "embedded" could you be referring to "Runtime Portlets"?

I have never tried to create one myself, but here is a wiki entry by one of the gurus describing how to do this magic:
https://www.liferay.com/community/wiki/-/wiki/Main/Dynamically+adding+JSF+Portlets+to+Portal+Pages+%28Runtime+Portlets%29

Hope that helps,
Vernon
9年前 に Mika Lindelä によって更新されました。

RE: Problem with ajax requests on embedded JSF portlet.

New Member 投稿: 3 参加年月日: 14/07/31 最新の投稿
Hi Vernon,

Thanks for the link. Yes, I'm referring to runtime portlets. I've already created one succesfully but it didn't have ajax requests and therefore was ok. To add some more detail to my problem: debugging with Firebug indicates that all ajax request return http error 400, bad request.

If I try to access the request address I get an internal server error. The weird thing is that if I remove the web content resource instance from the end and access the address from browser I can see the response that I should be getting. (but of course I can't remove it from the ajax request itself)

NetworkError: 400 Bad Request - http://localhost:8080/web/guest/what-we-do?p_p_id=Webcontent_Ajax_Testi_WAR_Webcontent_Ajax_Testi100SNAPSHOT_INSTANCE_a323&amp;p_p_lifecycle=2&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_cacheability=cacheLevelPage&amp;p_p_col_id=&amp;p_p_col_count=0&amp;p_o_p_id=56_INSTANCE_fEY7OGtcf7fr&amp;_Webcontent_Ajax_Testi_WAR_Webcontent_Ajax_Testi100SNAPSHOT_INSTANCE_a323__jsfBridgeAjax=true&amp;_Webcontent_Ajax_Testi_WAR_Webcontent_Ajax_Testi100SNAPSHOT_INSTANCE_a323__facesViewIdResource=%2Fviews%2Fview.xhtml&amp;p_p_resource_id=56_INSTANCE_fEY7OGtcf7fr
thumbnail
9年前 に Neil Griffin によって更新されました。

RE: Problem with ajax requests on embedded JSF portlet.

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Hi Mika,

if I remove the web content resource instance from the end and access the address from browser I can see the response that I should be getting.


Can you provide more information by what you mean by "web content resource instance from the end"?

Also, what version of Liferay Faces are you using? The latest version (at the time of this writing) for Liferay Portal 6.1 would be 3.1.4-ga5.

The NullPointerException at Line 74 of BridgePhaseResourceImpl.java indicates that there is a p_p_resource_id request parameter being submitted, which should not be the case with a simple PrimeFaces Ajax request.

Kind Regards,

Neil
9年前 に Mika Lindelä によって更新されました。

RE: Problem with ajax requests on embedded JSF portlet.

New Member 投稿: 3 参加年月日: 14/07/31 最新の投稿
Hi Neil,

We are currently using the 3.1.4-ga5 version for development.

This is the ajax POST request made.


http://localhost:8080/web/guest/what-we-do?p_p_id=Webcontent_Ajax_Testi_WAR_Webcontent_Ajax_Testi100SNAPSHOT_INSTANCE_a323&amp;p_p_lifecycle=2&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_cacheability=cacheLevelPage&amp;p_p_col_id=&amp;p_p_col_count=0&amp;p_o_p_id=56_INSTANCE_fEY7OGtcf7fr&amp;_Webcontent_Ajax_Testi_WAR_Webcontent_Ajax_Testi100SNAPSHOT_INSTANCE_a323__jsfBridgeAjax=true&amp;_Webcontent_Ajax_Testi_WAR_Webcontent_Ajax_Testi100SNAPSHOT_INSTANCE_a323__facesViewIdResource=%2Fviews%2Fview.xhtml&amp;p_p_resource_id=56_INSTANCE_fEY7OGtcf7fr


If I enter it to the browser as is, I get an internal server error.

If I take out the very end of the request, "&p_p_resource_id=56_INSTANCE_fEY7OGtcf7fr", and enter the remainings to a browser, I get a server response to the request in xml form.

Hopefully this made more sense to what I wrote before.

Kind Regards,
Mika