We are upgrading project from IBM websphere 7 to 8 ,Hibernate 3.3.2.GA to 4.2.3 and using Hibernate with JPA.we are auditing page clicks using Spring transaction management ( websphere based JTA) and storing page audit info in database.
After upgrading we are getting below exception as audit message are coming to JMS queue using spring JMS listener(DefaultMessageListenerContainer)
org.hibernate.SessionException: Session is closed!
at org.hibernate.internal.AbstractSessionImpl.errorIf Closed(AbstractSessionImpl.java:129)
Transaction manager config in spring-ds.xml is below:
<bean class="org.springframework.transaction.jta.WebSphe reUowTransactionManager" id="wasUOWTxnManagerObj"> </bean>
<bean class="javax.transaction.TransactionManager" id="transactionManager" factory-method="getTransactionManager" factory-bean="wasUOWTxnManagerObj"> </bean>
<bean id="xxMsgListenerContainer"
class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
<property name="connectionFactory" ref="xxAuditConnectionFactory" />
<property name="destination" ref="jmsxxQueue" />
<property name="messageListener" ref="xxMessageListener" />
<property name="transactionManager" ref="transactionManager" />
<property name="taskExecutor" ref="taskExecutor" />
</bean>
bean id="hibernateJpaProps"
class="org.springframework.beans.factory.config.Pr opertiesFactoryBean">
<property name="properties">
<props>
<!-- <prop key="hibernate.dialect">org.hibernate.dialect.Orac le10gDialect
<prop key="hibernate.dialect">org.hibernate.dialect.SQLS erver2008Dialect
SQL Sever Dialect -->
<prop key="hibernate.dialect">org.hibernate.dialect.SQLS erverDialect
<!-- -->
</prop>
<prop key="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.EhCacheRegionFactory
</prop>
<prop key="hibernate.cache.use_second_level_cache">
true
</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- comment out default_schema for SQL server
<prop key="hibernate.default_schema">IB</prop> -->
<prop key="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereTransactionMana gerLookup</prop>
<prop key="hibernate.transaction.flush_before_completion ">false</prop>
</props>
</property>
</bean>
After upgrading we are getting below exception as audit message are coming to JMS queue using spring JMS listener(DefaultMessageListenerContainer)
org.hibernate.SessionException: Session is closed!
at org.hibernate.internal.AbstractSessionImpl.errorIf Closed(AbstractSessionImpl.java:129)
Transaction manager config in spring-ds.xml is below:
<bean class="org.springframework.transaction.jta.WebSphe reUowTransactionManager" id="wasUOWTxnManagerObj"> </bean>
<bean class="javax.transaction.TransactionManager" id="transactionManager" factory-method="getTransactionManager" factory-bean="wasUOWTxnManagerObj"> </bean>
<bean id="xxMsgListenerContainer"
class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
<property name="connectionFactory" ref="xxAuditConnectionFactory" />
<property name="destination" ref="jmsxxQueue" />
<property name="messageListener" ref="xxMessageListener" />
<property name="transactionManager" ref="transactionManager" />
<property name="taskExecutor" ref="taskExecutor" />
</bean>
bean id="hibernateJpaProps"
class="org.springframework.beans.factory.config.Pr opertiesFactoryBean">
<property name="properties">
<props>
<!-- <prop key="hibernate.dialect">org.hibernate.dialect.Orac le10gDialect
<prop key="hibernate.dialect">org.hibernate.dialect.SQLS erver2008Dialect
SQL Sever Dialect -->
<prop key="hibernate.dialect">org.hibernate.dialect.SQLS erverDialect
<!-- -->
</prop>
<prop key="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.EhCacheRegionFactory
</prop>
<prop key="hibernate.cache.use_second_level_cache">
true
</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- comment out default_schema for SQL server
<prop key="hibernate.default_schema">IB</prop> -->
<prop key="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereTransactionMana gerLookup</prop>
<prop key="hibernate.transaction.flush_before_completion ">false</prop>
</props>
</property>
</bean>