Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-2781

in transaction scoped persistence context,invoked in non-tx, after entityManager.find(), no session or session was closed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 7.0.2.Final, 7.1.0.Beta1
    • JPA / Hibernate
    • None
    • Hide

      1) Download attachment
      2) untar
      3) cd lord
      4) mvn clean package -Dmaven.test.skip
      5) cp -r $JBOSS_HOME/standalone/deployments/lord.war
      6) touch $JBOSS_HOME/standalone/deployments/lord.war.dodeploy
      7) go to http://localhost:8080/lord/index.jsf
      8) observe stack trace
      9) modify MemberListProducer#retrieveAllMembersOrderedByName, repeat, observe no stack trace

      Show
      1) Download attachment 2) untar 3) cd lord 4) mvn clean package -Dmaven.test.skip 5) cp -r $JBOSS_HOME/standalone/deployments/lord.war 6) touch $JBOSS_HOME/standalone/deployments/lord.war.dodeploy 7) go to http://localhost:8080/lord/index.jsf 8) observe stack trace 9) modify MemberListProducer#retrieveAllMembersOrderedByName, repeat, observe no stack trace

      After entityManager.find(), the session appears to be closed (can't access persistent collection). A functionally equivalent query for id works fine.

      see comments in MemberListProducer#retrieveAllMembersOrderedByName (Attachment!)

      Stacktrace:

      17:57:18,210 INFO [org.jboss.web] (MSC service thread 1-7) registering web context: /lord
      17:57:18,263 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "lord.war"
      17:57:19,858 INFO [my.lord.data.MemberListProducer] (http-0.0.0.0-0.0.0.0-8080-1) m.name=John Smith
      17:57:19,859 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-0.0.0.0-0.0.0.0-8080-1) Error Rendering View[/index.xhtml]: org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke [method] @PostConstruct public my.lord.data.MemberListProducer.retrieveAllMembersOrderedByName() on my.lord.data.MemberListProducer@2d275595
      at org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:595) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.postConstruct(ManagedBean.java:200) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:340) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:122) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:693) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.bean.AbstractReceiverBean.getReceiver(AbstractReceiverBean.java:84) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:146) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:361) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:693) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:152) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:112) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.as.weld.webtier.jsf.ForwardingELResolver.getValue(ForwardingELResolver.java:46) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175) [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.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:67) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.el.parser.AstEmpty.getValue(AstEmpty.java:45) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
      at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:413) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1750) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
      at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
      at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.introspector.jlr.WeldMethodImpl.invoke(WeldMethodImpl.java:193) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      at org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:591) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      ... 50 more
      Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: my.lord.model.Member.additionalInfos, no session or session was closed
      at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:393) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
      at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:385) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
      at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:125) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
      at org.hibernate.collection.internal.PersistentBag.size(PersistentBag.java:243) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
      at my.lord.data.MemberListProducer.retrieveAllMembersOrderedByName(MemberListProducer.java:63) [classes:]
      ... 60 more

              smarlow1@redhat.com Scott Marlow
              bohl_jira Lars Bohl (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: