This Question is Not Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
2 Replies Last post: Aug 25, 2008 5:16 PM by RedBaron  
RedBaron   6 posts since
Jul 14, 2008
Currently Being Moderated

Jul 25, 2008 2:52 PM

Problem with DataTable and TreeTable

Hello. I have a problem with a DataTable and a TreeTable. The DataTable is filled with data after loading the jsf page. If I select a row in the DataTable, the TreeTable should be filled with data but it doesn't work. Inside the q:DataTable tag, I have a q:SingleRowSelection tag. In the q:SingleRowSelection tag I have a "onchange" tag which calls the q_refreshTable method. I refresh my DataTable and call a method in the ManagedBean of my TreeTable (the DataTable has an own ManagedBean). The method in the TreeTable-ManagedBean gets data from a database. This works but after getting the data and putting it in a list of Request-objetcs, I get an exception:

 

javax.faces.el.EvaluationException: Exception while invoking expression #{MyTreeTableBean.initComponents}

at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)

at teamdev.jsf.bo.a(SourceFile:714)

at teamdev.jsf.bo.i(SourceFile:357)

at teamdev.jsf.bo.d(SourceFile:179)

at teamdev.jsf.bd.processApplication(SourceFile:107)

at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)

at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)

at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)

at org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:77)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)

at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

at teamdev.jsf.util.ResourceFilter.doFilter(SourceFile:94)

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:210)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)

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:151)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.OutOfMemoryError: Java heap space

 

 

 

 

 

 

What did I make wrong? Thanks for your help.

Dmitry Pikhulya TeamDev Ltd. 162 posts since
Jan 5, 2007
Currently Being Moderated
1. Jul 25, 2008 6:29 PM in response to: RedBaron
Re: Problem with DataTable and TreeTable

Hello,

 

According to the stack trace that you have provided, the cause of the problem is the java.lang.OutOfMemoryError error while invoking the MyTreeTableBean.initComponents method. You should carefully analyze the code in that method taking into account the amounts of data being loaded there. Most probably the problem appears because you load too much data at once in this single method. It's also possible that not only this particular part of your appliaction consumes too much memory, but the problem takes place because other parts of your application might retain too little memory in virtual machine. So you might also need to take a look at the overall memory consumption and possibly increase available memory for your virtual machine.

 

Please tell what the logic behind the initComponents method is. I suppose that it loads the entire tree structure according to the selected datatable row. Is this correct? If so, please note that the TreeTable component doesn't require the application to load the entire tree structure at once -- you may reorganize your code to load the data in parts, just like the TreeTable requests it through the nodeChildren attribute of q:dynamicTreeStructure tag. This way only the data that is displayed will need to be loaded from database and you'll be able to load additional data only when user expands more nodes to see the deeper levels of your tree.

 

There's also one more thing that should be taken into account for optimizing memory consumption. The TreeTable components provides a possibility to preload data partially or entirely on the client-side for further quicker access on the client-side. The preloadedNodes attribute is responsible for customizing this behavior, and by default it is defined to preload only the visible nodes, which is optimal if you need to optimize server performance (memory or database access), or network traffic. So you should be careful if you specify a non-default value for preloadedNodes attribute. See documentation for details.

 

Feel free to ask if you need any clarifications.

 

Regards,

Dmitry

More Like This

  • Retrieving data ...