Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 66055 invoked from network); 13 Aug 2010 05:34:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Aug 2010 05:34:59 -0000 Received: (qmail 74003 invoked by uid 500); 13 Aug 2010 05:34:58 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 73714 invoked by uid 500); 13 Aug 2010 05:34:56 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 73705 invoked by uid 99); 13 Aug 2010 05:34:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Aug 2010 05:34:55 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jasonqiwang@hotmail.com designates 65.55.90.145 as permitted sender) Received: from [65.55.90.145] (HELO snt0-omc3-s6.snt0.hotmail.com) (65.55.90.145) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Aug 2010 05:34:46 +0000 Received: from SNT132-W36 ([65.55.90.136]) by snt0-omc3-s6.snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 12 Aug 2010 22:34:25 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_5c89e7af-7386-4875-a01b-90cbb7be2c01_" X-Originating-IP: [211.157.25.34] From: jason wang To: Subject: RE: session.logout throws Exception : Inactive logical session handle called Date: Fri, 13 Aug 2010 05:34:24 +0000 Importance: Normal In-Reply-To: <4C63D4B6.906@mail.upb.de> References: ,<4C63D4B6.906@mail.upb.de> MIME-Version: 1.0 X-OriginalArrivalTime: 13 Aug 2010 05:34:25.0076 (UTC) FILETIME=[30AD9F40:01CB3AA9] X-Virus-Checked: Checked by ClamAV on apache.org --_5c89e7af-7386-4875-a01b-90cbb7be2c01_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=2CThank you very much for your reply. So when the session handle is closed=2C the underlying connection is NOT cl= osed=2C because the actual session is returned to the pool=2C is that right= ? But what would be the correct way to manage JackRabbit session in a state= less session bean? For example=2C If I set bindSessionToTransaction-flag to false=2C then when should I call= session.logout() in order to release resource? If I set bindSessionToTransaction-flag to true=2C and a session is closed = when the transaction commit=2C does that mean I don't need to invoke the se= ssion.logout method? No memory leak? Another approach is to call session login=2C and session logout in every me= thod of the bean? but I doubt this is a good design. =20 Thanks a lot for your help.Jason=20 > Date: Thu=2C 12 Aug 2010 13:02:14 +0200 > From: dokla@mail.upb.de > To: users@jackrabbit.apache.org > Subject: Re: session.logout throws Exception : Inactive logical session h= andle called >=20 > Hi=2C >=20 > I think you must pay attention to the fact=2C that your are connecting to= =20 > Jackrabbit via the JCA package. This package realizes a JCA adapter=2C in= =20 > conjunction with this adapter the application server is able to keep a=20 > pool of JCR sessions. This pool keeps the actual JCR sessions. What you=20 > are dealing with in your session beans are not the actual JCR sessions=2C= =20 > but session handles=2C proxies so to speak=2C provided by the JCA package= .=20 > Due to the bindSessionToTransaction-flag these JCA session handles are=20 > closed whenever a container managed or bean managed transaction commits.= =20 > However=2C the actual JCR sessions associated with these session handles= =20 > are not closed=2C but kept alive in a pool. > So your error probably occurs=2C because the JCA session handle is alread= y=20 > closed (due to a transaction commit) when you call the session.isLive()=20 > oder session.logout() in the @PreDestroy method. > At least this is how I understand it... :) >=20 > Am 12.08.2010 10:36=2C schrieb jason wang: > > Hi=2CCan someone help me with the following problem.I have a stateless = session bean which has the following methods: @PostConstruct private void i= nitialize(){ try { session =3D repository.login(new SimpleCredentials("u= sername"=2C "password".toCharArray()))=3B }catch (LoginException e) { }ca= tch(RepositoryException e){ } } @PreDestroy private void cleanup(){ if (= session!=3Dnull&& session.isLive()){ session.logout()=3B session=3Dnul= l=3B } } public void addCategory(String absPath=2C JRCategory jrCategory)= { > > =09 > > try { > > Node parentNode =3D session.getNode(absPath)=3B > > Node categoryNode =3D parentNode.addNode(jrCategory.getCategoryN= ame()=2C "nt:unstructured")=3B > > session.save()=3B > > } > > }catch( ItemExistsException e){ > > }catch (PathNotFoundException e) { > > } catch (RepositoryException e) { > > } > > }The jcr-ds.xml file has the following: <= tx-connection-factory> jcr/local jackrabbit-jca-2.1.0.rar javax.jcr.Repository D:\repositoryJR repos= itory.xml jcr-jackrabbit://jackrabbit true Wh= en the session.logout() is executed=2C 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 = =09 > > =20 >=20 = --_5c89e7af-7386-4875-a01b-90cbb7be2c01_--