jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominik Klaholt <do...@mail.upb.de>
Subject Re: session.logout throws Exception : Inactive logical session handle called
Date Thu, 12 Aug 2010 11:02:14 GMT
Hi,

I think you must pay attention to the fact, that your are connecting to 
Jackrabbit via the JCA package. This package realizes a JCA adapter, in 
conjunction with this adapter the application server is able to keep a 
pool of JCR sessions. This pool keeps the actual JCR sessions. What you 
are dealing with in your session beans are not the actual JCR sessions, 
but session handles, proxies so to speak, provided by the JCA package. 
Due to the bindSessionToTransaction-flag these JCA session handles are 
closed whenever a container managed or bean managed transaction commits. 
However, the actual JCR sessions associated with these session handles 
are not closed, but kept alive in a pool.
So your error probably occurs, because the JCA session handle is already 
closed (due to a transaction commit) when you call the session.isLive() 
oder session.logout() in  the @PreDestroy method.
At least this is how I understand it... :)

Am 12.08.2010 10:36, schrieb jason wang:
> Hi,Can someone help me with the following problem.I have a stateless session bean which
has the following methods:	@PostConstruct	private void initialize(){		try {			session = repository.login(new
SimpleCredentials("username", "password".toCharArray()));		}catch (LoginException e) {		}catch(RepositoryException
e){		}	}		@PreDestroy	private void cleanup(){		if (session!=null&&  session.isLive()){
		session.logout();			session=null;		}	}		public void addCategory(String absPath, JRCategory
jrCategory){
>      	
>      	try {
>      		Node parentNode = session.getNode(absPath);
>      		Node categoryNode = parentNode.addNode(jrCategory.getCategoryName(), "nt:unstructured");
>      		session.save();
>      	}
> 		}catch( ItemExistsException e){
> 		}catch (PathNotFoundException e) {
> 		} catch (RepositoryException e) {
> 		}
>     	}The jcr-ds.xml file has the following:<connection-factories>    <tx-connection-factory>
    <jndi-name>jcr/local</jndi-name>      <xa-transaction/>     <rar-name>jackrabbit-jca-2.1.0.rar</rar-name>
    <connection-definition>javax.jcr.Repository</connection-definition>     <config-property
name="homeDir" type="java.lang.String">D:\repositoryJR</config-property>     <config-property
name="configFile" type="java.lang.String">repository.xml</config-property>     <config-property
name="repositoryURI" type="java.lang.String">jcr-jackrabbit://jackrabbit</config-property>
    <config-property name="bindSessionToTransaction" type="java.lang.Boolean">true</config-property>
  </tx-connection-factory></connection-factories>When the session.logout() is
executed, I got the "Inactive logical session handle called" exception.Is this because the
session is already closed when JTA transaction commits? How should I fix this problem?thanks
a lot.Jason 		 	   		
>    


Mime
View raw message