11 Replies Latest reply on Apr 4, 2012 12:29 PM by b69

    org.hibernate.LazyInitializationException

    b69

      On Glassfish 3.1 with Eclipselink 2.3.x the following declaration reads in the assigned stakeholders as desired:

       

      @OneToMany(mappedBy = "project", orphanRemoval=true, cascade=CascadeType.ALL)

          private List<Stakeholder> stakeholders;

       

      within class marked with @Entity (EJB 3.1-Application)

       

      On AS7.1 with Hibernate the LazyInitializationException is thrown.

       

      As far as I know this loading must be programmed in a different manner. Who knows the most elegant solution, close to the above one, but working with AS7.1/Hibernate as well as with Glassfish/Eclipselink and others?

       

      Thanks!

        • 1. Re: org.hibernate.LazyInitializationException
          smarlow

          Can you show the example code and help answer the following questions.

           

          Is Glassfish lazily fetching the stakeholders?  Or are they fetching them before the initial JTA transaction (that loaded the entity) ends? 

           

          To get the answers, maybe you could enable some trace logging for EclipseLink, so you know when EclipseLink fetches the initial (one) entity and when it fetches the other (many) entities.  Be sure that the application also logs the start/end of the transactional BEAN method as well.

           

          I already know why Hibernate will throw the LazyInitializationException but I'm not sure why Glassfish/EclipseLink doesn't throw it yet.  If you can help me better understand why your application doesn't get the error with Glassfish/EclipseLink, I can better answer your question (and help address the problem).

           

          I hope this makes sense.

          1 of 1 people found this helpful
          • 2. Re: org.hibernate.LazyInitializationException
            b69

            I didn't trace glassfish until now, but what I can say is, by overriding the default with:

             

            @OneToMany(mappedBy="project", orphanRemoval=true, cascade=CascadeType.ALL,

                        fetch=FetchType.EAGER)

                private List<Stakeholder> stakeholders;

            it works with AS 7.1 too!

             

            So, I conclude glassfish ignores the default LACY hint and does an eager fetch. By definition the App-Server implementer is free to interprete the fetching hint.

            But the questions remains interesting and I'll try to trace glassfish as you suggest to know what is going on really.

             

            Beside, it's hard to port from glassfish to AS7! The application runs smoth without error on glassfish, but until now I get a crash on AS7 almost on every klick! (ejb concurrent access time out, next to look after, etc.)  I'm really just starting!

            • 3. Re: org.hibernate.LazyInitializationException
              smarlow

              Its definitely possible that glassfish is ignoring the default LAZY hint.  Other users have complained about that (I would expect not supporting LAZY by default could result in applications that have out of memory problems).  The glassfish link here, talks about a workaround for getting lazy fetching to work on glassfish.  Please post additional details as to what is going on (when running with glassfish in this situation). 

               

              There are two cases that come to mind, where this happens.  They both happen with a transaction scoped persistence context (extended persistence will always just work but requires a stateful bean). 

               

              Case 1, is when there is no active JTA transaction.  The persistence context ends after each entity manager invocation and you never will have a chance to fetch the collection elements (unless as you found, you switch to using EAGER fetching). 

               

              Case 2, is when there is an active JTA transaction.  The persistence context ends after the JTA transaction completes.  You can fetch the collection elements only inside of the active JTA transaction (unless you switch to using EAGER fetching).

               

               

              b69 wrote:

               

              Beside, it's hard to port from glassfish to AS7! The application runs smoth without error on glassfish, but until now I get a crash on AS7 almost on every klick! (ejb concurrent access time out, next to look after, etc.)  I'm really just starting!

               

              Can you try again with the lastest (AS 7.1.1 or nightly build).  If the ejb concurrent access timeout still happens, please open a forum post with what you know so far).  Reference this post for additional context.

               

              Scott

              • 4. Re: org.hibernate.LazyInitializationException
                b69

                I'm working in a stateful bean, but intentionaly I have not foreseen extended persistence. So case 2 applies, which requires EAGER fetching. I can live with that, because the amount of additional data is small enough to have no impact on loading time. So for the given case rather the default behaviour of glassfish was a surprise, even knowing the fact, that fetching type is no more than a hint.

                 

                w.r.t concurrent access time out, I'm already working with AS 7.1.1. Now, at this same moment I'm downloading Build #817. I'm courious about the outcome.

                • 5. Re: org.hibernate.LazyInitializationException
                  b69

                  I tried with build B#817 and I got the concurrent access time out as before. See trace. Any hint is really appreciated.

                  Its an AJAX-call from a tab change. before validation happened. I left just the last log entry of it. (Tabs are used to present several text entry fields. On a tab change the content of the text fied is persisted in the database through the mentioned ajax call, see the logging entries:

                   

                  08:49:45,825 FEIN  [ch.commcity.monterosa.web.validate] (http-localhost-127.0.0.1-8080-2) MaxSizeValidator#isValid() outcome TRUE

                  08:49:45,840 FEIN  [ch.commcity.monterosa.web] (http-localhost-127.0.0.1-8080-2) ProjectHandler#handelTabChange entered

                  08:49:50,880 ERROR [org.jboss.ejb3.invocation] (http-localhost-127.0.0.1-8080-2) JBAS014134: EJB Invocation failed on component ProjectBean for method public abstract ch.commcity.monterosa.entities.Project ch.commcity.monterosa.ejb.Projects.persist(ch.commcity.monterosa.entities.Project) throws ch.commcity.monterosa.ejb.exceptions.BusinessPersistencyException: javax.ejb.ConcurrentAccessTimeoutException: JBAS014360: EJB 3.1 FR 4.3.14.1 concurrent access timeout on org.jboss.invocation.InterceptorContext@3cfcde5a - could not obtain lock within 5000 MILLISECONDS

                      at org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:117) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.stateful.StatefulComponentInstanceInterceptor.processInvocation(StatefulComponentInstanceInterceptor.java:66) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:42) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.stateful.StatefulComponentIdInterceptor.processInvocation(StatefulComponentIdInterceptor.java:52) [jboss-as-ejb3-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                      at ch.commcity.monterosa.ejb.Projects$$$view6.persist(Unknown Source) [MonteRosaEJB-00.03.02-SNAPSHOT.jar:]

                      at ch.commcity.monterosa.web.ProjectHandler.internalSave(ProjectHandler.java:906)

                      at ch.commcity.monterosa.web.ProjectHandler.handleTabChange(ProjectHandler.java:181)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_31]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_31]

                      at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]

                      at org.apache.el.parser.AstValue.invoke(AstValue.java:262)

                      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)

                      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)

                      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)

                      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)

                      at javax.faces.component.UICommand.broadcast(UICommand.java:315)

                      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)

                      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)

                      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)

                      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

                      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

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

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

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

                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

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

                      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397)

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

                      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

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

                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

                      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)

                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

                   

                  08:49:57,293 FEIN  [ch.commcity.monterosa.ejb.impl] (http-localhost-127.0.0.1-8080-3) actualize got rows from db: 1

                  08:49:57,293 FEIN  [ch.commcity.monterosa.web] (http-localhost-127.0.0.1-8080-3) ProjectHandler# actualize count of projects found: 1

                  08:53:02,825 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: javax.resource.ResourceException: Could not create connection

                      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)

                      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)

                      at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:761) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.fillToMin(SemaphoreArrayListManagedConnectionPool.java:706) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

                  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_31]

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_31]

                      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_31]

                      at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_31]

                      at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

                      at com.mysql.jdbc.Util.getInstance(Util.java:386)

                      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)

                      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)

                      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)

                      at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1128)

                      at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2336)

                      at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)

                      at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)

                      at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)

                      at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

                      at sun.reflect.GeneratedConstructorAccessor19.newInstance(Unknown Source) [:1.6.0_31]

                      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_31]

                      at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_31]

                      at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

                      at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)

                      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)

                      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)

                      ... 5 more

                  • 6. Re: org.hibernate.LazyInitializationException
                    b69

                    Maybe it's helpful to see the same action log trace from glassfish:

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|ch.commcity.monterosa.web.validate|_ThreadID=25;_ThreadName=http-thr

                    ead-pool-8090(2);ClassName=ch.commcity.monterosa.web.validate.MaxSizeValidator;MethodName=isValid;|MaxSizeValidator#isVa

                    lid() outcome TRUE|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|ch.commcity.monterosa.web|_ThreadID=25;_ThreadName=http-thread-pool-

                    8090(2);ClassName=ch.commcity.monterosa.web.ProjectHandler;MethodName=handleTabChange;|ProjectHandler#handelTabChange en

                    tered|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=25;_ThreadName=http-thread-pool-8090(2);ClassName=com.sun.ejb.containers.BaseContainer;MethodName=preInvoke;|Entering

                    BaseContainer::preInvoke : EjbInvocation  componentId=MonteRosaApp_MonteRosaEJB-00.03.03-SNAPSHOT.jar_ProjectBean_87393

                    910880796673,isLocal=true,isRemote=false,isBusinessInterface=true,isWebService=false,isMessageDriven=false,isHome=false,

                    clientInterface=interface ch.commcity.monterosa.ejb.Projects,method=public abstract ch.commcity.monterosa.entities.Proje

                    ct ch.commcity.monterosa.ejb.Projects.persist(ch.commcity.monterosa.entities.Project) throws ch.commcity.monterosa.ejb.e

                    xceptions.BusinessPersistencyException,ejb=null,exception=null,exceptionFromBeanMethod=null,invId=0,wasCancelCalled=fals

                    e,yetToSubmitStatus=true|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.org.glassfish.ejb.security.app

                    lication|_ThreadID=25;_ThreadName=http-thread-pool-8090(2);ClassName=org.glassfish.ejb.security.application.EJBSecurityM

                    anager;MethodName=authorize;|JACC: permission initialized in InvocationInfo: EJBMethodPermission (Name) = ProjectBean (A

                    ction) = persist,Local,ch.commcity.monterosa.entities.Project|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.org.glassfish.ejb.security.app

                    lication|_ThreadID=25;_ThreadName=http-thread-pool-8090(2);ClassName=org.glassfish.ejb.security.application.EJBSecurityM

                    anager;MethodName=authorize;|JACC: Access Control Decision Result: true EJBMethodPermission (Name) = ProjectBean (Action

                    ) = persist,Local,ch.commcity.monterosa.entities.Project (Caller) = null|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=25;_ThreadName=http-thread-pool-8090(2);ClassName=com.sun.ejb.containers.StatefulSessionContainer;MethodName=logTrace

                    Info;|sfsb-ProjectBean: Trying to get context for persist; key: a090bfe100a81f-7c60c02a-4|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=25;_ThreadName=http-thread-pool-8090(2);ClassName=com.sun.ejb.containers.StatefulSessionContainer;MethodName=logTrace

                    Info;|sfsb-ProjectBean: Got Context!! for persist; key: ProjectBean; id: a090bfe100a81f-7c60c02a-4|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.org.glassfish.ejb.security.app

                    lication|_ThreadID=25;_ThreadName=http-thread-pool-8090(2);ClassName=org.glassfish.ejb.security.application.EJBSecurityM

                    anager;MethodName=resetPolicyContext;|JACC: Changing Policy Context ID: oldV = MonteRosaApp/MonteRosaJSF-00_03_03-SNAPSH

                    OT_war newV = MonteRosaApp/MonteRosaEJB-00_03_03-SNAPSHOT_jar|#]

                     

                    [#|2012-04-04T10:12:48.989+0200|FINE|glassfish3.1.2|ch.commcity.monterosa.ejb.impl|_ThreadID=25;_ThreadName=http-thread-

                    pool-8090(2);ClassName=ch.commcity.monterosa.ejb.impl.ProjectBean;MethodName=persist;|ProjectBean#persist enteredBCC21-8

                    8|#]

                     

                    [#|2012-04-04T10:12:49.004+0200|FINE|glassfish3.1.2|org.eclipse.persistence.session.file:/D:/programs/glassfish/glassfis

                    h/domains/domain1/eclipseApps/MonteRosaApp/MonteRosaEJB-00.03.03-SNAPSHOT_jar/_MonteRosaEJB.sql|_ThreadID=25;_ThreadName

                    =http-thread-pool-8090(2);ClassName=null;MethodName=null;|UPDATE PROJECTS SET MODIFIED_BY = ?, VERSION = ? WHERE ((ID =

                    ?) AND (VERSION = ?))|#]

                     

                    [#|2012-04-04T10:12:49.004+0200|FINE|glassfish3.1.2|org.eclipse.persistence.session.file:/D:/programs/glassfish/glassfis

                    h/domains/domain1/eclipseApps/MonteRosaApp/MonteRosaEJB-00.03.03-SNAPSHOT_jar/_MonteRosaEJB.sql|_ThreadID=25;_ThreadName

                    =http-thread-pool-8090(2);ClassName=null;MethodName=null;|    bind => [4 parameters bound]|#]

                     

                    [#|2012-04-04T10:12:49.005+0200|FINE|glassfish3.1.2|org.eclipse.persistence.session.file:/D:/programs/glassfish/glassfis

                    h/domains/domain1/eclipseApps/MonteRosaApp/MonteRosaEJB-00.03.03-SNAPSHOT_jar/_MonteRosaEJB.sql|_ThreadID=25;_ThreadName

                    =http-thread-pool-8090(2);ClassName=null;MethodName=null;|SELECT ID, BACKGROUND, CREATED, CREATED_BY, FREE_PARA, FREE_PA

                    RA_TITLE, GOAL_DESCR, MGMT_SUMMARY, MODIFIED, MODIFIED_BY, NAME, PROJ_ID, PROSPECT, STATUS, VERSION FROM PROJECTS WHERE

                    (ID = ?)

                        bind => [1 parameter bound]|#]

                     

                    [#|2012-04-04T10:12:49.005+0200|FINE|glassfish3.1.2|org.eclipse.persistence.session.file:/D:/programs/glassfish/glassfis

                    h/domains/domain1/eclipseApps/MonteRosaApp/MonteRosaEJB-00.03.03-SNAPSHOT_jar/_MonteRosaEJB.sql|_ThreadID=25;_ThreadName

                    =http-thread-pool-8090(2);ClassName=null;MethodName=null;|SELECT ID, CREATED, CREATED_BY, FIRST_NAME, MIDDLE, NAME, PROJ

                    ECT_ROLE, VERSION, PROJECT_FK FROM STAKEHOLDERS WHERE (PROJECT_FK = ?)

                        bind => [1 parameter bound]|#]

                     

                    [#|2012-04-04T10:12:49.005+0200|FINE|glassfish3.1.2|ch.commcity.monterosa.ejb.impl|_ThreadID=25;_ThreadName=http-thread-

                    pool-8090(2);ClassName=ch.commcity.monterosa.ejb.impl.ProjectBean;MethodName=replicate;|ProjectBean#replicate managing n

                    ow BCC21-88|#]

                     

                    [#|2012-04-04T10:12:49.005+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.org.glassfish.ejb.security.app

                    lication|_ThreadID=25;_ThreadName=http-thread-pool-8090(2);ClassName=org.glassfish.ejb.security.application.EJBSecurityM

                    anager;MethodName=resetPolicyContext;|JACC: Changing Policy Context ID: oldV = MonteRosaApp/MonteRosaEJB-00_03_03-SNAPSH

                    OT_jar newV = MonteRosaApp/MonteRosaJSF-00_03_03-SNAPSHOT_war|#]

                     

                    [#|2012-04-04T10:12:49.005+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=25;_ThreadName=http-thread-pool-8090(2);ClassName=com.sun.ejb.containers.StatefulSessionContainer;MethodName=logTrace

                    Info;|sfsb-ProjectBean: Released context for key: a090bfe100a81f-7c60c02a-4; 211553883|#]

                     

                    [#|2012-04-04T10:12:49.021+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=25;_ThreadName=http-thread-pool-8090(2);ClassName=com.sun.ejb.containers.BaseContainer;MethodName=postInvoke;|Leaving

                    BaseContainer::postInvoke : EjbInvocation  componentId=MonteRosaApp_MonteRosaEJB-00.03.03-SNAPSHOT.jar_ProjectBean_8739

                    3910880796673,isLocal=true,isRemote=false,isBusinessInterface=true,isWebService=false,isMessageDriven=false,isHome=false

                    ,clientInterface=interface ch.commcity.monterosa.ejb.Projects,method=public abstract ch.commcity.monterosa.entities.Proj

                    ect ch.commcity.monterosa.ejb.Projects.persist(ch.commcity.monterosa.entities.Project) throws ch.commcity.monterosa.ejb.

                    exceptions.BusinessPersistencyException,ejb=ch.commcity.monterosa.ejb.impl.ProjectBean@59727ed4,exception=null,exception

                    FromBeanMethod=null,invId=0,wasCancelCalled=false,yetToSubmitStatus=true|#]

                     

                    [#|2012-04-04T10:12:57.195+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers.util.ca

                    che|_ThreadID=27;_ThreadName=__ejb-thread-pool1;ClassName=com.sun.ejb.containers.util.cache.LruSessionCache;MethodName=t

                    rimUnSortedTimedoutItems;|[NRU-ch.commcity.monterosa.ejb.impl.ProjectBean]: TrimUnsortedTimedoutBeans started...|#]

                     

                    [#|2012-04-04T10:12:57.195+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers.util.ca

                    che|_ThreadID=27;_ThreadName=__ejb-thread-pool1;ClassName=com.sun.ejb.containers.util.cache.LruSessionCache;MethodName=t

                    rimUnSortedTimedoutItems;|[NRU-ch.commcity.monterosa.ejb.impl.ProjectBean]: TrimUnsortedTimedoutBeans  finished after re

                    moving 0 idle beans|#]

                     

                    [#|2012-04-04T10:12:57.274+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers.util.ca

                    che|_ThreadID=28;_ThreadName=__ejb-thread-pool2;ClassName=com.sun.ejb.containers.util.cache.LruSessionCache;MethodName=t

                    rimUnSortedTimedoutItems;|[NRU-ch.commcity.monterosa.ejb.impl.RequirementBean]: TrimUnsortedTimedoutBeans started...|#]

                     

                    [#|2012-04-04T10:12:57.274+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers.util.ca

                    che|_ThreadID=28;_ThreadName=__ejb-thread-pool2;ClassName=com.sun.ejb.containers.util.cache.LruSessionCache;MethodName=t

                    rimUnSortedTimedoutItems;|[NRU-ch.commcity.monterosa.ejb.impl.RequirementBean]: TrimUnsortedTimedoutBeans  finished afte

                    r removing 0 idle beans|#]

                     

                    [#|2012-04-04T10:12:57.305+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=29;_ThreadName=__ejb-thread-pool3;ClassName=com.sun.ejb.containers.util.pool.NonBlockingPool;MethodName=doResize;|[Po

                    ol-LDAPclient]: Resize started at: Wed Apr 04 10:12:57 CEST 2012 steadyPoolSize ::0 resizeQuantity ::8 maxPoolSize ::32|

                    #]

                     

                    [#|2012-04-04T10:12:57.305+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=29;_ThreadName=__ejb-thread-pool3;ClassName=com.sun.ejb.containers.util.pool.NonBlockingPool;MethodName=doResize;|[Po

                    ol-LDAPclient]: Resize completed at: Wed Apr 04 10:12:57 CEST 2012; after reSize: [Pool-LDAPclient] CC=0; DC=0; CS=0; SS

                    =0; MS=32;|#]

                     

                    [#|2012-04-04T10:12:57.305+0200|FINE|glassfish3.1.2|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_Thread

                    ID=29;_ThreadName=__ejb-thread-pool3;ClassName=com.sun.ejb.containers.util.pool.NonBlockingPool;MethodName=doResize;|[Po

                    ol-LDAPclient]: Resize took: 0.0 seconds.|#]

                    • 7. Re: org.hibernate.LazyInitializationException
                      nickelback

                      Hi,

                       

                      i am using hibernate 4.0 . although my code is able to do the task  but it is showing that  method buildSessionFactory() is depricated.

                       

                      Can someone help with that..???

                       

                      any help that will be really appricated.

                      • 8. Re: org.hibernate.LazyInitializationException
                        smarlow

                        Mukesh,

                         

                        Try starting a new discussion here.

                         

                        Scott

                        • 9. Re: org.hibernate.LazyInitializationException
                          smarlow

                          Is the application running under load or just a single user hitting the system?

                           

                          I'm looking into the 5 second access timeout, I'm not sure what that is about yet.

                           

                          About the "too many connections" error.  MySQL is configured to allow fewer database connections than the application is trying to use.  You probably need to either increase the number of MYSQL connections allowed or reduce the number of connections attempted to be used in your (AS7) datasource definition.

                           

                          Scott

                          1 of 1 people found this helpful
                          • 10. Re: org.hibernate.LazyInitializationException
                            smarlow

                            It looks like you are getting the default javax.ejb.AccessTimeout which is 5 seconds.  The default AccessTimeout can be increased in the as7/standalone/configuration/standalone.xml.  See the following section in this file:

                             

                             

                            <subsystem xmlns="urn:jboss:domain:ejb3:1.3">
                                <session-bean>
                                <stateless>
                                    <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
                                </stateless>
                                <stateful default-access-timeout="5000" cache-ref="simple"/>
                                <singleton default-access-timeout="5000"/>
                                </session-bean>
                                <pools>
                                <bean-instance-pools>
                                    <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                                    <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                                </bean-instance-pools>
                                </pools>
                                <caches>
                                <cache name="simple" aliases="NoPassivationCache"/>
                                <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
                                </caches>
                                <passivation-stores>
                                <file-passivation-store name="file"/>
                                </passivation-stores>
                                <async thread-pool-name="default"/>
                                <timer-service thread-pool-name="default">
                                <data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
                                </timer-service>
                                <remote connector-ref="remoting-connector" thread-pool-name="default"/>
                                <thread-pools>
                                <thread-pool name="default">
                                    <max-threads count="10"/>
                                    <keepalive-time time="100" unit="milliseconds"/>
                                </thread-pool>
                                </thread-pools>
                            </subsystem>
                            

                             

                             

                            Increase the default-access-timeout to a higher value.

                             

                            Scott

                            • 11. Re: org.hibernate.LazyInitializationException
                              b69

                              Yes Scott, You are right!

                               

                              As a newbie of AS7, I just copied the proposed pool size of 200 / 300!

                              Just me is clicking on the application, trying to make it run, so I reduced to 10 / 20. Now the tab switch works!

                               

                              One more step done! Of course, I have more problems, but those are for an other thread!

                               

                              Thanks for the help

                               

                              Juerg