• Bug
  • Status: Resolved
  • 2 Major
  • Resolution: Won't Fix
  • Sessions
  • interfaces
  • Reporter: eellis00
  • August 21, 2008
  • 0
  • Watchers: 2
  • February 12, 2014
  • February 12, 2014

Attachments

Description

Essentially, we’re listening to the sessionDestroyed() event calling a Spring managed bean which uses Hibernate to write various recorded statistics to the database. This works fine w/o Terracotta.

Just wanted to let you know.

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at com.zdm.oneup.persistence.service.AuthManager\(EnhancerByCGLIB\)e6179ed3.updateUserNetworkStatusforLogout() at com.zdm.oneup.myoneup.form.UserSessionBean.logout(UserSessionBean.java:618) at com.zdm.oneup.main.base.filter.SessionFilter.sessionDestroyed(SessionFilter.java:72) at com.terracotta.session.util.DefaultLifecycleEventMgr.fireSessionDestroyedEvent(DefaultLifecycleEventMgr.java:47) at com.terracotta.session.SessionData.invalidate(SessionData.java:115) at com.terracotta.session.SessionData.invalidateIfNecessary(SessionData.java:101) at com.terracotta.session.TerracottaSessionManager.expire(TerracottaSessionManager.java:424) at com.terracotta.session.TerracottaSessionManager.access$700(TerracottaSessionManager.java:31) at com.terracotta.session.TerracottaSessionManager$SessionInvalidator.evaluateSession(TerracottaSessionManager.java:560) at com.terracotta.session.TerracottaSessionManager$SessionInvalidator.invalidateSessions(TerracottaSessionManager.java:532) at com.terracotta.session.TerracottaSessionManager$SessionInvalidator.run(TerracottaSessionManager.java:499) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) at org.hibernate.jdbc.BorrowedConnectionProxy.generateProxy(BorrowedConnectionProxy.java:67) at org.hibernate.jdbc.ConnectionManager.borrowConnection(ConnectionManager.java:163) at org.hibernate.jdbc.JDBCContext.borrowConnection(JDBCContext.java:111) at org.hibernate.impl.SessionImpl.connection(SessionImpl.java:359) at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:510)

Comments

Tim Eck 2008-08-25

That sure looks like a problem that has to do with thread context classloader. I wonder if Thread.getContextClassLoader() is giving you a different result depending on whether TC is present or not? If you set the context loader to getClass().getClassLoader() in SessionFilter.sessionDestroyed() you can probably workaround the problem for now (remember to reset on the way out of the event method)

Eric Ellis 2008-08-25

That worked.

ClassLoader origLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); userSessionBean.logout(); Thread.currentThread().setContextClassLoader(origLoader);

Thanks,

Fiona OShea 2008-08-25

Is this a product issue?

Tim Eck 2008-08-25

Thanks Eric, That is good evidence that we should be setting the TCL when invoking session events from the invalidator thread. I would say this is a TC bug.

If you’re going to use that workaround, I suggest doing the reset of the context loader in a finally block so that even if logout() throws an exception it will always be set back to the original value

Hung Huynh 2014-02-12

DSO is discontinued