Bug in Liferay's form functionality makes impossible to create forms with more than 28 items - liferay

There is a bug in the Liferay's forms functionality (I'm using Liferay CE 7.4.32) that makes impossible to have forms with more than 28 items.
The form only reaches 28 questions before being unable to save new items and triggering the error, as if there was some limit to the number of items that could be added to the form. I also created a completely new form and got the same error when the form reached the same state as the original one:
2022-09-05 11:31:24.685 ERROR [http-nio-8080-exec-1][PortletServlet:117] null
javax.portlet.PortletException: java.lang.IllegalStateException: The property "serializedFormContext" is required
at com.liferay.portal.kernel.portlet.bridges.mvc.BaseTransactionalMVCActionCommand.processAction(BaseTransactionalMVCActionCommand.java:58) ~[portal-kernel.jar:?]
at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:402) ~[portal-kernel.jar:?]
at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:82) ~[portal-kernel.jar:?]
at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:256) ~[portal-kernel.jar:?]
at com.liferay.portlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:77) ~[portal-impl.jar:?]
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:50) ~[portal-kernel.jar:?]
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:113) ~[portal-kernel.jar:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[servlet-api.jar:4.0.FR]
at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153) ~[?:?]
at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:62) ~[?:?]
at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:120) ~[?:?]
at org.eclipse.equinox.http.servlet.internal.servlet.RequestDispatcherAdaptor.include(RequestDispatcherAdaptor.java:48) ~[?:?]
....
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_301]
Caused by: java.lang.IllegalStateException: The property "serializedFormContext" is required
at com.liferay.dynamic.data.mapping.form.builder.internal.context.DDMFormContextToDDMForm.deserialize(DDMFormContextToDDMForm.java:77) ~[?:?]
at com.liferay.dynamic.data.mapping.form.builder.internal.context.DDMFormContextToDDMForm.deserialize(DDMFormContextToDDMForm.java:59) ~[?:?]
at com.liferay.dynamic.data.mapping.form.web.internal.portlet.action.helper.SaveFormInstanceMVCCommandHelper._getDDMForm(SaveFormInstanceMVCCommandHelper.java:222) ~[bundleFile:?]
at com.liferay.dynamic.data.mapping.form.web.internal.portlet.action.helper.SaveFormInstanceMVCCommandHelper._updateFormInstance(SaveFormInstanceMVCCommandHelper.java:340) ~[bundleFile:?]
at com.liferay.dynamic.data.mapping.form.web.internal.portlet.action.helper.SaveFormInstanceMVCCommandHelper.saveFormInstance(SaveFormInstanceMVCCommandHelper.java:125) ~[bundleFile:?]
at com.liferay.dynamic.data.mapping.form.web.internal.portlet.action.SaveFormInstanceMVCActionCommand.doService(SaveFormInstanceMVCActionCommand.java:57) ~[bundleFile:?]
at com.liferay.dynamic.data.mapping.form.web.internal.portlet.action.SaveFormInstanceMVCActionCommand.doTransactionalCommand(SaveFormInstanceMVCActionCommand.java:84) ~[bundleFile:?]
at com.liferay.portal.kernel.portlet.bridges.mvc.BaseTransactionalMVCActionCommand$1.call(BaseTransactionalMVCActionCommand.java:44) ~[portal-kernel.jar:?]
at com.liferay.portal.kernel.portlet.bridges.mvc.BaseTransactionalMVCActionCommand$1.call(BaseTransactionalMVCActionCommand.java:40) ~[portal-kernel.jar:?]
at com.liferay.portal.spring.transaction.BaseTransactionExecutor.execute(BaseTransactionExecutor.java:37) ~[portal-impl.jar:?]
at com.liferay.portal.spring.transaction.TransactionInvokerImpl.invoke(TransactionInvokerImpl.java:39) ~[portal-impl.jar:?]
at com.liferay.portal.kernel.transaction.TransactionInvokerUtil.invoke(TransactionInvokerUtil.java:28) ~[portal-kernel.jar:?]
When the form reaches this "maximum", if you keep adding questions to the form, the next time you try to save it, Liferay automatically redirects you to the listing of available forms and all your work is lost.
Does someone know a fix or a workaround for this issue? Any help would be much appreciated.

Leaving this here just in case it is useful for someone in the future.
As indicated by Olaf, there is an Liferay issue open about this problem: https://issues.liferay.com/browse/LPS-156559
In this ticket, there is a workaround mentioned, which is changing the property com.liferay.portal.kernel.upload.FileItem.threshold.size=8048576
I confirm that I tested the workaround and it worked for me

Related

Problems using the XSP Starter Kit

I followed the instructions to install the XSP Starter kit from openntf. Everything mentioned in the video I was able to do but I am not able to activate it.
When I activate the plugin in my application and try to open it I get an Error 500. Anybody any idea?
The server console tells me:
https://www.dropbox.com/s/w2a0nlmjj5prnxs/Error%20OSGI.jpg?dl=0
The log file contains:
<extendedDataElements name="CommonBaseEventLogRecord:Exception" type="string">
<values>java.lang.RuntimeException: com.ibm.xsp.FacesExceptionEx: javax.faces.FacesException: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:461)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.initModule(NSFComponentModule.java:498)
at com.ibm.domino.xsp.module.nsf.NSFService.createNSFModule(NSFService.java:752)
at com.ibm.domino.xsp.module.nsf.NSFService.loadModule(NSFService.java:735)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:588)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:350)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:306)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.j</values>
<values>ava:272)
Caused by: com.ibm.xsp.FacesExceptionEx: javax.faces.FacesException: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:89)
at com.ibm.xsp.config.BootStrap.init(BootStrap.java:82)
at com.ibm.xsp.config.ConfigureCoreListener.contextInitialized(ConfigureCoreListener.java:39)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:453)
... 8 more
Caused by: javax.faces.FacesException: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:417)
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:81)
... 11 more
Caused by: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at java.lang.J9VMInternals.newInstan</values>
<values>ceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1549)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:926)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:965)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:489)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:410)
... 12 more
</values>
</extendedDataElements>
There is a component that was available in the starter kit for org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer. It's hitting an error trying to create that component. It's not a component designed to be used in a particular way, it's really there to show what needs to be created for a component - org.openntf.xsp.starter.AbstractHtmlTag is the component, html.xsp-config in META-INF defines the properties available to Domino Designer, html-faces-config adds the component to the server and defines which Java class to use for the component and which one for the renderer (to display the HTML). org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer handles printing content to the browser.
I've not used the starter kit as is, but I did use it as a basis for my session at ICON UK http://www.slideshare.net/paulswithers1/from-xpages-hero-to-osgi-guru-taking-the-scary-out-of-building-extension-libraries-icon-uk-2014

Servlet exception stream closed jsp

I am getting a servlet Exception "Stream closed" !!. I am not able to identify which jsp page is the problematic one or which line has the issue. It's showing the pagedefinition page as well as included pages.
As it is not easy to show all the pages attaching as a zip file : InGoogleDocs
The structure is like
pageDef.jsp Contains : allThings.jsp design.jsp myFile.jsp
The exception I got is as follows:
javax.servlet.jsp.JspException: ServletException in
'/layout/global/allThings.jsp': ServletException in
'/layout/body/design.jsp': ServletException in
'/layout/sub/design.jsp': ServletException in
'/module/air/myFile.jsp': Stream closed
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:920)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:460)
at org.apache.jsp.pagedef.air.pageDef_jsp._jspx_meth_tiles_insert_0(pageDef_jsp.java:1693)
at org.apache.jsp.pagedef.air.pageDef_jsp._jspService(pageDef_jsp.java:146)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:270)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:302)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:163)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
Important Note:
I am not getting this exception all the time.
when I go to the page (sometimes i will get the exception). If not getting , if I click back button in the jsp and coming back to the page will make the exception.
This problem is solved.
The problem was in a JSTL custom tag library's for-loop !!
How I solved(debugging JSP):
I made different copies of problematic file and included each of them in definition JSP.
Each of those problematic JSP files are edited in different areas as follows. If we do so, the error will be in only one/some JSP and so it is easy to find out the exception.
Say:
problematic-ORIGINAL.jsp
<jsp:for...></jsp>
<c:...>..</c>
...
problematic-1.jsp
<c:...>..</c>
problematic-2.jsp
<jsp:for...></jsp>
problematic-3.jsp
...
And then include 1,2 and 3 in definition JSP. Thus I could find the prob was in 2nd one. Enjoy coding ..

playorm connects only to localhost

If I try
cassandra-cli -h myhost.compute-1.amazonaws.com
I connect to it with no problems. By using astyanax, it also works.
However, in playOrm, if I set my host string to myhost.compute-1.amazonaws.com:9160, it complains I need to use a comma separated string with the host list. If I use myhost.compute-1.amazonaws.com:9160, or myhost.compute-1.amazonaws.com:9160,myhost.compute-1.amazonaws.com:9160, I get the following exception.
How should I set the connection string to connect to a remote host?
java.lang.RuntimeException: com.netflix.astyanax.connectionpool.exceptions.TokenRangeOfflineException: TokenRangeOfflineException: [host=myhost.compute-1.amazonaws.com(...):9160, latency=336(336), attempts=1] UnavailableException()
at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.execute(CursorKeysToRows.java:157)
at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.loadCache(CursorKeysToRows.java:100)
at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.nextImpl(CursorKeysToRows.java:65)
at com.alvazan.orm.layer0.base.CursorRow.nextImpl(CursorRow.java:33)
at com.alvazan.orm.api.z8spi.iter.AbstractCursor.next(AbstractCursor.java:10)
at com.alvazan.orm.layer0.base.BaseEntityManagerImpl.find(BaseEntityManagerImpl.java:132)
at com.alvazan.orm.layer0.base.BaseEntityManagerImpl.saveMetaData(BaseEntityManagerImpl.java:235)
at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.rescan(BaseEntityManagerFactoryImpl.java:102)
at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.setup(BaseEntityManagerFactoryImpl.java:131)
at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstanceImpl(BootstrapImpl.java:64)
at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstance(BootstrapImpl.java:35)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:57)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:52)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:45)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:24)
at com.s1mbi0se.dmp.da.dao.PlayOrmConfiguration.init(PlayOrmConfiguration.java:39)
at com.s1mbi0se.dmp.da.dao.TestUserDao.testFindAllUsers(TestUserDao.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.netflix.astyanax.connectionpool.exceptions.TokenRangeOfflineException: TokenRangeOfflineException: [host=myhost.compute-1.amazonaws.com(....):9160, latency=336(336), attempts=1] UnavailableException()
at com.netflix.astyanax.thrift.ThriftConverter.ToConnectionPoolException(ThriftConverter.java:165)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:60)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:27)
at com.netflix.astyanax.thrift.ThriftSyncConnectionFactoryImpl$1.execute(ThriftSyncConnectionFactoryImpl.java:131)
at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:52)
at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:229)
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4.execute(ThriftColumnFamilyQueryImpl.java:457)
at com.alvazan.orm.layer9z.spi.db.cassandra.CursorKeysToRows.execute(CursorKeysToRows.java:155)
... 39 more
Caused by: UnavailableException()
at org.apache.cassandra.thrift.Cassandra$multiget_slice_result.read(Cassandra.java:9722)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_multiget_slice(Cassandra.java:613)
at org.apache.cassandra.thrift.Cassandra$Client.multiget_slice(Cassandra.java:597)
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4$1.internalExecute(ThriftColumnFamilyQueryImpl.java:463)
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4$1.internalExecute(ThriftColumnFamilyQueryImpl.java:460)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:55)
... 45 more
The code is expecting a real cluster to run 2 or more nodes not a single node. (sorry, was on thanksgiving vacation). Do you need to connect to just a single node?
Also, the reason we have detection in there is so we do CL_ONE if you only have one node but we assumed probably incorrectly people would only use one node to play around with cassandra(ie. localhost). We didn't think they would actually go live with just one node. Do you need modifications? If so, let us know and we can change that.
thanks,
Dean
This is fixed in release 1.4.2 which is available in Maven repo. Please try and let us know if you are still facing any issue.

Null Pointer Exception JSF

I'm getting a Null Pointer Exception when using my web app.
This exception is thrown at the login page. I enter both username and pass but it seems that the value or the evaluation of the expression #{userBean.user} or #{userBean.pass} is returning null.
My configuration: Apache Tomcat 7.0.22, Mojarra 2.1.6, RichFaces 4.1
Here's the stacktrace
javax.faces.el.EvaluationException: java.lang.NullPointerException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
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.lang.NullPointerException
at mx.gob.sagarpa.utilidades.Database.checkUser(Database.java:61)
at mx.gob.sagarpa.beans.UserBean.doLogin(UserBean.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 24 more
What can I do?
You need to head to the bottomost "Caused by" part of the stacktrace for the real root cause. In your particular case that is the following:
Caused by: java.lang.NullPointerException
at mx.gob.sagarpa.utilidades.Database.checkUser(Database.java:61)
You see, at line 61 of Database class, inside the checkUser() method, some object reference is null while the code is accessing it by the period operator ..
someObject = null;
someObject.doSomething(); // NullPointerException!
To fix it, you'd need to either add a nullcheck
if (someObject != null) {
someObject.doSomething();
} else {
// Take alternate path?
}
or to make sure that it's never null
someObject = createItSomehow();
someObject.doSomething(); // Okay.
Which path to take depends on the concrete functional requirement which is not clear from the question. But you should now at least understand why a NullPointerException can occur. This is also explained in its javadoc (which should be the #1 source for finding information about classes, including exceptions):
Thrown when an application attempts to use null in a case where an object is required. These include:
Calling the instance method of a null object.
Accessing or modifying the field of a null object.
Taking the length of null as if it were an array.
Accessing or modifying the slots of null as if it were an array.
Throwing null as if it were a Throwable value.
Applications should throw instances of this class to indicate other illegal uses of the null object.
That said, this problem is not exactly related to JSF. It's just basic Java. I'd suggest to take some time to go through a decent basic Java book/tutorial.

How to run new JSF full crude application created by app builder in Sakai

I have Sakai 2.8.1 source code and creating full crude application (JSF) and it deployed successfully on a Tomcat 5.1 server, however at run time it shows this error.
org.sakaiproject.portal.api.PortalHandlerException: org.sakaiproject.tool.api.ToolException: Could not get property value of component items:_idJsp6
at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:862)
caused by: org.sakaiproject.tool.api.ToolException: Could not get property value of component items:_idJsp6
at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1429)
caused by: javax.servlet.ServletException: Could not get property value of component items:_idJsp6
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
caused by: javax.faces.FacesException: Could not get property value of component items:_idJsp6
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
caused by: org.apache.jasper.JasperException: Could not get property value of component items:_idJsp6
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:413)
caused by: javax.faces.FacesException: Could not get property value of component items:_idJsp6
at javax.faces.component._ComponentAttributesMap.get(_ComponentAttributesMap.java:235)
caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
caused by: java.lang.NoClassDefFoundError: org/sakaiproject/submativeassessment/logic/ExternalLogic
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
caused by: java.lang.ClassNotFoundException: org.sakaiproject.submativeassessment.logic.ExternalLogic
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at java.beans.Introspector$1.run(Introspector.java:1272)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
at java.beans.Introspector.getBeanInfo(Introspector.java:387)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:472)
at org.apache.myfaces.el.PropertyResolverImpl.getType(PropertyResolverImpl.java:325)
at org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:177)
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:55)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:314)
at org.sakaiproject.jsf.app.SakaiVariableResolver.resolveVariable(SakaiVariableResolver.java:76)
at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:570)
at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
at org.apache.commons.el.ExpressionString.evaluate(ExpressionString.java:114)
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.faces.component._ComponentAttributesMap.getComponentProperty(_ComponentAttributesMap.java:387)
at javax.faces.component._ComponentAttributesMap.get(_ComponentAttributesMap.java:235)
at org.sakaiproject.jsf.util.RendererUtil.getAttribute(RendererUtil.java:88)
at org.sakaiproject.jsf.renderer.InstructionMessageRenderer.encodeEnd(InstructionMessageRenderer.java:59)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:498)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:366)
at org.apache.jsp.submativeassessment.SubmativeassessmentItems_jsp._jspx_meth_sakai_005finstruction_005fmessage_005f0(SubmativeassessmentItems_jsp.java:419)
at org.apache.jsp.submativeassessment.SubmativeassessmentItems_jsp._jspx_meth_h_005fform_005f1(SubmativeassessmentItems_jsp.java:350)
at org.apache.jsp.submativeassessment.SubmativeassessmentItems_jsp._jspx_meth_sakai_005fview_005fcontent_005f0(SubmativeassessmentItems_jsp.java:314)
at org.apache.jsp.submativeassessment.SubmativeassessmentItems_jsp._jspx_meth_sakai_005fview_005fcontainer_005f0(SubmativeassessmentItems_jsp.java:217)
at org.apache.jsp.submativeassessment.SubmativeassessmentItems_jsp._jspx_meth_f_005fview_005f0(SubmativeassessmentItems_jsp.java:176)
at org.apache.jsp.submativeassessment.SubmativeassessmentItems_jsp._jspService(SubmativeassessmentItems_jsp.java:123)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
at org.sakaiproject.jsf.app.SakaiViewHandler.renderView(SakaiViewHandler.java:137)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:598)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
at org.sakaiproject.jsf.util.JsfTool.dispatch(JsfTool.java:221)
at org.sakaiproject.jsf.util.JsfTool.doGet(JsfTool.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:359)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:511)
at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1429)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doTool(ToolHandler.java:204)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doGet(ToolHandler.java:96)
at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:862)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:659)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:843)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:679)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1303)
at java.lang.Thread.run(Thread.java:619)
The App Builder is broken for JSF apps. It is not recommended to be used for current projects since it hasn't been updated since Sakai 2.6 era.
It is also not recommended to use JSF for new Sakai applications.
Try the programmer manual:
And for new apps, either the Apache Wicket or Spring MVC Maven archetypes

Resources