How to Debug [TOPLINK-7001] ValidationException: 'You must login to the ServerSession before acquiring ClientSessions' (Doc ID 972732.1)

Last updated on JUNE 07, 2017

Applies to:

Oracle TopLink - Version 10.1.3.1 and later
Information in this document applies to any platform.

Goal

The following will show steps needed to provide diagnostic information for the ValidationException 'You must login to the ServerSession before acquiring ClientSessions'. This information can be used internally or provided to Oracle Support when opening a service request.

The following TOPLINK-7001 is seen when running a multi threaded TopLink application, in this case an EJB application deployed to OC4J. For some reason the ServerSession appears to have been closed by a thread other than the current thread, however no explicit serverSession.logout() method is called in the application:

Exception TOPLINK-7001 (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.ValidationException
Exception Description: You must login to the ServerSession before acquiring ClientSessions.
at oracle.toplink.exceptions.ValidationException.loginBeforeAllocatingClientSessions(ValidationException.java:800)
at oracle.toplink.threetier.ServerSession.acquireClientSession(ServerSession.java:310)
at oracle.toplink.threetier.ServerSession.acquireClientSession(ServerSession.java:273)
at oracle.toplink.threetier.ServerSession.acquireUnitOfWork(ServerSession.java:369)
at oracle.toplink.transaction.AbstractTransactionController.getActiveUnitOfWork(AbstractTransactionController.java:250)
at oracle.toplink.publicinterface.Session.getActiveUnitOfWork(Session.java:1110)
at oracle.toplink.util.SessionFactory.acquireUnitOfWork(SessionFactory.java:194)
at oracle.toplink.util.SessionFactory.acquireUnitOfWork(SessionFactory.java:184)
at com.xxxxxxx.rose.model.common.facades.DocumentFacadeBean.createDocument(DocumentFacadeBean.java:113)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;J)Ljava.lang.Object;(Unknown Source)
at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)

 

This can occur for the following reason:

SessionFactory.getSharedSession method compares the current thread context class loader with the one used to load the session - if the two classloaders are not the same then the session is disconnected and a new session is created. 

The SessionFactory.getSharedSession helper method looks up the session and ensure that if the application has been hot-deployed it gets a fresh version of the Session.

This can happen if the application is redeployed "on the fly" (hot redeployment).

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms