Liferay portlet won't be shown

时间:2015-06-15 15:05:12

标签: jsf primefaces liferay portlet

I already postet my Question in the Liferayforum, but without any Answer. https://www.liferay.com/de/community/forums/-/message_boards/message/55035046

I'm developing some Portlets with JSF Primefaces. But sometimes the Portlets wont be shown and there is only empty space. This happens just sometimes, without any reproducible reasons. Any Idea for this Issue?

Following Log:

14:41:41,416 ERROR [RuntimePageImpl-9][render_portlet_jsp:132] null
java.lang.NullPointerException
    at org.primefaces.component.chart.renderer.PieRenderer.encodeData(PieRenderer.java:34)
    at org.primefaces.component.chart.renderer.BasePlotRenderer.render(BasePlotRenderer.java:29)
    at org.primefaces.component.chart.ChartRenderer.encodeScript(ChartRenderer.java:98)
    at org.primefaces.component.chart.ChartRenderer.encodeEnd(ChartRenderer.java:67)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:881)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:439)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
    at com.liferay.faces.bridge.application.ViewHandlerCompatImpl.renderView(ViewHandlerCompatImpl.java:52)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:227)
    at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:85)
    at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:112)
    at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:255)
    at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)

For Those Reasons, are there any Error-Handling methods? If my Portlet will throw an exception, I just wan't to show a self-defined Error-Message or something.

Thanks

1 个答案:

答案 0 :(得分:2)

实际上你必须找到NPE的来源。如果你已经找到NPE的来源,你可以包装一个try / catch并使用

SessionErrors.add(actionRequest, "error-key");

添加错误的方法。要显示它,你可以将它添加到你的jsp:

<liferay-ui:error key="error-key" message="this-is-error-message-1" />