1 Reply Latest reply on Feb 14, 2012 12:27 PM by Jorge Campos

    <a4j:keepAlive> and java.lang.OutOfMemoryError

    topfan Newbie

      Hi everyone :-)

       

      i've got a problem with <a4j:keepAlive>.

      I use it for my page, below:

       

      =====================================================================================================

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:rich="http://richfaces.org/rich"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:c="http://java.sun.com/jstl/core"

          xmlns:crumb="customCrumbs">

       

      <ui:composition template="template/template.xhtml">

       

          <ui:define name="pageTitle">Ricerca</ui:define>

         

          <ui:define name="barraNavigazioneCrumbs">

              <crumb:crumbs group="home" label="Home" startNew="true" active="true" />

          </ui:define>

         

          <ui:define name="pageForm">

             

              <script>var kb_id = '';</script>

             

              <h:panelGroup rendered="#{not empty resultBean}">

                  <a4j:keepAlive beanName="resultBean"></a4j:keepAlive>

                  <rich:dataTable cellpadding="1"

                      id="dataTableCodTributo"

                      style="border: none; width: 98%;"

                      cellspacing="1" headerClass="headerClass"

                      var="codice" value="#{resultBean}">

                     

                      <rich:column style="border: none;">

                          <fieldset style="padding-top: 10px; width: 98%;">

                              <legend><h:outputText style="font-weight: bold;" value="Cod. Trib.: #{codice.codice} - AREA: #{codice.area} - Pregresso: #{codice.flagCodicePregresso== 1? 'Si':'No'}"/></legend>

                              <div style="width:100%; padding: 8px;" >

                                  <h:outputText  value="#{codice.descrizione}" /><br/><br/>

       

                                  <ui:include src="fragmentCodiciEntrata.xhtml" >

                                      <ui:param name="cod" value="#{codice.codici}"/>

                                  </ui:include>

                              </div>

                           </fieldset>

                     

                      </rich:column>

                  </rich:dataTable>       

       

              </h:panelGroup>       

         

          </ui:define>

       

      </ui:composition>

      </html>

      ============================================================================================================================

       

      resultBean has request scope.

      Well, it work quite well.

      But, if the size of resultBean is approaching to 200 item the result is:

       

      =============================================================

      [14/02/12 17.03.43:878 CET] 00000029 WebApp    E   [Servlet Error]-[Faces Servlet]: java.lang.OutOfMemoryError
      at org.ajax4jsf.io.CharBuffer.<init>(CharBuffer.java:59)
      at org.ajax4jsf.io.CharBuffer.append(CharBuffer.java:120)
      at org.ajax4jsf.io.FastBufferWriter.write(FastBufferWriter.java:109)
      at org.ajax4jsf.webapp.FilterServletResponseWrapper$ServletStringWriter.write(FilterServletResponseWrapper.java:336)
      at java.io.Writer.write(Writer.java:171)
      at java.io.PrintWriter.write(PrintWriter.java:405)
      at java.io.PrintWriter.write(PrintWriter.java:422)
      at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.write(HtmlResponseWriter.java:519)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:630)
      at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1223)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1158)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:850)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:693)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:656)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:535)
      at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:764)
      at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
      at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1551)

      ====================================================================

       

      why?

       

      Any ideas?

       

      Thanks a lot.

       

      topfan

        • 1. Re: <a4j:keepAlive> and java.lang.OutOfMemoryError
          Jorge Campos Newbie

          Hi topfan

           

          Your keepAlive tag is right

          I think you are using the datatable in a wrong way...

           

          the value attribute should point to a list not to your bean

           

          <rich:dataTable cellpadding="1"

                          id="dataTableCodTributo"

                          style="border: none; width: 98%;"

                          cellspacing="1" headerClass="headerClass"

                          var="codice" value="#{resultBean.someAttributeTypeListHere}">

           

          Hope it helps

          Jorge Campos