-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate 4.1 proxy handle is no longer valid
PostPosted: Wed Mar 28, 2012 9:40 am 
Newbie

Joined: Wed Nov 10, 2010 5:09 am
Posts: 3
hibernate 4.1.2 Snapshot
Spring 3.1
Websphere 7

Get exception 'proxy handle is no longer valid'
Full stacktrace is below

I have seen other instances of this on forum
https://forum.hibernate.org/viewtopic.php?f=1&t=1014848
and
https://forum.hibernate.org/viewtopic.php?f=1&t=1014673

for one using the CMT manager fixed it as JTA manager was causing issue
Issue occurs for me irrespective.

As seems to be recommended using UOW transaction manager for websphere and WAS connection that works.
The calls do work, just get the stacktrace on post completion. Others seemed to think its related to statements getting registered twice and not invalidated beofre being release a second time which seems to make sense.

I do see some other warnings around statement registering

Quote:
2012-03-28 14:17:17,500 WARN [WebContainer : 1] JdbcResourceRegistryImpl M[register] --> HHH000387: ResultSet's statement was not registered


Any pointers appreciated.
thanks

config
Code:
<bean id="transactionManager"
      class="org.springframework.transaction.jta.WebSphereUowTransactionManager" />

<jee:jndi-lookup id="hibernateDataSource" jndi-name="jdbc/Oracle206" resource-ref="true"
      cache="true" lookup-on-startup="false" proxy-interface="javax.sql.DataSource" />

<util:properties id="hibernateProperties">
      <prop key="hibernate.dialect">${hibernate.dialect}</prop>
      <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
      <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
      <prop key="hibernate.connection.datasource">jdbc/Oracle206</prop>
      <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
      <prop key="hibernate.transaction.jta.platform">org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform</prop>
      
   </util:properties>




Hibernate ..

Code:
<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
      <property name="dataSource" ref="hibernateDataSource"/>
      <property name="hibernateProperties" ref="hibernateProperties" />
      <property name="mappingResources">
         <list>
            <value>hibernate_mappingsXXXX.hbm.xml</value>

         </list>
      </property>
   </bean>


Session retrieval
Code:
public Session getSession()
   {
      Session session = null;
      
      try
      {
         session = sessionFactory.getCurrentSession();
         m_logger.debug("Got current session");
      }
      catch(HibernateException e)
      {
         m_logger.debug("Exception in getting session " + e.getMessage());
         try
         {
            m_logger.debug("Open new session ..");
            session = sessionFactory.openSession();
         }
         catch(HibernateException ex)
         {
            e.printStackTrace();
         }
      }
      
      return session;
   }


Session use
Code:
try
      {
         Session session = super.getSession();
         session.saveOrUpdate(entity);         
         success = true;
      }


Also looked at
https://hibernate.onjira.com/browse/HHH-7020

I am using snapshot in hope that it contained fix based on bug description above, but still same behaviour as was with 4.1


Stacktrace ..

Code:
[28/03/12 14:17:17:609 BST] 00000027 RegisteredSyn E   WTRN0074E: Exception caught from after_completion synchronization operation: org.hibernate.HibernateException: proxy handle is no longer valid
   at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.errorIfInvalid(AbstractProxyHandler.java:63)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:100)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
   at $Proxy57.getWrappedObject(Unknown Source)
   at org.hibernate.engine.jdbc.internal.JdbcResourceRegistryImpl.close(JdbcResourceRegistryImpl.java:215)
   at org.hibernate.engine.jdbc.internal.JdbcResourceRegistryImpl.cleanup(JdbcResourceRegistryImpl.java:189)
   at org.hibernate.engine.jdbc.internal.JdbcResourceRegistryImpl.close(JdbcResourceRegistryImpl.java:206)
   at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.close(LogicalConnectionImpl.java:197)
   at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:141)
   at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.close(TransactionCoordinatorImpl.java:276)
   at org.hibernate.internal.SessionImpl.close(SessionImpl.java:334)
   at org.hibernate.internal.SessionImpl.managedClose(SessionImpl.java:510)
   at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.afterCompletion(SynchronizationCallbackCoordinatorImpl.java:132)
   at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.afterCompletion(RegisteredSynchronization.java:61)
   at com.ibm.tx.jta.RegisteredSyncs.coreDistributeAfter(RegisteredSyncs.java:357)
   at com.ibm.ws.tx.jta.RegisteredSyncs.distributeAfter(RegisteredSyncs.java:317)
   at com.ibm.tx.jta.TransactionImpl.distributeAfter(TransactionImpl.java:2933)
   at com.ibm.tx.jta.TransactionImpl.postCompletion(TransactionImpl.java:2892)
   at com.ibm.tx.jta.TransactionImpl.postCompletion(TransactionImpl.java:2805)
   at com.ibm.tx.jta.TransactionImpl.commitXAResources(TransactionImpl.java:1775)
   at com.ibm.ws.tx.jta.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:497)
   at com.ibm.tx.jta.TransactionImpl.processCommit(TransactionImpl.java:978)
   at com.ibm.tx.jta.TransactionImpl.commit(TransactionImpl.java:913)
   at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:369)
   at com.ibm.tx.jta.TranManagerSet.commit(TranManagerSet.java:161)
   at com.ibm.ws.uow.UOWManagerImpl.uowCommit(UOWManagerImpl.java:1172)
   at com.ibm.ws.uow.UOWManagerImpl.uowEnd(UOWManagerImpl.java:1142)
   at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:1092)
   at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:626)
   at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:281)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:127)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy47.loginUser(Unknown Source)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.