10 Replies Latest reply on Mar 17, 2012 12:15 AM by Karsten Wutzke

    Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)

    Karsten Wutzke Expert

      Hello all,

       

      I'm currently developing a webapp based on JSF 2 view-scoped beans, EJB, CDI, JPA container-managed transactions, but I have an issue that I absolutely cannot solve on JBoss AS 7 (JBoss AS 7.1.0.Final). My webapp runs without any problems on GlassFish 3.1.2 (patched for http://java.net/jira/browse/GLASSFISH-18444).

       

      I'm having a problem that I described over a month ago here: http://stackoverflow.com/questions/9129797/hibernate-4-lazyinitializationexception-on-el-expression

       

      This is what started the avalanche... You can view the entity mappings here, but as I reduced my problem and I'm 100% sure that the mappings are correct.

       

      Below is my JSF page, I can hardly reduce it further. The page shows two lists of files, each file associated with a company. Files can be deleted via a remove button while they can be added via a RichFaces 4 rich:fileUpload component below. The page shows individual (personal) files in the left column, external companies' files are shown in the right column (panelGrid):

       

      debug-page.png

       

      The code for the left and right panels are exact copies, then just replacing "individual" with "external" etc. So both share the very same JSF code, but only use different methods on the JSF view-scoped bean:

       

      {code:xml}<?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html 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:c="http://java.sun.com/jsp/jstl/core"

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

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

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

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

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

       

        <!-- this is for getting the GET request ID into the pqHome view-scoped bean, never mind it -->

        <ui:define name="metadata">

          <f:metadata>

            <f:viewParam name="pq" value="#{pqHome.pqId}" required="#{not facesContext.postback}">

              <f:convertNumber integerOnly="#{true}" />

            </f:viewParam>

          </f:metadata>

        </ui:define>

       

        <h:head>

          <title>Debug</title>

        </h:head>

       

        <h:body>

          <h:form id="repo-form">

            <h:panelGrid columns="2">

             

              <rich:panel>

                <f:facet name="header">

                  <h:outputText value="Individual Documents" />

                </f:facet>

               

                <rich:dataTable value="#{repoHome.individualDocuments}"

                                var="doc"

                                rows="15"

                                id="repo-idoc-datatable">

                  <f:facet name="header">

                    <rich:columnGroup>

                      <rich:column><h:outputText value="File Name" /></rich:column>

                      <rich:column><h:outputText value="Company" /></rich:column>

                      <rich:column><h:outputText value="Remove" /></rich:column>

                    </rich:columnGroup>

                  </f:facet>

                  <rich:column>

                    <h:outputText value="#{doc.fileName}" />

                  </rich:column>

                  <rich:column>

                    <h:outputText value="#{doc.company.name}" />

                  </rich:column>

                  <rich:column>

                    <h:commandLink action="#{repoHome.removeIndividualDocument(doc.id)}">

                      <h:graphicImage library="images/icons" name="cross.png" />

                      <f:ajax execute="@this" render=":repo-form:repo-idoc-datatable" />

                    </h:commandLink>

                  </rich:column>

                  <f:facet name="footer">

                    <rich:dataScroller />

                  </f:facet>

                </rich:dataTable>

               

                <rich:fileUpload fileUploadListener="#{repoHome.uploadIndividualDocument}"

                                 acceptedTypes="doc,docx,pdf,txt,xls,ppt">

                  <a4j:ajax event="uploadcomplete"

                            execute="@none"

                            render=":repo-form:repo-idoc-datatable" />

                </rich:fileUpload>

              </rich:panel>

             

             

             

              <rich:panel>

                <f:facet name="header">

                  <h:outputText value="External Documents" />

                </f:facet>

               

                <rich:dataTable value="#{repoHome.externalDocuments}"

                                var="doc"

                                rows="15"

                                id="repo-edoc-datatable">

                  <f:facet name="header">

                    <rich:columnGroup>

                      <rich:column><h:outputText value="File Name" /></rich:column>

                      <rich:column><h:outputText value="Company" /></rich:column>

                      <rich:column><h:outputText value="Remove" /></rich:column>

                    </rich:columnGroup>

                  </f:facet>

                  <rich:column>

                    <h:outputText value="#{doc.fileName}" />

                  </rich:column>

                  <rich:column>

                    <h:outputText value="#{doc.company.name}" />

                  </rich:column>

                  <rich:column>

                    <h:commandLink action="#{repoHome.removeExternalDocument(doc.id)}">

                      <h:graphicImage library="images/icons" name="cross.png" />

                      <f:ajax execute="@this" render=":repo-form:repo-edoc-datatable" />

                    </h:commandLink>

                  </rich:column>

                  <f:facet name="footer">

                    <rich:dataScroller />

                  </f:facet>

                </rich:dataTable>

               

                <rich:fileUpload fileUploadListener="#{repoHome.uploadExternalDocument}"

                                 acceptedTypes="doc,docx,pdf,txt,xls,ppt">

                  <a4j:ajax event="uploadcomplete"

                            execute="@none"

                            render=":repo-form:repo-edoc-datatable" />

                </rich:fileUpload>

              </rich:panel>

       

            </h:panelGrid>

          </h:form>

        </h:body>

         

      </ui:composition>{code}

      Now what happens is really strange.

       

      When deleting files with the X, a simple click will remove the documents from the DB and immediately re-render the respective lists (and only those) successfully. When adding an external document (right side), the item is added to the DB and the list is updated.

       

      However, when uploading an individual document (left side), the item is added to the DB, but after the uploadIndividualDocument has run, the update of the list causes an exception:

      {code}12:38:02,105 SEVERE [org.richfaces.log.Context] (http-localhost-127.0.0.1-8080-4) /debug.xhtml @48,59 value="#{doc.company.name}": org.hibernate.LazyInitializationException: could not initialize proxy - no Session: javax.el.ELException: /debug.xhtml @48,59 value="#{doc.company.name}": org.hibernate.LazyInitializationException: could not initialize proxy - no Session

          at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIOutput.getValue(UIOutput.java:169) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.AbstractTableBaseRenderer.encodeColumn(AbstractTableBaseRenderer.java:82) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.DataTableRenderer.encodeRow(DataTableRenderer.java:259) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:80) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:65) [richfaces-core-api-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.component.UIDataAdaptor.walk(UIDataAdaptor.java:806) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:90) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.AbstractRowsRenderer.processRows(AbstractRowsRenderer.java:103) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.AbstractTableRenderer.encodeTableRows(AbstractTableRenderer.java:141) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.AbstractTableRenderer.doEncodeChildren(AbstractTableRenderer.java:195) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.renderkit.RendererBase.encodeChildren(RendererBase.java:157) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:504) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:321) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.component.UIDataAdaptor.visitTree(UIDataAdaptor.java:1319) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIForm.visitTree(UIForm.java:344) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:272) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

          at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:194) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

          at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

          at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

          at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.1.0.Final.jar:3.1.0.Final]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

          at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.1.0.Final.jar:3.1.0.Final]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]

          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]

          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_02]

      Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - no Session

          at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:149) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:195) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:185) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

      *   at de.poyry.pqgenerator.model.Company_$$_javassist_244.getName(Company_$$_javassist_244.java) [classes:]

          at sun.reflect.GeneratedMethodAccessor1401.invoke(Unknown Source) [:1.7.0_02]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_02]

          at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_02]

          at javax.el.BeanELResolver.getValue(BeanELResolver.java:302) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]

          at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          at org.apache.el.parser.AstValue.getValue(AstValue.java:169) [jbossweb-7.0.10.Final.jar:]

          at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.0.10.Final.jar:]

          at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]

          ... 65 more{code}

      The list update fails with the EL expression /debug.xhtml @48,59 value="#{doc.company.name}" for some reason.

       

      Remember: both left and right are based on the same code and call nearly equaling methods on the same bean:

      {code}public void uploadIndividualDocument(FileUploadEvent event) throws Exception

      {

          System.out.println("      ----------- begin uploadIndividualDocument -----------");

         

          UploadedFile uf = event.getUploadedFile();

         

          // associated entities

          Company internal = companyManager.getInternalCompany();

          User user = userManager.getCurrentUser();

         

          // new individual doc plus associated company

          IndividualDocument transientIndividualDocument = new IndividualDocument(internal.getId(), uf.getName(), uf.getData(), new Date(), user.getId());

          transientIndividualDocument.setCompany(internal);

          transientIndividualDocument.setUser(user);

         

          docService.create(transientIndividualDocument);

         

          // invalidate list

          individualDocuments = null;

         

          System.out.println("       ----------- end uploadIndividualDocument -----------");

      }

       

      public void uploadExternalDocument(FileUploadEvent event) throws Exception

      {

          System.out.println("      ------------ begin uploadExternalDocument ------------");

         

          UploadedFile uf = event.getUploadedFile();

       

          // get associated entities

          Company company = companyManager.getInternalCompany();

                 

          // new external document plus associated company

          ExternalDocument transientExternalDocument = new ExternalDocument(company.getId(), uf.getName(), null, uf.getData());

          transientExternalDocument.setCompany(company);

         

          docService.create(transientExternalDocument);

         

          // invalidate list

          externalDocumentGroups = null;

         

          System.out.println("       ------------ end uploadExternalDocument ------------");

      }{code}

      As you can see the upload methods are almost equal, too. It's only that uploadIndividualDocument gets the current user from the session-scoped, CDI-injected userManager (not shown, via @Inject into the JSF managed bean) and sets it for the uploaded individual document.

       

      There must be something wrong with my webapp or JBoss AS 7 has some issues, but I can't figure it out. I bet I'm doing something wrong. I have no idea how to continue with the exception I get.

       

      Can anybody help?

       

      Karsten

       

      PS: server.log attached with trace enabled

        • 1. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
          Scott Marlow Master

          I wonder if the persistence context is lasting longer with GlassFish for some reason.  That doesn't solve the issue but just stating what could be the difference.

          • 2. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
            Scott Marlow Master

            A new JTA transaction is started to read the associated (lazy) part of the entity after the persistence context is closed.

             

            17:38:06,871 DEBUG [org.jboss.as.jpa] (http-localhost-127.0.0.1-8080-1) http-localhost-127.0.0.1-8080-1:[transaction scoped EntityManager]: reuse entity manager session already in tx TransactionImple < ac, BasicAction: 0:ffffc0a8b216:d626f9d:4f621882:9f status: ActionStatus.RUNNING >

            17:38:06,871 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,872 TRACE [org.jboss.as.jpa] (http-localhost-127.0.0.1-8080-1) createQuery resultClass 'de.poyry.pqgenerator.model.ExternalDocument' took 2ms

            17:38:06,872 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,872 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,873 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,873 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionSynchronizationRegistryImple.getTransactionKey

            17:38:06,873 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionSynchronizationRegistryImple.getTransactionKey

            17:38:06,874 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionSynchronizationRegistryImple.getResource

            17:38:06,874 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,874 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionSynchronizationRegistryImple.getResource

            17:38:06,875 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,875 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,875 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,875 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.equals

            17:38:06,886 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,886 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,889 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,889 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,889 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.commit

            17:38:06,890 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.commitAndDisassociate

            17:38:06,890 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) SynchronizationImple.beforeCompletion

            17:38:06,890 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,890 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,892 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) SynchronizationImple.beforeCompletion

            17:38:06,892 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) SynchronizationImple.beforeCompletion

            17:38:06,893 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::End() for action-id 0:ffffc0a8b216:d626f9d:4f621882:9f

            17:38:06,893 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::onePhaseCommit() for action-id 0:ffffc0a8b216:d626f9d:4f621882:9f

            17:38:06,893 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) LastResourceRecord::topLevelPrepare() for 0:0:0:0:1

            17:38:06,896 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) LastResourceRecord::topLevelCommit() for 0:0:0:0:1

            17:38:06,896 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) SynchronizationImple.afterCompletion

            17:38:06,897 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) SynchronizationImple.afterCompletion

            17:38:06,897 DEBUG [org.jboss.as.jpa] (http-localhost-127.0.0.1-8080-1) http-localhost-127.0.0.1-8080-1:[transaction scoped EntityManager]: closing entity managersession

            17:38:06,897 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,898 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) TransactionImple.getStatus

            17:38:06,898 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) SynchronizationImple.afterCompletion

            17:38:06,898 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::removeChildThread () action 0:ffffc0a8b216:d626f9d:4f621882:9f removing TSThread:1

            17:38:06,899 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::removeChildThread () action 0:ffffc0a8b216:d626f9d:4f621882:9f removing TSThread:1 result = true

            17:38:06,899 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) TransactionReaper::remove ( BasicAction: 0:ffffc0a8b216:d626f9d:4f621882:9f status: ActionStatus.COMMITTED )

            17:38:06,900 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,915 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.getStatus

            17:38:06,915 TRACE [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-1) BaseTransaction.begin

            17:38:06,916 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) StateManager::StateManager( 2, 0 )

            17:38:06,916 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::BasicAction()

            17:38:06,916 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::Begin() for action-id 0:ffffc0a8b216:d626f9d:4f621882:a6

            17:38:06,917 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::actionInitialise() for action-id 0:ffffc0a8b216:d626f9d:4f621882:a6

            17:38:06,917 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) ActionHierarchy::ActionHierarchy(5)

            17:38:06,917 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) ActionHierarchy::add(0:ffffc0a8b216:d626f9d:4f621882:a6, 1)

            17:38:06,918 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::addChildThread () action 0:ffffc0a8b216:d626f9d:4f621882:a6 adding Thread[http-localhost-127.0.0.1-8080-1,5,main]

            17:38:06,918 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) BasicAction::addChildThread () action 0:ffffc0a8b216:d626f9d:4f621882:a6 adding Thread[http-localhost-127.0.0.1-8080-1,5,main] result = true

            17:38:06,919 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) TransactionReaper::insert ( BasicAction: 0:ffffc0a8b216:d626f9d:4f621882:a6 status: ActionStatus.RUNNING, 300 )

            17:38:06,919 TRACE [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8080-1) ReaperElement::ReaperElement ( BasicAction: 0:ffffc0a8b216:d626f9d:4f621882:a6 status: ActionStatus.RUNNING, 300 )

            17:38:06,939 SEVERE [org.richfaces.log.Context] (http-localhost-127.0.0.1-8080-1) /debug.xhtml @48,59 value="#{doc.company.name}": org.hibernate.LazyInitializationException: could not initialize proxy - no Session: javax.el.ELException: /debug.xhtml @48,59 value="#{doc.company.name}": org.hibernate.LazyInitializationException: could not initialize proxy - no Session

                at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIOutput.getValue(UIOutput.java:169) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.AbstractTableBaseRenderer.encodeColumn(AbstractTableBaseRenderer.java:82) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.DataTableRenderer.encodeRow(DataTableRenderer.java:259) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:80) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:65) [richfaces-core-api-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.component.UIDataAdaptor.walk(UIDataAdaptor.java:806) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:90) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.AbstractRowsRenderer.processRows(AbstractRowsRenderer.java:103) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.AbstractTableRenderer.encodeTableRows(AbstractTableRenderer.java:141) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.AbstractTableRenderer.doEncodeChildren(AbstractTableRenderer.java:195) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.renderkit.RendererBase.encodeChildren(RendererBase.java:157) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:504) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:321) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.component.UIDataAdaptor.visitTree(UIDataAdaptor.java:1319) [richfaces-components-ui-4.1.0.Final.jar:4.1.0.Final]

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIForm.visitTree(UIForm.java:371) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:272) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

                at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:194) [richfaces-core-impl-4.1.0.Final.jar:4.1.0.Final]

                at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.1.0.Final.jar:3.1.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.1.0.Final.jar:3.1.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

                at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_02]

            Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - no Session

                at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:149) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:195) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:185) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at de.poyry.pqgenerator.model.Company_$$_javassist_16.getName(Company_$$_javassist_16.java) [classes:]

                at sun.reflect.GeneratedMethodAccessor207.invoke(Unknown Source) [:1.7.0_02]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_02]

                at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_02]

                at javax.el.BeanELResolver.getValue(BeanELResolver.java:302) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]

                at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.7-jbossorg-2.jar:]

                at org.apache.el.parser.AstValue.getValue(AstValue.java:169) [jbossweb-7.0.13.Final.jar:]

                at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

                at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.1.7-jbossorg-2.jar:]

                ... 65 more

            • 3. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
              Karsten Wutzke Expert

              Yes, this was my assumption, too. But since I copied the code inside the JSF and use the same bean to trigger the upload with the right panel working OK and the left panel not working OK just makes me wonder why the left one thrashes the persistence context. It makes absolutely no sense.

               

              Would it make sense to ZIP the project and send it to you as it's rather hard to understand without actually seeing it...?

               

              Karsten

              • 4. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
                Scott Marlow Master

                No, don't send me the project source.  Instead, why don't you add some debug (System.out.println("")) prints to your application code so you can get a handle on what is going on.  That might help you to understand what is happening exactly and why.

                 

                My interest is in fixing bugs in AS7 and possibly enhancing the JPA trace logging further if needed to better illustrate what is going on. 

                • 6. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
                  Scott Marlow Master

                  The most likely thing is that GlassFish isn't lazily fetching the associated entity.  I think the question that you should answer is how to get the same behavior with AS7.  First, run with GlassFish again and figure out if they are doing a lazy fetch or not (perhaps enable their trace logging as needed).

                  • 7. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
                    Karsten Wutzke Expert

                    Problem is the upload*Document methods have already finished running (successfully) when the exception is thrown. It is thrown as soon as the JSF

                    {code:xml}<a4j:ajax event="uploadcomplete"

                              execute="@none"

                              render=":repo-form:repo-idoc-datatable" />{code}

                    kicks in. This is why I wrote "Refresh problem" in the title... The server.log should show this.

                     

                    I'll try a few debug prints on the methods being called on the refresh - sry brain damage (it's 11 PM here).

                     

                    Karsten

                     

                    PS: sorry for being so annoying, it's an issue I cope with for weeks

                    • 8. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
                      Karsten Wutzke Expert

                      Scott,

                       

                      I've run several tests and both individual and external document server.log's are mostly identical, for the most part even line by line.

                       

                      The (working) external document uploader also closes the entity manager session, so it behaves identically for both sides. However, the individual files throws this "no session" exception. Maybe the external documents should throw this exception, too...?? The disparity between the two makes me wonder: either both should work or none.

                       

                      I've attached the two logs of the upload process individually, you can almost diff through them, but again, there's nothing I can see.

                       

                      Karsten

                      • 9. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
                        Scott Marlow Master

                        Karsten,

                         

                        Its important to make sure that all lazy fetching happens before the persistence context is closed.  You can't expect to access the 'doc.company' after the persistence context that read the 'doc' entity has closed. 

                         

                        I think your missing out on the fun by pushing back on me to solve this for you.  Instead, add more debug prints to your code so you better understand the flow of what happens each time your code is invoked.

                         

                        Get more facts, but don't just give them to me, instead try to understand what is happening and why.

                         

                        Scott

                        • 10. Re: Refresh problems with JSF 2 view-scoped, EJB, CDI, JPA, and container-managed transactions on asynchronous file upload (working on GlassFish)
                          Karsten Wutzke Expert

                          Scott, please don't misunderstand me. I'm not giving it to you, I'm just giving up... anybody reading this could help, it's not a personal thread.

                           

                          As for: "Its important to make sure that all lazy fetching happens before the persistence context is closed." - yes, this is the theory I am aware of and I haven't programmed anything that would violate this... at least not that I know of... this is why I'd like someone to look at it.

                           

                          To me this thing is no fun as I deal with it for weeks. It makes no sense why one update works and the other fails, with basically identical code and mappings. Even the logs are somewhat identical and all works on GlassFish.

                           

                          Why should it make sense to continue debugging this? The only method that's executed on the AJAX refresh is repoHome.getIndividualDocuments(), but adding println's at the start and end made me no smarter, since the exception ocurrs after the println at the end of that method:

                           

                          {code}public List<IndividualDocument> getIndividualDocuments()

                          {

                              log.info("      ----------- begin getIndividualDocuments() -----------");

                           

                              if ( individualDocuments == null )

                              {

                                  // filtered by current user

                                  individualDocuments = docService.findAllIndividualDocumentsFor(userManager.getCurrentUser());

                              }

                           

                              log.info("       ----------- end getIndividualDocuments() -----------");

                           

                              return individualDocuments;

                          }{code}

                           

                          The whole thing makes no sense and I don't know where to put any more printlns. Maybe I'm just clumsy at debugging.

                           

                          What else can I try? What if the server has a problem that I cannot debug (even if unlikely)?

                           

                          Edit: I've attached two new server logs, now with one println at the start and end of the get*Documents() methods. edoc-... works, idoc-... fails. Why is getIndividualDocuments called so many times for both and why at all??

                           

                          Karsten