You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Chris Poulsen <cp...@dezide.com> on 2017/08/10 07:13:58 UTC

Possible bug? - java.lang.IllegalStateException: Inactive logical session handle called

Hi,

I'm currently toying around trying to eliminate a dependency  (spring
extensions jcr) in our code.

As far as I can tell we are only using a little bit of their session
management, in order to be able to run integration tests in XA transactions.

My first attempt has been to simply run the Jackrabbit JCA archive in an
environment providing JCA / JTA (Arquillian) without the spring extension,
it seems to work like expected, but I've hit a minor snag:

If I do:

TX start
Session s1 = repository.login(admin());
Session s2 = repository.login(admin());
s1.getRootNode();

then the "Inactive logical session handle called" exception is thrown.

I think the offending code is located in org.apache.jackrabbit.jca.
JCAManagedConnection:347

<code>
/**
 * Return the session.
 */
public Session getSession(JCASessionHandle handle) {
    synchronized (handles) {
        if ((handles.size() > 0) && (handles.get(0) == handle)) {
            return session;
        } else {
            throw new java.lang.IllegalStateException("Inactive logical
session handle called");
        }
    }
}
</code>

The "if((handles.size() > 0) && (handles.get(0) == handle))" seems wrong,
should it not be something like: "if(handles.contains(handle))" ?

In the debugger I can see that the JCAManagedConnection has two handles
(for the same underlying session as expected) when the error is thrown.

It is possible to work around the issue, but when a test case that simple
fails, it smells a bit...

So is this a bug?

-- 
Chris