4 Replies Latest reply on May 20, 2008 5:25 PM by judy guglielmin

    icefaces lazy initialization problem

    Laurent Nepveu Newbie

      I'm using seam and icefaces.


      I'm having lazy initialization problems.


      I have two facelet views and one stateful bean:


      routine list:


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                          xmlns:ice="http://www.icesoft.com/icefaces/component"
                      template="layout/template.xhtml">
      
      <ui:define name="body">
           <h:messages globalOnly="true" styleClass="message"/>
           <ice:dataTable      var="routine"
                               value="#{routineList}">
                <ice:column>
                     <f:facet name="header">Id</f:facet>
                     <ice:outputText value="#{routine.id}" />
                </ice:column>
                <ice:column>
                     <f:facet name="header">Description</f:facet>
                     <s:link id="routineLink" view="/routine.xhtml" 
                             value="#{routine.description}"/>
                </ice:column>
          </ice:dataTable>
      </ui:define> 
      </ui:composition>
      



      view routine:



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                          xmlns:ice="http://www.icesoft.com/icefaces/component"
                      template="layout/template.xhtml">
      
      <ui:define name="body">
           <h:messages globalOnly="true" styleClass="message"/>
           <ice:outputText value="#{routineManager.routine.id}" />
           <ice:outputText value="#{routineManager.routine.description}" />
           
           <h:form id="test">
           <ice:panelGroup style="border: 1px solid black; position: relative; width: 1000px; height: 600px;">
                
                <ice:panelGroup style="border: 1px solid black; position: absolute; top: 0px; left: 0px; width: 400px; height: 50px;">
                     <ice:outputText value="#{routineManager.routine.days}" />
                </ice:panelGroup>
                
                <ice:panelGroup style="border: 1px solid black; position: absolute; top: 50px; left: 0px; width: 200px; height: 50px;">
                </ice:panelGroup>
                
                <ice:panelGroup style="border: 1px solid black; position: absolute; top: 50px; left: 200px; width: 200px; height: 50px;">
                </ice:panelGroup>
                
                <ice:panelGroup style="border: 1px solid black; position: absolute; top: 100px; left: 0px; width: 400px; height: 450px;">
                     <ice:dataTable      scrollable="true"               
                                         columnWidths="130px,300px"
                                         scrollHeight="415px"
                                         var="exercise" cellpadding="0"
                                         value="#{exerciseQuery.resultList}">
                          <ice:column>
                               <f:facet name="header">Id</f:facet>
                               <ice:outputText value="#{exercise.id}" />
                          </ice:column>
                          <ice:column>
                               <f:facet name="header">Description</f:facet>
                               <ice:outputText value="#{exercise.description}" />
                          </ice:column>
                    </ice:dataTable>
                </ice:panelGroup>
                
                <ice:panelGroup style="border: 1px solid black; position: absolute; top: 550px; left: 0px; width: 400px; height: 50px;">
                </ice:panelGroup>
                
                <ice:panelGroup style="border: 1px solid black; position: absolute; top: 0px; left: 400px; width: 600px; height: 600px;">
                
                <ice:panelTabSet selectedIndex="1"  tabPlacement="top">
                           <ice:panelTab label="Tab 1">Hello 1
                            </ice:panelTab>
                           <ice:panelTab label="Tab 2">Hello 2
                           </ice:panelTab>     
                           <ice:panelTab label="Tab 3">Hello 3
                           </ice:panelTab>     
              </ice:panelTabSet>
                
                     <!-- ice:panelTabSet var="day" value="#{routine.days}">
                          <ice:panelTab label="#{day.label}">
                             <ice:outputText value="#{day.label}"/>
                         </ice:panelTab>
                     </ice:panelTabSet-->
                </ice:panelGroup>
           
           </ice:panelGroup>
           </h:form>
           <div style="clear:both"/>
           
      </ui:define> 
      </ui:composition>
      



      stateful bean:



      package com.blisslogik.fbo.beans;
      
      import java.util.List;
      
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import javax.persistence.PersistenceContextType;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Destroy;
      import org.jboss.seam.annotations.Factory;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.annotations.datamodel.DataModel;
      import org.jboss.seam.annotations.datamodel.DataModelSelection;
      
      import com.blisslogik.fbo.entity.Routine;
      import com.blisslogik.fbo.entity.RoutineQuery;
      
      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("routineManager")
      public class RoutineManagerBean implements RoutineManager {
           @DataModel
           private List<Routine> routineList;
      
           @DataModelSelection
           @Out(required=false)
           private Routine routine;
      
           @PersistenceContext(type=PersistenceContextType.EXTENDED)
           private EntityManager em;
           
           @In(create=true)
           private RoutineQuery routineQuery;
      
           public void delete() {
                routineList.remove(routine);
                routine = em.merge(routine);
               em.remove(routine);
               routine=null;
           }
           
           @Factory("routineList")
           public void loadRoutines()
           {
               routineList = routineQuery.getResultList();
           }
      
           @Remove @Destroy
           public void destroy() {}
           
           public void select() {
                System.out.println("SELECT!!!!");
           }
           
           public void merge() {
                routine = em.merge(routine);
           }
           
           public void refresh() {
                loadRoutines();
           }
           
           public Routine getRoutine() {
                return routine;
           }
      }
      



      When I tried to view a routine, I have thew following error:

        • 1. Re: icefaces lazy initialization problem
          Laurent Nepveu Newbie

          "org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.blisslogik.fbo.entity.Routine.days, no session or session was closed
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
                  at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
                  at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
                  at org.hibernate.collection.PersistentList.toString(PersistentList.java:372)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.formatComponentValue(DomBasicRenderer.java:214)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.getValue(DomBasicRenderer.java:153)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeEnd(DomBasicRenderer.java:125)
                  at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:352)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:342)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:561)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:317)
                  at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
                  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                  at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                  at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
                  at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:143)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
                  at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
                  at com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:46)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
                  at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:109)
                  at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:98)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                  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:230)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                  at java.lang.Thread.run(Thread.java:595)
          07:41:39,328 ERROR [D2DFaceletViewHandler] Problem in renderResponse: failed to lazily initialize a collection of role: com.blisslogik.fbo.entity.Routine.days, no sess
          ion or session was closed
          org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.blisslogik.fbo.entity.Routine.days, no session or session was closed
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
                  at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
                  at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
                  at org.hibernate.collection.PersistentList.toString(PersistentList.java:372)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.formatComponentValue(DomBasicRenderer.java:214)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.getValue(DomBasicRenderer.java:153)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeEnd(DomBasicRenderer.java:125)
                  at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:352)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:342)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:561)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:317)
                  at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
                  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                  at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                  at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
                  at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:143)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
                  at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
                  at com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:46)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
                  at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:109)
                  at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:98)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                  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:230)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                  at java.lang.Thread.run(Thread.java:595)
          07:41:39,343 WARN  [lifecycle] executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@1d67b41) threw exception
          javax.faces.FacesException: Problem in renderResponse: failed to lazily initialize a collection of role: com.blisslogik.fbo.entity.Routine.days, no session or session
          was closed
                  at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:324)
                  at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
                  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                  at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                  at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
                  at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:143)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
                  at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
                  at com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:46)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
                  at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:109)
                  at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:98)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                  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:230)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                  at java.lang.Thread.run(Thread.java:595)
          Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.blisslogik.fbo.entity.Routine.days, no session or session w
          as closed
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
                  at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
                  at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
                  at org.hibernate.collection.PersistentList.toString(PersistentList.java:372)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.formatComponentValue(DomBasicRenderer.java:214)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.getValue(DomBasicRenderer.java:153)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeEnd(DomBasicRenderer.java:125)
                  at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:352)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:342)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:561)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:317)
                  ... 52 more
          07:41:39,343 ERROR [ExceptionFilter] handling uncaught exception
          javax.faces.FacesException: Problem in renderResponse: failed to lazily initialize a collection of role: com.blisslogik.fbo.entity.Routine.days, no session or session
          was closed
                  at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:324)
                  at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
                  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                  at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                  at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
                  at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:143)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
                  at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
                  at com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:46)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
                  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
                  at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
                  at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:109)
                  at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
                  at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
                  at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:98)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                  at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                  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:230)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                  at java.lang.Thread.run(Thread.java:595)
          Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.blisslogik.fbo.entity.Routine.days, no session or session w
          as closed
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
                  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
                  at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
                  at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
                  at org.hibernate.collection.PersistentList.toString(PersistentList.java:372)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.formatComponentValue(DomBasicRenderer.java:214)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.getValue(DomBasicRenderer.java:153)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeEnd(DomBasicRenderer.java:125)
                  at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:352)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:342)
                  at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:561)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                  at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:317)
                  ... 52 more"







          I would expect my PersistenceManager to be still up in my stateful bean.


          I don't understand why I get a no session or session closed error.


          Any ideas?


          Thanks!


          Laurent

          • 2. Re: icefaces lazy initialization problem
            judy guglielmin Novice

            Could it be possible that it can't find the days collection that are a part of the routine entity?  You might want to look at your enity beans, tables and relationships. (hibernate exception).

            • 3. Re: icefaces lazy initialization problem
              Laurent Nepveu Newbie

              judy guglielmin wrote on May 15, 2008 05:55 PM:


              Could it be possible that it can't find the days collection that are a part of the routine entity?  You might want to look at your enity beans, tables and relationships. (hibernate exception).


              Well...I think it finds it...then tries to lazy load the collection....but the hibernate session seems absent...


              I was using richfaces before and had no such problem...no with icefaces, my hibernate context doesn't seem initialized correctly within each requests.


              Thanks!

              • 4. Re: icefaces lazy initialization problem
                judy guglielmin Novice

                For quicker response, you may want to try posting this to the ICEfaces forum
                A simplified example project attached to the posting will ensure that it gets looked at a little quicker.  A few versions of Seam ago, I had some issues with DataModel and DataModelSelection annotations