开发者

Exception Could not open Hibernate Session for transaction

Sometime i m getting this problem in my NHibernate log .My application stops at that moment.

Updated wityh data configuration.

Even after successful transaction.Application connection with the database persist.in

Nhibernate log it shows

Nhibernate Log

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null)> -

executing flush

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] <

(null)> - registering flush begin

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] <

(null)> - registering flush end

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null)> -

post flush

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null)> -

before transaction completion

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] <

(null)> - aggressively releasing database connection

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Connection.ConnectionProvider

[(null)] <(null)> - Closing connection

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null)> -

transaction completion

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Transaction.AdoTransaction [(null)] <

(null)> - running AdoTransaction.Dispose()

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null)> -

closing session

2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> -

running BatcherImpl.Dispose(true)

Underneath given is my dataconfiguration file

   <?xml version="1.0" encoding="utf-8" ?>

<objects 
xmlns="http://www.springframework.net" 

         xmlns:db="http://www.springframework.net/database"

     xmlns:tx="http://www.springframework.net/tx">

  <object id="AuditLogger" type="Risco.Rsp.Ac.Audit.AuditLogger, Risco.Rsp.Ac.Audit" singleton="false"> 

    <property name="CacheSettings" ref="CacheSettings"  />
  </object>


  <object id="CacheSettings"

          type="Risco.Rsp.Ac.AMAC.CacheMgmt.Utilities.UpdateEntityCacheHelper, 

Risco.Rsp.Ac.AMAC.CacheMgmt.Utilities" singleton="false"/>

  <!-- Property placeholder configurer for database settings-->

  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">

    <property name="ConfigSections" value="databaseSettings"/>
  </object>

  <db:provider id="AMACDbProvider"

                provider="OracleClient-2.0"

    connectionString="Data Source=RISCODEVDB;User ID=amacdevuser; Password=amacuser1234;"/>

  <!-- For creating Factory objects -->
  <object id="NHibernateSessionFactory" 

  type="Spring.Data.NHibernate.LocalSessionFactoryObject,Spring.Data.NHibernate12">

    <property name="DbProvider" ref="AMACDbProvider"/>

    <property name="MappingAssemblies">
      <list>
              <value>
    Risco.Rsp.Ac.AMAC.CacheMappings

       </value>

      </list>

    </property>

    <property name="HibernateProperties">

      <dictionary>

        <entry key="hibernate.connection.provider"

               value="NHibernate.Connection.DriverConnectionProvider"
         />

        <entry key="hibernate.dialect"

               value="NHibernate.Dialect.Oracle9Dialect"
              />


        <entry key="hibernate.connection.driver_class"


               value="NHibernate.Driver.OracleClientDriver"/>

      </dictionary>


    </property>

  </object>


  <object id="HibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate"

singleton="false">

    <property name="SessionFactory"

 ref="NHibernateSessionFactory" />

    <property name="TemplateFlushMode" 
value="Auto" />

    <property name="CacheQueries" value="true" />

    <property name="EntityInterceptor" ref="AuditLogger"/>

  </object>


  ><object id="transactionManager" singleton="true"  

    type="Spring.Data.NHibernate.HibernateTransactionManager, >Spring.Data.NHibernate12">  

    <property name="DbProvider" ref="AMACDbProvider"/>

    <property name="SessionFactory" ref="NHibernateSessionFactory"/>

    <property name="EntityInterceptor" ref="AuditLogger"/>

  </object>


  <object id="EventPubSubDAOTx" 

type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject,Spring.Data">

    <property name="PlatformTransactionManager" ref="transactionManager"/>

    <property name="Target" ref="Even开发者_如何转开发tPubSubDAO"/>

    <property name="TransactionAttributes">
       <name-values>

        <add key="Save*" value="PROPAGATION_REQUIRES_NEW"/>

        <add key="Delete*" value="PROPAGATION_REQUIRED"/>

      </name-values>

    </property>

  </object>


  <object id="EventPubSubDAO"  

    type="Risco.Rsp.Ac.AMAC.DAO.EventPubSubMgmt.EventPubSubDAO, 

   Risco.Rsp.Ac.AMAC.DAO.EventPubSubMgmt">

    <property name="HibernateTemplate" ref="HibernateTemplate" />

    <property name="SessionFactory" ref="NHibernateSessionFactory"/>

  </object>

  <!-- EventPubSubMgmt DAO -->


  <tx:attribute-driven/>

  </objects>

Please help me out with this issue.Thanks


The exception is often caused by using a session which is already closed. Your other question also points to the fact that you may have to reconsider your connection and session usage.

Because there is not much information in your questions, it is hard to suggest an improvement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜