Announcement Announcement Module
Collapse
No announcement yet.
Mixing JDBC and Hibernate in same DAO Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mixing JDBC and Hibernate in same DAO

    Hello,
    I know that this is old problem and many threads ahave laready discussed that i have read all that but facing a problem. I am extending my DAO from HibernateDAOSupport and have exposed the dataSource property. Everything is working fine but i am getting connection close exception. The stack trace is as (using spring 1.1 Rc 2, Hibernate 2.1.6, JBoss 3.2.3, I am using SLSB + EJB CMT.
    I am getting following exception of connection not closing

    12:39:37,071 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@ 17e53c9

    java.lang.Exception: STACKTRACE

    at org.jboss.resource.connectionmanager.CachedConnect ionManager.registerConnection(CachedConnectionMana ger.java:282)

    at org.jboss.resource.connectionmanager.BaseConnectio nManager2.allocateConnection(BaseConnectionManager 2.java:506)

    at org.jboss.resource.connectionmanager.BaseConnectio nManager2$ConnectionManagerProxy.allocateConnectio n(BaseConnectionManager2.java:814)

    at org.jboss.resource.adapter.jdbc.WrapperDataSource. getConnection(WrapperDataSource.java:102)

    at org.springframework.orm.hibernate.LocalDataSourceC onnectionProvider.getConnection(LocalDataSourceCon nectionProvider.java:66)

    at net.sf.hibernate.impl.BatcherImpl.openConnection(B atcherImpl.java:286)

    at net.sf.hibernate.impl.SessionImpl.connect(SessionI mpl.java:3326)

    at net.sf.hibernate.impl.SessionImpl.connection(Sessi onImpl.java:3286)

    at net.sf.hibernate.impl.BatcherImpl.prepareStatement (BatcherImpl.java:61)

    at net.sf.hibernate.impl.BatcherImpl.prepareStatement (BatcherImpl.java:56)

    at net.sf.hibernate.impl.BatcherImpl.prepareBatchStat ement(BatcherImpl.java:109)

    at net.sf.hibernate.persister.EntityPersister.insert( EntityPersister.java:460)

    at net.sf.hibernate.persister.EntityPersister.insert( EntityPersister.java:439)

    at net.sf.hibernate.impl.ScheduledInsertion.execute(S cheduledInsertion.java:29)

    at net.sf.hibernate.impl.SessionImpl.executeAll(Sessi onImpl.java:2418)

    at net.sf.hibernate.impl.SessionImpl.execute(SessionI mpl.java:2371)

    at net.sf.hibernate.impl.SessionImpl.flush(SessionImp l.java:2240)

    at com.sequelsys.server.common.dao.TestDAO$1.doInHibe rnate(TestDAO.java:81)

    at org.springframework.orm.hibernate.HibernateTemplat e.execute(HibernateTemplate.java:176)

    at com.sequelsys.server.common.dao.TestDAO.insert(Tes tDAO.java:101)

    at com.shoaib.ejb.session.TestingTransactionSessionBe an.save(TestingTransactionSessionBean.java:38)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:324)

    at org.jboss.ejb.StatelessSessionContainer$ContainerI nterceptor.invoke(StatelessSessionContainer.java:6 83)

    at org.jboss.resource.connectionmanager.CachedConnect ionInterceptor.invoke(CachedConnectionInterceptor. java:185)

    at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:72)

    at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:84)

    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:267)

    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:128)

    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:118)

    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)

    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)

    at org.jboss.ejb.StatelessSessionContainer.internalIn voke(StatelessSessionContainer.java:331)

    at org.jboss.ejb.Container.invoke(Container.java:700)

    at org.jboss.ejb.plugins.local.BaseLocalProxyFactory. invoke(BaseLocalProxyFactory.java:375)

    at org.jboss.ejb.plugins.local.StatelessSessionProxy. invoke(StatelessSessionProxy.java:83)

    at $Proxy35.save(Unknown Source)

    at com.shoaib.ejb.session.facade.session.ApplicationF acadeSessionBean.saveTest(ApplicationFacadeSession Bean.java:62)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:324)

    at org.jboss.ejb.StatelessSessionContainer$ContainerI nterceptor.invoke(StatelessSessionContainer.java:6 83)

    at org.jboss.resource.connectionmanager.CachedConnect ionInterceptor.invoke(CachedConnectionInterceptor. java:185)

    at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:72)

    at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:84)

    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:267)

    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:128)

    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:118)

    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)

    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)

    at org.jboss.ejb.StatelessSessionContainer.internalIn voke(StatelessSessionContainer.java:331)

    at org.jboss.ejb.Container.invoke(Container.java:700)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:324)

    at org.jboss.mx.capability.ReflectedMBeanDispatcher.i nvoke(ReflectedMBeanDispatcher.java:284)

    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:546)

    at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:367)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:324)

    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)

    at sun.rmi.transport.Transport$1.run(Transport.java:1 48)

    at java.security.AccessController.doPrivileged(Native Method)

    at sun.rmi.transport.Transport.serviceCall(Transport. java:144)

    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)

    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)

    at java.lang.Thread.run(Thread.java:534)


    My DAO is as follows.
    -------------
    DAO
    ---------------
    Code:
    package com.sequelsys.server.common.dao;
    
    import javax.sql.*;
    
    import org.springframework.jdbc.core.*;
    import org.springframework.jdbc.oracle.*;
    import org.springframework.orm.hibernate.*;
    import airline.hibernate.*;
    import net.sf.hibernate.*;
    import org.springframework.orm.hibernate.support.HibernateDaoSupport;
    
    public class TestDAO extends HibernateDaoSupport{
      private DataSource dataSource;
      public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
      }
    
      public DataSource getDataSource() {
        return dataSource;
      }
    
      public TestDAO() {
      }
     
     
      public void insert()
     {
    
       HibernateCallback hibernateCallback = new HibernateCallback() {
         public Object doInHibernate(Session session) {
           try {
             session.flush();
           }
           catch (HibernateException ex) {
             ex.printStackTrace();
           }
           return null;
         }
    
       };
       Test test = new Test();
             test.setId(new Long("18"));
             test.setName("BS");
       this.getHibernateTemplate().save(test);
       Test test2 = new Test();
             test2.setId(new Long("19"));
             test2.setName("BS");
       this.getHibernateTemplate().save(test2);
       this.getHibernateTemplate().execute(hibernateCallback);    // To flush the session so that jdbc can see this
       JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource);
       System.out.println((jdbcTemplate.queryForInt("SELECT COUNT(*) FROM test")));
       System.out.println("Running Update" );
       jdbcTemplate.update("Update Test set name='Benzi' where id = 18");
       jdbcTemplate.update("delete from test where id = 18");
       System.out.println((jdbcTemplate.queryForInt("SELECT COUNT(*) FROM test")));
       System.out.println("Ran Update" ); 
      
     }
    }

    and applicationContetx is as follows
    ---------
    Code:
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "file&#58;///C&#58;/jboss-3.2.3/server/default/lib/spring-beans.dtd">
    <!--Application context definition for EMR Relase 1.0 maintained by Shoaib on Hibernate.--><beans>
          <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName"><value>java&#58;/OracleDS</value></property>
    	</bean>
    
    	<!-- Hibernate SessionFactory -->
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    		<property name="dataSource"><ref local="dataSource" /></property>
    		<!-- Mapping Resources for Hibernate Session Factory &#40;Specify the hbm.xml to be used here&#41; -->
                    <property name="mappingResources">
                      <list>
                        <value>airline/hibernate/Test.hbm.xml</value>
                      </list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    			  <prop key="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop>
                              <prop key="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</prop>
                              <prop key="hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</prop>
                              <prop key="hibernate.show_sql">true</prop>
                              <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
                            </props>
    		</property>
    	</bean>
    	<!-- Transaction manager for a single Hibernate SessionFactory &#40;alternative to JTA&#41; -->
    	<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
    		<property name="sessionFactory"><ref local="sessionFactory" /></property>
                   <property name="dataSource"><ref local="dataSource" /></property>
    	</bean>
            <!-- Refereces of DAOs to be used by Session beans-->
          <bean id="testDAO" class="com.sequelsys.server.common.dao.TestDAO" autowire="byName" />
    </beans>
    If i only use one of them (hibernatetemplate or jdbctemplate) i get no exception at all. Though this exception is coming all other things are working kindly help me asap.

  • #2
    Re,

    Hello,
    I just want to add that i also tried one class from Rod's Reply to similiar question on the previos forum but everything is fine but i am getting connection closing exception. Just want to mention i am using Oracle 9i,JBoss 3.2.3, Hibernate 2.1.6 and SLSB + EJB+CMT. Please also verify this class should i use that or not?

    Code:
    package org.springframework.jdbc.oracle;
    
    import javax.sql.*;
    
    import org.apache.commons.logging.*;
    import org.springframework.jdbc.core.*;
    import org.springframework.orm.hibernate.*;
    import net.sf.hibernate.*;
    
    public abstract class JdbcHibernateDaoSupport &#123;
      protected final Log logger = LogFactory.getLog&#40;getClass&#40;&#41;&#41;;
      private HibernateTemplate hibernateTemplate;
      private JdbcTemplate jdbcTemplate;
      private DataSource dataSource;
      private SessionFactory sessionFactory;
      public void setDataSource&#40;DataSource dataSource&#41; &#123;
        this.dataSource = dataSource;
        this.jdbcTemplate = new JdbcTemplate&#40;this.dataSource&#41;;
      &#125;
    
      public void setSessionFactory&#40;SessionFactory sessionFactory&#41; &#123;
        this.sessionFactory = sessionFactory;
        this.hibernateTemplate = new HibernateTemplate&#40;this.sessionFactory&#41;;
      &#125;
    
      public HibernateTemplate getHibernateTemplate&#40;&#41; &#123;
        return hibernateTemplate;
      &#125;
    
      public JdbcTemplate getJdbcTemplate&#40;&#41; &#123;
        return jdbcTemplate;
      &#125;
    
      public SessionFactory getSessionFactory&#40;&#41; &#123;
        return sessionFactory;
      &#125;
    
      public DataSource getDataSource&#40;&#41; &#123;
        return dataSource;
      &#125;
    
      public void flushHibernate&#40;&#41; &#123;
        HibernateCallback hibernateCallback = new HibernateCallback&#40;&#41; &#123;
          public Object doInHibernate&#40;Session session&#41; &#123;
            try &#123;
              session.flush&#40;&#41;;
            &#125;
            catch &#40;HibernateException ex&#41; &#123;
              ex.printStackTrace&#40;&#41;;
            &#125;
            return null;
          &#125;
        &#125;;
       hibernateTemplate.execute&#40;hibernateCallback&#41;;
      &#125;
    
    &#125;

    Comment


    • #3
      Re

      Hello,
      I think it should be a bug in spring. The possible cause is that when that both jdbcTemplate and hibernateTempalte have dependencies on the connection and both have some kmind of deadlock due to which they cannot close connection. It is connnection leakage problem beacuse i do not tjink that using jdbc and hibernate in one method is wrong as requirementts may enforce that. A suggestion is that Spring framework may provide a super class itself which combines HibernateDAOSupport and JDBCDAOSupport such as JdbcHibernateDAOSupport it will be very convinioent for user. In the meantime please help me ragrding this connection leakage problem.

      Comment


      • #4
        I used to get this myself in my old app.

        I spent a lot of time (hours) tracing through both Spring and even JBoss code to try to find out what was going on, and as far as I can tell JBoss's connection manager is simply confused in the face of usage of the connection from multiple sources. Spring properly obtained and released all resources. In the case of the message about releasing the connection yourself, Spring did in fact already release the connection. There is another case where JBoss complained about a connection being unknown on a release call. Same deal here, it was a valid connection. JBoss is simply buggy, as far as I can tell.

        If you can provide a test case that shows this behaviour happening, and ideally put it up on Jira, then I can spend some more time trying to duplicate it. The ejbtest integration sample in our CVS unfortunately doesn't display this behaviour with JBoss, so I don't have any way to duplicate this right now...

        Comment


        • #5
          Re,

          Hello,
          Thanks Colin for your answer i will put up all the things u mentioned possibly tommorrow. In the meantime please tell me that is doing so is right?
          Code:
          package org.springframework.jdbc.oracle;
          
          import javax.sql.*;
          
          import org.apache.commons.logging.*;
          import org.springframework.jdbc.core.*;
          import org.springframework.orm.hibernate.*;
          import net.sf.hibernate.*;
          
          public abstract class JdbcHibernateDaoSupport &#123;
            protected final Log logger = LogFactory.getLog&#40;getClass&#40;&#41;&#41;;
            private HibernateTemplate hibernateTemplate;
            private JdbcTemplate jdbcTemplate;
            private DataSource dataSource;
            private SessionFactory sessionFactory;
            public void setDataSource&#40;DataSource dataSource&#41; &#123;
              this.dataSource = dataSource;
              this.jdbcTemplate = new JdbcTemplate&#40;this.dataSource&#41;;
            &#125;
          
            public void setSessionFactory&#40;SessionFactory sessionFactory&#41; &#123;
              this.sessionFactory = sessionFactory;
              this.hibernateTemplate = new HibernateTemplate&#40;this.sessionFactory&#41;;
            &#125;
          
            public HibernateTemplate getHibernateTemplate&#40;&#41; &#123;
              return hibernateTemplate;
            &#125;
          
            public JdbcTemplate getJdbcTemplate&#40;&#41; &#123;
              return jdbcTemplate;
            &#125;
          
            public SessionFactory getSessionFactory&#40;&#41; &#123;
              return sessionFactory;
            &#125;
          
            public DataSource getDataSource&#40;&#41; &#123;
              return dataSource;
            &#125;
             /** This flushes the hibernate session associated with this transaction so changes can be viewed by jdbc code **/
            public void flushHibernate&#40;&#41; &#123;
              HibernateCallback hibernateCallback = new HibernateCallback&#40;&#41; &#123;
                public Object doInHibernate&#40;Session session&#41; &#123;
                  try &#123;
                    session.flush&#40;&#41;;
                  &#125;
                  catch &#40;HibernateException ex&#41; &#123;
                    ex.printStackTrace&#40;&#41;;
                  &#125;
                  return null;
                &#125;
              &#125;;
             hibernateTemplate.execute&#40;hibernateCallback&#41;;
            &#125;
          
          &#125;
          1- Is the above code right or not? And i use it in production? and any suggestions if i am missing sth there (want a super class for Hibernate + JDbc together)
          2- Second point i want to make is that i think that hibernateTempalte should have flush method delegating to Session.flush (The session currently bound with the running transaction) beacuse flushing the hibernate session is must if we want to show the results to jdbc. I know traht their is FlushMode.EAGEr available but i think so taht using an explict flush will be better option as sometimes due to triggers we have to refresh the prevoiusly saved object so flush may help their as well.
          3-One thing more in your sample in autobuild folder of CVS ditribution you have used
          Code:
          this.hibernateTemplate = new HibernateTemplate&#40;this.sessionFactory,false&#41;;
          Why it is necessary? And whenevr i do taht i get exception that creating session is not allowed so please make it clear.

          4- other thing i want to told you about the problem is that i face no connection leakage exception when i only use Hibernate tempalte or jdbc template.... it is only when i use both of them in one method ( by extending HibernateDAOSupport and using jdbcTempalte or viceverca or by using another class such as JdbcHibernateDAOSupport but mixing tem in my case is neccesary so your test case may be to use both jdbcTempalet and HibernateTempalte in one method of a class with extending from HibernateDAOSupport and injecting dataSource and making jdbcTempalte using taht data Source and using it in the same method or vice versa or using the class JdbcHibernateDAOSupport)

          Waiting

          Comment


          • #6
            The code looks generally ok...

            With regards to your question about why my sample code does:

            this.hibernateTemplate = new HibernateTemplate(this.sessionFactory,false)

            this is specifically because I want to catch instances where the template is not being run in a transaction like it should be. With the default allowCreate flag setting of true, if there is no thread-bound Hibernate Session already available, then the template will create one then and there, and Spring code will even ensure that it is bound to any wrappig transaction if it exists. The problem is that it also means that if there is no wrapping transaction, you end up running non-transactionally, and have a new Session for every use of HibernateTemplate, not what most people want. I simply prefer to use either HibernateTransactionManager or JTATransactionManager+HibernateInterceptor, both of which should ensure that a thread bound Session is already created ahead of time with the transaciton, and then not allow the template to create the Session itself. Then an error such as the one you are getting is an indication that in fact the code is not running inside a transaction, as there is no thread bound session available.

            This is assuming of course that your Hibernate code is always going to run in a transaction, which is a good thing I think...

            Comment


            • #7
              Re,

              Hello,
              Thanks Colin for reply. I tested my code by many ways and it appears to run in transaction. I did not get one point, i am using HibernateTransactionManger
              and hibernate is using jta as you can see in above xml file, so in this case should i pass false in base class to HibernateTempalte Constructor or not. Secondly can u tell the other way JTaTransactionManager + HibernateInterceptor how to do that. And thirdly you did not answer my second question about the flush method. As i told you , u can test the case i mentioned easily by using my base class (JdbcHibernateDAOSupprt) and use both jdbc and hibernate in single method. Please help me asap i am very thankful to you

              Comment


              • #8
                If you are using HibernateTransactionManager, then along with creating a transaction, it will have ensured that a Session is bound to the current thread and trasnaction. If your allowCreate flag on the template is off with this config, and you get an exception, it means you are not in a Spring managed transaction, end of story, as a transaction would have created a Session already...

                To use JTATransactionManager+HibernateInterceptor, just specify JTATransactionManager as the Spring transaction manager, and specify HibernateIntercetor as a postInterceptor. The HibernateInterceptor just ensures a Hibernate Session is bound to the thread/transaction eagerly (same as if you used HibernateTransactionManager directly). Again, if you use JTATransactionManager+HibernateInterceptor, you can turn off the allowCreate flag in the template, since the transaction should have caused the Session to be created. This is all assuming your Hibernate code will always run transactionally.

                If you use EJBs and CMT (Container Managed Transactions) with JTA, but no Spring Transactions, then you will have to leave the allowCreate flag set at true, since there will be no other Spring transaction code to tie eager Session creation to.

                As for the flush, it could be added to the template. However, I'm not so sure it's an appropriate method, given the fact that it is almost always associated with other code. While it would be indeed useful when used with an existing thread-bound Session, it would be completely useless (superfluous rather) on the other hand in the case where there is no already existing thread bound session (or tx to bind new session to), since in that case the template will create and destroy the session for each operation, and the destroy will force a flush anyways. Admittedly, most poeple do not use the template that way...

                Comment


                • #9
                  Re

                  Hello Colin,
                  Once again many many thanks for your reply, that is so kind of you. I am using EJB + CMT .I understood the flush part. But a bit confused about passing true or false to sessionfactory.create method as i am using HibernateTransactionManager, and in hibernate properties i am pointing towards JTA. My application-context.xml is as follows. In this case should i pass allowcreate false or true.
                  Code:
                  <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "file&#58;///C&#58;/jboss-3.2.3/server/default/lib/spring-beans.dtd">
                  <!--Application context definition for EMR Relase 1.0 maintained by Shoaib on Hibernate.--><beans>
                        <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
                        <property name="jndiName"><value>java&#58;/OracleDS</value></property>
                     </bean>
                  
                     <!-- Hibernate SessionFactory -->
                     <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
                        <property name="dataSource"><ref local="dataSource" /></property>
                        <!-- Mapping Resources for Hibernate Session Factory &#40;Specify the hbm.xml to be used here&#41; -->
                                  <property name="mappingResources">
                                    <list>
                                      <value>airline/hibernate/Test.hbm.xml</value>
                                    </list>
                        </property>
                        <property name="hibernateProperties">
                           <props>
                             <prop key="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop>
                                            <prop key="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</prop>
                                            <prop key="hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</prop>
                                            <prop key="hibernate.show_sql">true</prop>
                                            <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
                                          </props>
                        </property>
                     </bean>
                     <!-- Transaction manager for a single Hibernate SessionFactory &#40;alternative to JTA&#41; -->
                     <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
                        <property name="sessionFactory"><ref local="sessionFactory" /></property>
                                 <property name="dataSource"><ref local="dataSource" /></property>
                     </bean>
                          <!-- Refereces of DAOs to be used by Session beans-->
                        <bean id="testDAO" class="com.sequelsys.server.common.dao.TestDAO" autowire="byName" />
                  </beans>
                  I will be very grateful to you kindly reply for the above configuration

                  Comment


                  • #10
                    Shoaib,

                    The javadocs for the allowCreate flag are explicit, and I have already told you twice in this thread. If you set the flag to false, then the Session must already exist on the thread as a result of something else putting it there. If you know for sure that you will always be in a spring transaction managed by HibernateTransactionManager or JTATransacitonMaanger+HibernateInterceptor, those two will ensure that in fact a Session is pre-bound. In this case, setting the flag to false will allow you to catch cases where you think you are running in a spring transaction, but are not, because you haven't wrapped your services properly or for whatever reason.

                    If in your case you are getting the exception even though you are using HibernateTransactionManger, then you are not in a spring managed transaction. But you mentioned using CMT, so if you are calling this code from a CMT managed EJB, then you are probably in a CMT transaction.

                    Nobody is forcing you to use both CMT and Spring managed transacitons by the way. If you just want to use CMT, don't use a Spring transaction manager at all, make sure that the hibernate JTALookup is set up properly, and leave the allowCreate flag as set to true so that the first time a session is needed by the template it can create it, which will then bind to the JTA transaction and thread. Alternately, you can stop using CMT, and just use Spring transactions. Using CMT+Spring tx can be useful to mix and match transactional EJBs and service objects, but it complicates things if you don't need it.

                    Comment


                    • #11
                      JBoss closing connection

                      Originally posted by Colin Sampaleanu
                      I used to get this myself in my old app.

                      ... JBoss is simply buggy, as far as I can tell.

                      If you can provide a test case that shows this behaviour happening, and ideally put it up on Jira, then I can spend some more time trying to duplicate it. The ejbtest integration sample in our CVS unfortunately doesn't display this behaviour with JBoss, so I don't have any way to duplicate this right now...
                      (http://article.gmane.org/gmane.comp....ork.devel/2935)

                      I have similar problem, but the funny thing is that this only happens when I log in. All next request are working normaly. I don't see how login is any different that other requests, since I use the same DAO object. Ok, this is the first time new HTTPSession is introduced, is this relevant?

                      I am using OpenSessionInViewInterceptor and local SLSB with CMT.
                      JBoss 3.2.6, Hibernate 2.1.5, Spring 1.1.

                      My DAO is transactioned with JtaTransactionManager and HibernateInterceptor.

                      If you just want to use CMT, don't use a Spring transaction manager at all, make sure that the hibernate JTALookup is set up properly,
                      Ok, but when I'm using this approach this happens:
                      http://forum.springframework.org/viewtopic.php?t=67

                      Thanx for any help,
                      kind regards,
                      Ales


                      ------- exception stack trace ------------

                      2004-10-19 11:44:14,171 DEBUG [org.springframework.web.servlet.DispatcherServlet] DispatcherServlet with name 'egida' received request for [/egida/login.htm]
                      2004-10-19 11:44:14,171 DEBUG [org.springframework.web.servlet.DispatcherServlet] Testing handler map [org.springframework.web.servlet.handler.SimpleUrlH andlerMapping@7262b6] in DispatcherServlet with name 'egida'
                      2004-10-19 11:44:14,171 DEBUG [org.springframework.web.servlet.handler.SimpleUrlH andlerMapping] Looking up handler for [/login.htm]
                      2004-10-19 11:44:14,171 DEBUG [org.springframework.orm.hibernate.support.OpenSess ionInViewInterceptor] Opening single Hibernate session in OpenSessionInViewInterceptor
                      2004-10-19 11:44:14,171 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Opening Hibernate session
                      2004-10-19 11:44:14,187 DEBUG [net.sf.hibernate.impl.SessionImpl] opened session
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Bound value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] bound to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] bound to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.web.servlet.DispatcherServlet] Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter@cac02f]
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.web.servlet.mvc.multiaction.Pr opertiesMethodNameResolver] Returning MultiActionController method name 'logHandler' for lookup path '/login.htm'
                      2004-10-19 11:44:14,187 DEBUG [com.generalynx.egida.web.controller.EgidaControlle r] Searching for user: alesj
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.ejb.access.LocalStatelessSessi onProxyFactoryBean] Trying to create reference to local EJB
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.ejb.access.LocalStatelessSessi onProxyFactoryBean] Obtained reference to local EJB: BasicSessionEJB:Stateless
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.interceptor.Transa ctionInterceptor] Getting transaction for method 'findUser' in class [com.generalynx.egida.basic.support.IBasicDAO]
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.jta.JtaTransaction Manager] Using transaction object [org.springframework.transaction.jta.JtaTransaction Object@1ec3264]
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.jta.JtaTransaction Manager] Participating in existing transaction
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Initializing transaction synchronization
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] bound to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Registering Spring transaction synchronization for existing Hibernate session
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.orm.hibernate.HibernateInterce ptor] Found thread-bound session for Hibernate interceptor
                      2004-10-19 11:44:14,187 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] bound to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,218 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] bound to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,218 DEBUG [net.sf.hibernate.impl.SessionImpl] find: select u from User u, Role r where u.username = ? and u.password = ? and r.rolename = ? and r in elements(u.roles)
                      2004-10-19 11:44:14,218 DEBUG [net.sf.hibernate.engine.QueryParameters] parameters: [alesj, ales, web]
                      2004-10-19 11:44:14,218 DEBUG [net.sf.hibernate.engine.QueryParameters] named parameters: {}
                      2004-10-19 11:44:14,281 DEBUG [net.sf.hibernate.hql.QueryTranslator] compiling query
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.hql.QueryTranslator] HQL: select u from com.generalynx.egida.basic.common.data.User u, com.generalynx.egida.basic.common.data.Role r where u.username = ? and u.password = ? and r.rolename = ? and r in elements(u.roles)
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.hql.QueryTranslator] SQL: select user0_.euser_id as euser_id, user0_.uversion as uversion, user0_.name as name, user0_.surname as surname, user0_.phone as phone, user0_.email as email, user0_.street as street, user0_.city as city, user0_.post as post, user0_.country as country, user0_.username as username, user0_.password as password, user0_.status_key as status_key, user0_.creator_id as creator_id, user0_.creation_time as creatio15_, user0_.def_module as def_module from euser user0_, erole role1_ where (user0_.username=? )and(user0_.password=? )and(role1_.rolename=? )and(role1_.erole_id in(select roles2_.erole_id from eusererole roles2_ where user0_.euser_id=roles2_.euser_id))
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.SQL] select user0_.euser_id as euser_id, user0_.uversion as uversion, user0_.name as name, user0_.surname as surname, user0_.phone as phone, user0_.email as email, user0_.street as street, user0_.city as city, user0_.post as post, user0_.country as country, user0_.username as username, user0_.password as password, user0_.status_key as status_key, user0_.creator_id as creator_id, user0_.creation_time as creatio15_, user0_.def_module as def_module from euser user0_, erole role1_ where (user0_.username=? )and(user0_.password=? )and(role1_.rolename=? )and(role1_.erole_id in(select roles2_.erole_id from eusererole roles2_ where user0_.euser_id=roles2_.euser_id))
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.type.StringType] binding 'alesj' to parameter: 1
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.type.StringType] binding 'ales' to parameter: 2
                      2004-10-19 11:44:14,343 DEBUG [net.sf.hibernate.type.StringType] binding 'web' to parameter: 3
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.loader.Loader] processing result set
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: euser_id
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.loader.Loader] result row: 1
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.loader.Loader] Initializing object from ResultSet: 1
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.loader.Loader] Hydrating entity: com.generalynx.egida.basic.common.data.User#1
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: uversion
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.type.StringType] returning 'Aleš' as column: name
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.type.StringType] returning 'j' as column: surname
                      2004-10-19 11:44:14,359 DEBUG [net.sf.hibernate.type.StringType] returning '0111111' as column: phone
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.StringType] returning '[email protected]' as column: email
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.StringType] returning 'q' as column: street
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.StringType] returning 'q' as column: city
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.IntegerType] returning 'q' as column: post
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.StringType] returning 'q' as column: country
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.StringType] returning 'alesj' as column: username
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.StringType] returning 'ales' as column: password
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: status_key
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: creator_id
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.TimestampType] returning '13 avgust 2004 10:52:04' as column: creatio15_
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: def_module
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] Version: 1
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.loader.Loader] done processing result set (1 rows)
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.BatcherImpl] closing statement
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.loader.Loader] total objects hydrated: 1
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] resolving associations for [com.generalynx.egida.basic.common.data.User#1]
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] creating collection wrapper:[com.generalynx.egida.basic.common.data.User.roles# 1]
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] creating collection wrapper:[com.generalynx.egida.basic.common.data.User.module s#1]
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] done materializing entity [com.generalynx.egida.basic.common.data.User#1]
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] initializing non-lazy collections
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] initializing collection [com.generalynx.egida.basic.common.data.User.module s#1]
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] checking second-level cache
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Cache lookup: 1
                      2004-10-19 11:44:14,375 DEBUG [net.sf.ehcache.hibernate.Plugin] key: 1
                      2004-10-19 11:44:14,375 DEBUG [net.sf.ehcache.store.MemoryStore] com.generalynx.egida.basic.common.data.User.module sCache: MemoryStore miss for 1
                      2004-10-19 11:44:14,375 DEBUG [net.sf.ehcache.Cache] com.generalynx.egida.basic.common.data.User.module s cache - Miss
                      2004-10-19 11:44:14,375 DEBUG [net.sf.ehcache.hibernate.Plugin] Element for 1 is null
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Cache miss: 1
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.SessionImpl] collection not cached
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.SQL] select modules0_.modul_id as modul_id__, modules0_.euser_id as euser_id__, module1_.modul_id as modul_id0_, module1_.name as name0_, module1_.status as status0_, module1_.parent_id as parent_id0_, module1_.description as descript5_0_, module1_.orderby as orderby0_, module1_.maction as maction0_, module1_.showHelp as showHelp0_, module2_.modul_id as modul_id1_, module2_.name as name1_, module2_.status as status1_, module2_.parent_id as parent_id1_, module2_.description as descript5_1_, module2_.orderby as orderby1_, module2_.maction as maction1_, module2_.showHelp as showHelp1_ from moduleuser modules0_ inner join modul module1_ on modules0_.modul_id=module1_.modul_id left outer join modul module2_ on module1_.parent_id=module2_.modul_id where modules0_.euser_id=?
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
                      2004-10-19 11:44:14,375 DEBUG [net.sf.hibernate.type.IntegerType] binding '1' to parameter: 1
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.loader.Loader] result set contains (possibly empty) collection: [com.generalynx.egida.basic.common.data.User.module s#1]
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.impl.SessionImpl] uninitialized collection: initializing
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.loader.Loader] processing result set
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: modul_id0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.IntegerType] returning null as column: modul_id1_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.loader.Loader] result row: 1, null
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.loader.Loader] Initializing object from ResultSet: 1
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.loader.Loader] Hydrating entity: com.generalynx.common.web.module.Module#1
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.StringType] returning 'root' as column: name0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.IntegerType] returning '-1' as column: status0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.IntegerType] returning null as column: parent_id0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.StringType] returning 'Root' as column: descript5_0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.IntegerType] returning '0' as column: orderby0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.StringType] returning null as column: maction0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.BooleanType] returning 'false' as column: showHelp0_
                      2004-10-19 11:44:14,390 DEBUG [net.sf.hibernate.type.IntegerType] returning '1' as column: euser_id__
                      ... reading user data (Module class) from 2nd level cache
                      2004-10-19 11:44:14,468 DEBUG [net.sf.ehcache.store.MemoryStore] com.generalynx.common.web.module.Module.childrenCa che: MemoryStore hit for 1
                      2004-10-19 11:44:14,468 DEBUG [net.sf.ehcache.Cache] com.generalynx.common.web.module.Module.children: Is element with key 1 expired?: false
                      2004-10-19 11:44:14,468 DEBUG [net.sf.hibernate.cache.ReadWriteCache] Cache hit: 1
                      2004-10-19 11:44:14,468 DEBUG [net.sf.hibernate.impl.SessionImpl] loading [com.generalynx.common.web.module.Module#2]
                      2004-10-19 11:44:14,468 DEBUG [net.sf.hibernate.impl.SessionImpl] attempting to resolve [com.generalynx.common.web.module.Module#2]
                      2004-10-19 11:44:14,468 DEBUG [net.sf.hibernate.impl.SessionImpl] resolved object in session cache [com.generalynx.common.web.module.Module#2]
                      2004-10-19 11:44:14,468 DEBUG [net.sf.hibernate.impl.SessionImpl] collection initialized from cache
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] bound to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.orm.hibernate.HibernateInterce ptor] Not closing pre-bound Hibernate session after interceptor
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.transaction.interceptor.Transa ctionInterceptor] Invoking commit for transaction on method 'findUser' in class [com.generalynx.egida.basic.support.IBasicDAO]
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.transaction.jta.JtaTransaction Manager] Triggering beforeCommit synchronization
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Flushing Hibernate session on transaction synchronization
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.transaction.jta.JtaTransaction Manager] Triggering beforeCompletion synchronization
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.transaction.jta.JtaTransaction Manager] Triggering afterCompletion synchronization
                      2004-10-19 11:44:14,468 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Clearing transaction synchronization
                      2004-10-19 11:44:14,468 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction before completion callback
                      2004-10-19 11:44:14,484 INFO [org.jboss.resource.connectionmanager.CachedConnect ionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@ 10f94a0
                      java.lang.Exception: STACKTRACE
                      at org.jboss.resource.connectionmanager.CachedConnect ionManager.registerConnection(CachedConnectionMana ger.java:319)
                      at org.jboss.resource.connectionmanager.BaseConnectio nManager2.allocateConnection(BaseConnectionManager 2.java:525)
                      at org.jboss.resource.connectionmanager.BaseConnectio nManager2$ConnectionManagerProxy.allocateConnectio n(BaseConnectionManager2.java:887)
                      at org.jboss.resource.adapter.jdbc.WrapperDataSource. getConnection(WrapperDataSource.java:102)
                      at net.sf.hibernate.connection.DatasourceConnectionPr ovider.getConnection(DatasourceConnectionProvider. java:59)
                      at net.sf.hibernate.impl.BatcherImpl.openConnection(B atcherImpl.java:278)
                      at net.sf.hibernate.impl.SessionImpl.connect(SessionI mpl.java:3302)
                      at net.sf.hibernate.impl.SessionImpl.connection(Sessi onImpl.java:3282)
                      at net.sf.hibernate.impl.BatcherImpl.prepareQueryStat ement(BatcherImpl.java:65)
                      at net.sf.hibernate.loader.Loader.prepareQueryStateme nt(Loader.java:704)
                      at net.sf.hibernate.loader.Loader.doQuery(Loader.java :185)
                      at net.sf.hibernate.loader.Loader.doQueryAndInitializ eNonLazyCollections(Loader.java:133)
                      at net.sf.hibernate.loader.Loader.doList(Loader.java: 958)
                      at net.sf.hibernate.loader.Loader.list(Loader.java:94 9)
                      at net.sf.hibernate.hql.QueryTranslator.list(QueryTra nslator.java:846)
                      at net.sf.hibernate.impl.SessionImpl.find(SessionImpl .java:1543)
                      at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.jav a:39)
                      at org.springframework.orm.hibernate.HibernateTemplat e$25.doInHibernate(HibernateTemplate.java:449)
                      at org.springframework.orm.hibernate.HibernateTemplat e.execute(HibernateTemplate.java:176)
                      at org.springframework.orm.hibernate.HibernateTemplat e.executeFind(HibernateTemplate.java:196)
                      at org.springframework.orm.hibernate.HibernateTemplat e.find(HibernateTemplate.java:443)
                      at com.generalynx.egida.basic.support.BasicDAOImpl.fi ndUser(BasicDAOImpl.java:107)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.springframework.aop.framework.AopProxyUtils.in vokeJoinpointUsingReflection(AopProxyUtils.java:61 )
                      at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:149)
                      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :116)
                      at org.springframework.orm.hibernate.HibernateInterce ptor.invoke(HibernateInterceptor.java:163)
                      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :138)
                      at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:56)
                      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :138)
                      at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:152)
                      at $Proxy49.findUser(Unknown Source)
                      at com.generalynx.egida.basic.ejb.BasicSessionBean.fi ndUser(BasicSessionBean.java:97)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.jboss.ejb.StatelessSessionContainer$ContainerI nterceptor.invoke(StatelessSessionContainer.java:6 83)
                      at org.jboss.resource.connectionmanager.CachedConnect ionInterceptor.invoke(CachedConnectionInterceptor. java:186)
                      at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:72)
                      at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:84)
                      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:315)
                      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:148)
                      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:111)
                      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)
                      at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
                      at org.jboss.ejb.StatelessSessionContainer.internalIn voke(StatelessSessionContainer.java:331)
                      at org.jboss.ejb.Container.invoke(Container.java:709)
                      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory. invoke(BaseLocalProxyFactory.java:419)
                      at org.jboss.ejb.plugins.local.StatelessSessionProxy. invoke(StatelessSessionProxy.java:83)
                      at $Proxy47.findUser(Unknown Source)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.springframework.ejb.access.LocalSlsbInvokerInt erceptor.invoke(LocalSlsbInvokerInterceptor.java:6 0)
                      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :138)
                      at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:152)
                      at $Proxy48.findUser(Unknown Source)
                      at com.generalynx.egida.web.controller.EgidaControlle r.logHandler(EgidaController.java:49)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.invokeNamedMethod(MultiActionC ontroller.java:352)
                      at org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.handleRequestInternal(MultiAct ionController.java:305)
                      at org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:121)
                      at org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:44)
                      at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:495)
                      at org.springframework.web.servlet.FrameworkServlet.s ervice(FrameworkServlet.java:321)
                      at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
                      at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
                      at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
                      at com.generalynx.common.filters.SessionFilter.doFilt er(SessionFilter.java:53)
                      at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
                      at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
                      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:75)
                      at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:186)
                      at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
                      at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
                      at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
                      at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
                      at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
                      at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
                      at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
                      at org.jboss.web.tomcat.security.CustomPrincipalValve .invoke(CustomPrincipalValve.java:66)
                      at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
                      at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:158)
                      at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
                      at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
                      at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
                      at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
                      at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
                      at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
                      at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
                      at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
                      at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
                      at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
                      at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
                      at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
                      at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
                      at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
                      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
                      at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
                      at java.lang.Thread.run(Thread.java:534)
                      2004-10-19 11:44:14,531 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction after completion callback, status: 3
                      2004-10-19 11:44:14,531 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
                      2004-10-19 11:44:14,609 DEBUG [com.generalynx.egida.web.object.AppStatusHolder] Users in application: 0
                      2004-10-19 11:44:14,609 DEBUG [com.generalynx.egida.web.object.AppStatusHolder] Binding info: alesj > Tue Oct 19 11:44:14 CEST 2004
                      2004-10-19 11:44:14,687 DEBUG [com.generalynx.egida.web.controller.EgidaControlle r] User Aleš Justin logged in.
                      2004-10-19 11:44:14,687 DEBUG [com.generalynx.egida.web.interceptor.SessionAttrib uteInterceptor] Added model object 'user' of type [com.generalynx.egida.basic.common.data.User] to request in SessionAttributeInterceptor.
                      2004-10-19 11:44:14,687 DEBUG [com.generalynx.egida.web.interceptor.SessionAttrib uteInterceptor] Added model object 'USER_MODULES' of type [com.generalynx.common.web.module.UserModules] to request in SessionAttributeInterceptor.
                      2004-10-19 11:44:14,687 DEBUG [com.generalynx.egida.web.interceptor.SessionAttrib uteInterceptor] Added model object 'APP_STATUS' of type [com.generalynx.egida.web.object.AppStatusHolder] to request in SessionAttributeInterceptor.
                      2004-10-19 11:44:14,687 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Retrieved value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] bound to thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:14,687 DEBUG [org.springframework.orm.hibernate.support.OpenSess ionInViewInterceptor] Flushing single Hibernate session in OpenSessionInViewInterceptor
                      2004-10-19 11:44:14,687 DEBUG [org.springframework.web.servlet.DispatcherServlet] Will render view in DispatcherServlet with name 'egida'
                      2004-10-19 11:44:14,687 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] Returning cached instance of singleton bean 'welcomeView'
                      2004-10-19 11:44:14,687 INFO [org.springframework.web.servlet.view.ResourceBundl eViewResolver] Cached view 'welcomeView_en_US'
                      2004-10-19 11:44:14,687 DEBUG [org.springframework.web.servlet.view.tiles.TilesJs tlView] Rendering view with name 'welcomeView' with model {} and static attributes {}
                      2004-10-19 11:44:14,906 DEBUG [org.springframework.context.support.ReloadableReso urceBundleMessageSource] Creating MessageFormat for pattern [Logoff] and locale 'en_US'
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.context.support.ReloadableReso urceBundleMessageSource] Creating MessageFormat for pattern [Welcome] and locale 'en_US'
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.web.servlet.view.tiles.TilesJs tlView] Forwarded to resource [welcome.layout] in InternalResourceView 'welcomeView'
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.transaction.support.Transactio nSynchronizationManager] Removed value [org.springframework.orm.hibernate.SessionHolder@14 e5d57] for key [net.sf.hibernate.impl.SessionFactoryImpl@10a14ad] from thread [http-0.0.0.0-8080-Processor25]
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.orm.hibernate.support.OpenSess ionInViewInterceptor] Closing single Hibernate session in OpenSessionInViewInterceptor
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.orm.hibernate.SessionFactoryUt ils] Closing Hibernate session
                      2004-10-19 11:44:15,031 DEBUG [net.sf.hibernate.impl.SessionImpl] closing session
                      2004-10-19 11:44:15,031 DEBUG [net.sf.hibernate.impl.SessionImpl] disconnecting session
                      2004-10-19 11:44:15,031 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.web.servlet.DispatcherServlet] Successfully completed request
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.web.context.support.XmlWebAppl icationContext] Publishing event in context [XmlWebApplicationContext for namespace 'egida-servlet']: RequestHandledEvent: url=[/egida/login.htm]; time=[860ms]; client=[127.0.0.1]; method=[POST]; servlet=[egida]; session=[13AF9E7244C4F084A1DF43A1BD3B3E28]; user=[null]; status=[OK]
                      2004-10-19 11:44:15,031 DEBUG [org.springframework.web.context.support.XmlWebAppl icationContext] Publishing event in context [Root XmlWebApplicationContext]: RequestHandledEvent: url=[/egida/login.htm]; time=[860ms]; client=[127.0.0.1]; method=[POST]; servlet=[egida]; session=[13AF9E7244C4F084A1DF43A1BD3B3E28]; user=[null]; status=[OK]
                      2004-10-19 11:44:45,796 DEBUG [net.sf.hibernate.impl.SessionImpl] running Session.finalize()

                      Comment

                      Working...
                      X