Hi,I'm using the same credentials for every user. Unfortunately, I don't know 
the answer to your other questions.Can anyone else help please?Jason

> Date: Fri, 13 Aug 2010 14:50:01 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: session.logout throws Exception : Inactive logical session 
> handle called
> 
> Hm, as I think about that, a totally new question pops up in my mind: 
> What credentials do you use for the repsoitory.login()-calls? If I do 
> not use the very same credentials for every user of my application, then 
> my log says from time to time:
> 
> 14:36:07,450 WARN  [JBossManagedConnectionPool] Destroying connection 
> that could not be successfully matched: 
> org.jboss.resource.connectionmanager.txconnectionmanager$txconnectioneventliste...@17421ba[state=normal
>  
> mc=org.apache.jackrabbit.jca.jcamanagedconnect...@67946a handles=0 
> lastUse=1281702967446 permit=false trackByTx=false 
> mcp=org.jboss.resource.connectionmanager.jbossmanagedconnectionpool$onep...@190106e
>  
> context=org.jboss.resource.connectionmanager.internalmanagedconnectionp...@126a89c
>  
> xaresource=org.apache.jackrabbit.jca.transactionboundxaresou...@10290ee 
> txSync=null]
> 
> And if, at that time, there is only one session in the pool, the 
> repository is shut down (normal behavior of the 
> TransientRepository-class used by the Jackrabbit-JCA-Adapter: if there's 
> no open session, shut-down the repository).
> So, is the shared connection pool only really usable, if I use the same 
> credentials for every user? But then, what about the authorization 
> features of Jackrabbit? How to use them when connecting via the 
> JCA-package? Any thoughts anyone?
> 
> By the way: Is this the right place to maybe get in contact with 
> developers of the JCA-package? Or should I try some place else?
> 
> Am 13.08.2010 14:14, schrieb jason wang:
> > Hi,I understand. Thanks for your detailed explanation.
> > Now I tested with the following, seems ok.I set the 
> > sessionbindtotransaction flag to true,then in each method, I will do a 
> > session login.But I no longer do the session logout in the method since it 
> > is closed by the associated transaction anyway. Pray no memory leak. :) 
> > thanks a lot.Jason
> >    
> >> Date: Fri, 13 Aug 2010 13:08:18 +0200
> >> From: [email protected]
> >> To: [email protected]
> >> Subject: Re: session.logout throws Exception : Inactive logical session 
> >> handle called
> >>
> >> Hi,
> >>
> >> first: Yes, when a session handle is closed, the underlying connection
> >> stays alive and is returned to the pool (I'm not a Jackrabbit developer,
> >> but all of my tests show exactly that + there hasn't been any
> >> contradiction on this mailing-list yet :)).
> >> Second: Good questions and I'm, too, struggling with the answers for my
> >> own application. However, what I can say is (again, not a developer, but
> >> tests and no contradictions), that you do not have to call
> >> session.logout if the bindSessionToTransaction-flag is set to true and
> >> all of your methods are executed within a container or bean managed
> >> transaction. So no memory leak there (of course, you have to call
> >> session.logout if there is no transaction around). And if all of your
> >> session bean methods do have a TransactionAttribute of "required" (which
> >> is the default), then bindSessionToTransaction = true is basically the
> >> same as calling session.login and session.logout in every method.
> >> I don't know the best way to take yet, either.
> >> Currently I also added the flag<application-managed-security/>  to my
> >> jcr-ds.xml so that the sessions in the pool are distinguished by the
> >> repository.login-credentials (as far as I know, now user x never uses a
> >> session user y has used before). Furthermore I have the
> >> bindSessionToTransaction-flag set to true, so theoretically I shouln't
> >> have to worry much about handling and logging out the sessions. As you
> >> can see in another eMail on this list ("Jackrabbit, JCA, JBoss, EJB and
> >> transactions"), I have a problem with that configuration, though.
> >> You can find some more configurable flags for your jcr-ds.xml e.g. on
> >> [1] (at least those flags seem to work for the JBoss implementation of
> >> the JCA).
> >>
> >> Best regards
> >> Dominik
> >>
> >>
> >> [1] http://community.jboss.org/wiki/ConfigJCACommon
> >>
> >> Am 13.08.2010 07:34, schrieb jason wang:
> >>      
> >>> Hi,Thank you very much for your reply.
> >>> So when the session handle is closed, the underlying connection is NOT 
> >>> closed, because the actual session is returned to the pool, is that 
> >>> right? But what would be the correct way to manage JackRabbit session in 
> >>> a stateless session bean? For example,
> >>> If I set  bindSessionToTransaction-flag to false, then when should I call 
> >>> session.logout() in order to release resource?
> >>> If I set  bindSessionToTransaction-flag to true, and a session is closed 
> >>> when the transaction commit, does that mean I don't need to invoke the 
> >>> session.logout method? No memory leak?
> >>>
> >>> Another approach is to call session login, and session logout in every 
> >>> method of the bean? but  I doubt this is a good design.
> >>> Thanks a lot for your help.Jason
> >>>
> >>>
> >>>
> >>>
> >>>        
> >>>> Date: Thu, 12 Aug 2010 13:02:14 +0200
> >>>> From: [email protected]
> >>>> To: [email protected]
> >>>> Subject: Re: session.logout throws Exception : Inactive logical session 
> >>>> handle called
> >>>>
> >>>> 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                                         
> >>>>>
> >>>>>
> >>>>>            
> >>>>
> >>>>          
> >>>                                           
> >>>
> >>>        
> >>      
> >                                     
> >    
> 
                                          

Reply via email to