I've used the xe:dialog in many apps before just fine, but am having problems with a new XPage workflow form that has several buttons which call xe:dialog prompts.
As I test this with several browsers, with different logins to simulate an initiator and approvers, the buttons works fine. Then after a while, clicking one of these same buttons causes "Unexpected runtime error: The runtime has encountered an unexpected error. java.lang.NullPointerException" -- from this point on, no user can click any of the buttons which use xe:dialog - they get the same error. It is so messed up on the server that I have to restart HTTP or the whole server to get them working again.
During the workflow, the app sends emails with a link back to the XPage. It seems like the problem occurs most frequently after the app has been opened with a link from an email (and the user has logged in).
So, some object is not being set properly. How can I identify which object is not set?
Here's the trace
11/21/14 8:28 AM: Exception Thrown
Context Path: /aaa.nsf
Page Name: /test.xsp
javax.faces.FacesException: java.lang.NullPointerException
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:865)
at com.ibm.xsp.extlib.component.dynamiccontent.UIDynamicControl.invokeOnComponent(UIDynamicControl.java:254)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.extlib.component.dialog.UIDialog.invokeOnComponent(UIDialog.java:543)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIDataPanelBase.invokeOnComponent(UIDataPanelBase.java:416)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIDataPanelBase.invokeOnComponent(UIDataPanelBase.java:416)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIDataPanelBase.invokeOnComponent(UIDataPanelBase.java:416)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIDataPanelBase.invokeOnComponent(UIDataPanelBase.java:416)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIDataPanelBase.invokeOnComponent(UIDataPanelBase.java:416)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIDataPanelBase.invokeOnComponent(UIDataPanelBase.java:416)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIViewRootEx.invokeOnComponent(UIViewRootEx.java:1552)
at com.ibm.xsp.component.UIViewRootEx._invokePartialRefresh(UIViewRootEx.java:1323)
at com.ibm.xsp.component.UIViewRootEx2._invokePartialRefresh(UIViewRootEx2.java:132)
at com.ibm.xsp.component.UIViewRootEx._renderView(UIViewRootEx.java:1309)
at com.ibm.xsp.component.UIViewRootEx.renderView(UIViewRootEx.java:1255)
at com.ibm.xsp.application.ViewHandlerExImpl.doRender(ViewHandlerExImpl.java:651)
at com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:321)
at com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:336)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
at com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:270)
at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:224)
at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Caused by: java.lang.NullPointerException
at com.ibm.xsp.extlib.component.dynamiccontent.AbstractDynamicContent.createContent(AbstractDynamicContent.java:134)
at com.ibm.xsp.extlib.component.dialog.UIDialog$PopupContent.encodeBegin(UIDialog.java:224)
at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:842)
at com.ibm.xsp.component.UIViewRootEx$1.invokeContextCallback(UIViewRootEx.java:1326)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:862)
... 46 more
I wonder if the dialogbox is sitting inside a panel then in some conditions is not being rendered. Remember you can't open something that doesn't exist. Since you've used dialog boxes before and it looks like you're using dynamicContent... that we be my first guess as to the problem.
This has been a tough one to troubleshoot because of the intermittent nature of the errors and vague error message text. I do not have a definitive answer, but it now appears to be working consistently without error after making two changes - so, I am documenting them so that it may possibly help point someone else towards a solution if they are getting NullPointerException related to xe:dialog.
First, I narrowed the error to occurring ONLY after opening the web app from a link sent in a notification email from the app: the link url included "&action=openDocument" but needed to have "&action=editDocument" because the dialog has editable fields.
The second change was that the app had been getting data from a database that the user did not have ACL rights to access by using sessionAsSigner. I've changed the ACL to allow the user access and changed the code from using sessionAsSigner to session.
Related
I've set up my web application to protect against CSRF by listing individual pages in faces-config, protected-views.
This works well when running locally, but after deploying to the server I eventually get these errors when opening a page link:
javax.faces.application.ProtectedViewException: JSF1099: Referer [sic] header value http://[redacted]/finance/commitmentregister/search.xhtml?javax.faces.Token=1534344211116 does not appear to be a protected view. Preventing display of viewId /finance/commitmentregister/view.xhtml
at com.sun.faces.lifecycle.RestoreViewPhase.maybeTakeProtectedViewAction(Unknown Source)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(Unknown Source)
at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(Unknown Source)
at com.sun.faces.lifecycle.LifecycleImpl.execute(Unknown Source)
We are running Apache Tomcat 7 locally and on the test server.
Edit:
I've noticed that the url generated on the link looks like this:
http://.../page.xhtml?token=123&p=4
Where token is the CSRF javax.faces.Token and p is a url parameter sent.
The error message shows the url with the token but without p. Like it's expecting the url with the token to be the protected page url listed in the faces-config.
That is, faces-config has:
<protected-views>
<url-pattern>/page.xhtml</url-pattern>
</protected-views>
But it is expecting page.xhtml?token=123
Further Edit:
We just noticed that this error happens only when the page is opened in a new tab. With links generated with a target="_blank" attribute. Copying the url into the clipboard and pasting it in a new tab address bar loads the page correctly.
Noticing that it only broke on new tabs gave me more info to research the problem.
Adding this to the links fixes it:
rel="noopener noreferrer"
I am using Richfaces 3.3.1 and MyFaces 1.2.
I required to add File Upload in my JSF form.
I made a simple JSF form in which there was only one tag that is rich:fileupload, it was running properly and i added Listener too and the file was getting saved on the path I added.
But, as soon as I try to add some other tag in the page I get an exception which I could not figure out.
java.lang.NullPointerException
at javax.faces.webapp._ErrorPageWriter.writeVariables(_ErrorPageWriter.java:329)
at javax.faces.webapp._ErrorPageWriter.writeVariables(_ErrorPageWriter.java:305)
at javax.faces.webapp._ErrorPageWriter.debugHtml(_ErrorPageWriter.java:187)
at javax.faces.webapp._ErrorPageWriter.handleThrowable(_ErrorPageWriter.java:494)
at javax.faces.webapp._ErrorPageWriter.handleException(_ErrorPageWriter.java:479)
at javax.faces.webapp.FacesServlet.handleLifecycleException(FacesServlet.java:294)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:192)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:347)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)
This is caused by a bug in MyFaces error handler itself.
Somewhere in your code an exception occurred. MyFaces was trying to render a "nice" error page with some debug information and all about that exception. However, during rendering of that "nice" error page, it bugged with a NullPointerException and hence it couldn't finish the job to inform you about that exception. All detail about that underlying exception is apparently completely lost.
This is indeed not helpful. You could for now disable the MyFaces "nice" error page by adding the below entry to webapp's web.xml as per MyFaces documentation:
<context-param>
<param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
<param-value>false</param-value>
</context-param>
This should present you the server default error page with the detail about the actual exception, so that you can finally investigate and fix it the usual way.
You can also try upgrading MyFaces 1.2 to latest 1.2.x available, which is currently 1.2.12, and see if the bug in its error handling is solved over there.
I created a liferay plugin portlet project and deployed in Liferay 6.2. When i try to deploy, i am getting " Portlet Portlet_WAR_portletID has a null portlet bag" error. I am not able to find the root as i could see i am referring correct plugin project.
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at com.liferay.portlet.PortletContextFactory._create(PortletContextFactory.java:84)
at com.liferay.portlet.PortletContextFactory.create(PortletContextFactory.java:40)
at com.liferay.portlet.PortletConfigFactoryImpl.create(PortletConfigFactoryImpl.java:56)
at com.liferay.portlet.PortletConfigFactoryUtil.create(PortletConfigFactoryUtil.java:32)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:606)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
at com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:655)
at com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:138)
at com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141)
at com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)
at com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:120)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer.access$4(PortletRenderer.java:107)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:174)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:1)
at com.liferay.portal.kernel.executor.CopyThreadLocalCallable.call(CopyThreadLocalCallable.java:69)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593)
at java.lang.Thread.run(Unknown Source)
Redeploy your portlet again. I faced same issue. I stop server and then clean my portlet then I started my server. When I checked in browser then I got internal server and in console "
portlet contains a null bag". I deployed again and the it is coming perfectly.
The most common solution for this problem is that just undeploy the portlet from the tomcat and redeploy it.
I've been using RichFaces 4 with Tomcat 7. There are no errors when Cleaning and Building the app (NetBeans). When the app is deployed, everything works fine but from time to time the following exception is thrown and I don't know where or what could be the error:
This is the Stack Trace of Tomcat's catalina.log
may 07, 2012 3:36:43 PM com.sun.faces.application.resource.ResourceHandlerImpl logMissingResource
WARNING: JSF1064: Unable to find or serve resource, jquery.js.
may 07, 2012 3:36:43 PM com.sun.faces.application.resource.ResourceHandlerImpl logMissingResource
WARNING:
ClientAbortException: java.io.IOException
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:373)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:437)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:351)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:396)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:385)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:93)
at java.nio.channels.Channels$WritableByteChannelImpl.write(Channels.java:458)
at com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:283)
at org.richfaces.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:257)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:591)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
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:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1824)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.IOException
at org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer(InternalAprOutputBuffer.java:205)
at org.apache.coyote.http11.InternalAprOutputBuffer.access$100(InternalAprOutputBuffer.java:37)
at org.apache.coyote.http11.InternalAprOutputBuffer$SocketOutputBuffer.doWrite(InternalAprOutputBuffer.java:235)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:119)
at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192)
at org.apache.coyote.Response.doWrite(Response.java:533)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:368)
... 25 more
Can someone give me some ideas on where to or how to stop this warning/exception from showing? Why is it getting thrown?
Cheers,
ClientAbortException
The client has aborted the resource request, because the enduser navigated away in all hurry while the page was still loading. Or because the enduser pressed Esc while the page was still loading. Or because the network cable was cut by enduser's 5 year old son with a scissor while the page was still loading. Or because the PC caught fire by a lightning strike while the page was still loading. Etcetera.
It's not predictable nor avoidable. Just ignore them. Hide them if necessary from the logs by logger configuration.
We have an application which uses JSF2 and Spring. The application works fine when deployed. But this happens if I went through the following steps:
Open the login page of the application.
Redeployed the application on the server.
Tried to login using the previously opened login page, and it shows the following exception:
javax.servlet.ServletException: null source
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
root cause
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:38)
at javax.faces.event.SystemEvent.<init>(SystemEvent.java:67)
at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69)
at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69)
at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
If I click on the first login page and then enter the login details the application does not break. This only occurs if I try to use the previously loaded login page with the newly deployed application.
Anyone knows the answer?
This one should have been thrown as a ViewExpiredException. It's a bug which started to manifest in Mojarra 2.0.3 and is been fixed in Mojarra 2.1.0. See also issue 1762 (note that Mojarra 2.1.0 doesn't work on Tomcat/Jetty, use at least Mojarra 2.1.1 then).
Basically, when Mojarra fails to build or restore the view, then it usually throws a specific enough exception, but due to this bug, a valid view was incorrectly been expected later in the code which in turn results in IllegalArgumentException: null source. The possible real cause would have been that the view contains a simple XML syntax error, such as a missing tag or broken attribute value, for which Mojarra would usually have thrown a FaceletException with a very detailed message with line number and position and such.
To prevent the ViewExpiredException, you would have to refresh the page by a GET request before doing any actions on it. If you're using a Mojarra version where this bug does not manifest (e.g. 2.0.2 or older, or 2.1.0 or newer), then you could gracefully handle it with an <error-page> in web.xml on the particular exception and provide a custom error page wherein the enduser is informed that the session has been expired, along with a link to the initial request URI.
This looks like http://java.net/jira/browse/JAVASERVERFACES-1758
which is not fixed in Mojarra 2.1.x
As long as javax.faces.PARTIAL_STATE_SAVING is set to false you'll receive that java.lang.IllegalArgumentException. If you set javax.faces.PARTIAL_STATE_SAVING to true (and you know what you are doing) you will get the "good old" javax.faces.application.ViewExpiredException back.
In my case turned out i had missing end tag in xhtml file for one of the jstl calls. i was using choose tag and one of the when tags in between choose did not have an end tag