java.lang.IllegalStateException: No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking']

Spring JIRA | Lou Sacco | 1 decade ago
  1. 0

    Spring Team, I have noticed that Spring will not close sessions when running an XA transaction between separate weblogic domain instances. In the one domain, there exists a WLI Business Process that initiates a transaction. It then makes a remote call to an EJB in a separate process in another domain. This EJB uses Spring's HibernateTemplate to store information to one database and uses CMT Required to join the existing transaction. Once it returns, the WLI business process calls some of its own EJBs (w/ CMT Required too) that wrap calls to underlying Spring/Hibernate DAOs to persist data into a separate database. Upon completion, we see the transaction commit, but in the log we see an IllegalStateException saying it can't find the session (see below). This is strange to us, because it found the bound session when flushing, just not when closing. This in turn causes all sorts of unexplainable problems like NoSuchElementExceptions, etc. When I move the JPD to the same server that is running the EJB, I no longer see this error and I see a corresponding close for each session opened. Keep in mind, I do no special handling of sessions, as I expect HibernateTemplate will take care of this for me (i.e., no SessionFactoryUtil calls). Please let me know your opinion on this issue. My original post can be found here showing more details: http://forum.springframework.org/viewtopic.php?t=2411 Thanks, Lou [code] ####<Nov 18, 2004 1:24:02 PM PST> <Warning> <JTA> <pj8801> <cgServer> <ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking'> <<WLS Kernel>> <> <BEA-110401> <Ignoring error in afterCompletion. Object=org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynchronization@1ddec9e, Exception=java.lang.IllegalStateException: No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking'] java.lang.IllegalStateException: No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking'] at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:156) at org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCompletion(SessionFactoryUtils.java:684) at org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynchronization.afterCompletion(SessionFactoryUtils.java:770) at weblogic.transaction.internal.ServerSCInfo.callAfterCompletions(ServerSCInfo.java:853) at weblogic.transaction.internal.ServerTransactionImpl.callAfterCompletions(ServerTransactionImpl.java:2708) at weblogic.transaction.internal.ServerTransactionImpl.afterCommittedStateHousekeeping(ServerTransactionImpl.java:2606) at weblogic.transaction.internal.ServerTransactionImpl.setCommittedUnsync(ServerTransactionImpl.java:2644) at weblogic.transaction.internal.ServerTransactionImpl.ackCommit(ServerTransactionImpl.java:997) at weblogic.transaction.internal.CoordinatorImpl.ackCommit(CoordinatorImpl.java:234) at weblogic.transaction.internal.CoordinatorImpl_WLSkel.invoke(Unknown Source) at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477) at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144) at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415) at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)[/code]

    Spring JIRA | 1 decade ago | Lou Sacco
    java.lang.IllegalStateException: No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking']
  2. 0

    Spring Team, I have noticed that Spring will not close sessions when running an XA transaction between separate weblogic domain instances. In the one domain, there exists a WLI Business Process that initiates a transaction. It then makes a remote call to an EJB in a separate process in another domain. This EJB uses Spring's HibernateTemplate to store information to one database and uses CMT Required to join the existing transaction. Once it returns, the WLI business process calls some of its own EJBs (w/ CMT Required too) that wrap calls to underlying Spring/Hibernate DAOs to persist data into a separate database. Upon completion, we see the transaction commit, but in the log we see an IllegalStateException saying it can't find the session (see below). This is strange to us, because it found the bound session when flushing, just not when closing. This in turn causes all sorts of unexplainable problems like NoSuchElementExceptions, etc. When I move the JPD to the same server that is running the EJB, I no longer see this error and I see a corresponding close for each session opened. Keep in mind, I do no special handling of sessions, as I expect HibernateTemplate will take care of this for me (i.e., no SessionFactoryUtil calls). Please let me know your opinion on this issue. My original post can be found here showing more details: http://forum.springframework.org/viewtopic.php?t=2411 Thanks, Lou [code] ####<Nov 18, 2004 1:24:02 PM PST> <Warning> <JTA> <pj8801> <cgServer> <ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking'> <<WLS Kernel>> <> <BEA-110401> <Ignoring error in afterCompletion. Object=org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynchronization@1ddec9e, Exception=java.lang.IllegalStateException: No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking'] java.lang.IllegalStateException: No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking'] at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:156) at org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCompletion(SessionFactoryUtils.java:684) at org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynchronization.afterCompletion(SessionFactoryUtils.java:770) at weblogic.transaction.internal.ServerSCInfo.callAfterCompletions(ServerSCInfo.java:853) at weblogic.transaction.internal.ServerTransactionImpl.callAfterCompletions(ServerTransactionImpl.java:2708) at weblogic.transaction.internal.ServerTransactionImpl.afterCommittedStateHousekeeping(ServerTransactionImpl.java:2606) at weblogic.transaction.internal.ServerTransactionImpl.setCommittedUnsync(ServerTransactionImpl.java:2644) at weblogic.transaction.internal.ServerTransactionImpl.ackCommit(ServerTransactionImpl.java:997) at weblogic.transaction.internal.CoordinatorImpl.ackCommit(CoordinatorImpl.java:234) at weblogic.transaction.internal.CoordinatorImpl_WLSkel.invoke(Unknown Source) at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477) at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144) at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415) at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)[/code]

    Spring JIRA | 1 decade ago | Lou Sacco
    java.lang.IllegalStateException: No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking']
  3. 0

    It's not possible making Callable method in Spring Controller under Undertow

    GitHub | 2 years ago | tryIO
    java.lang.IllegalStateException: No value for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@166e2c19] bound to thread [XNIO-1 task-2]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.lang.IllegalStateException: No value for key bound to thread

    Stack Overflow | 4 years ago | jurma
    java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@1ff8c2a] bound to thread ["http-apr-83"-exec-3]
  6. 0

    @Transaction Issue: TransactionSynchronization.beforeCompletion threw exception

    Stack Overflow | 5 years ago | user1111566
    java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@1b2668f] bound to thread [http-8181-1]

    8 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      No value for key [net.sf.hibernate.impl.SessionFactoryImpl@ae2593] bound to thread [ExecuteThread: '2' for queue: 'weblogic.kernel.Non-Blocking']

      at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource()
    2. Spring Tx
      TransactionSynchronizationManager.unbindResource
      1. org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:156)
      1 frame
    3. Hibernate
      SessionFactoryUtils$JtaSessionSynchronization.afterCompletion
      1. org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCompletion(SessionFactoryUtils.java:684)
      2. org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynchronization.afterCompletion(SessionFactoryUtils.java:770)
      2 frames
    4. weblogic.transaction.internal
      CoordinatorImpl_WLSkel.invoke
      1. weblogic.transaction.internal.ServerSCInfo.callAfterCompletions(ServerSCInfo.java:853)
      2. weblogic.transaction.internal.ServerTransactionImpl.callAfterCompletions(ServerTransactionImpl.java:2708)
      3. weblogic.transaction.internal.ServerTransactionImpl.afterCommittedStateHousekeeping(ServerTransactionImpl.java:2606)
      4. weblogic.transaction.internal.ServerTransactionImpl.setCommittedUnsync(ServerTransactionImpl.java:2644)
      5. weblogic.transaction.internal.ServerTransactionImpl.ackCommit(ServerTransactionImpl.java:997)
      6. weblogic.transaction.internal.CoordinatorImpl.ackCommit(CoordinatorImpl.java:234)
      7. weblogic.transaction.internal.CoordinatorImpl_WLSkel.invoke(Unknown Source)
      7 frames
    5. weblogic.rmi.internal
      BasicServerRef$1.run
      1. weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
      2. weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
      2 frames
    6. weblogic.security.acl
      AuthenticatedSubject.doAs
      1. weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
      1 frame
    7. weblogic.security.service
      SecurityManager.runAs
      1. weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
      1 frame
    8. weblogic.rmi.internal
      BasicExecuteRequest.execute
      1. weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
      2. weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
      2 frames
    9. weblogic.kernel
      ExecuteThread.run
      1. weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
      2. weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)[/code]
      2 frames