Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 89475 invoked from network); 19 Feb 2007 14:34:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Feb 2007 14:34:24 -0000 Received: (qmail 13843 invoked by uid 500); 19 Feb 2007 14:34:32 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 13824 invoked by uid 500); 19 Feb 2007 14:34:32 -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 13813 invoked by uid 99); 19 Feb 2007 14:34:32 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Feb 2007 06:34:32 -0800 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=RCVD_IN_NJABL_PROXY X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [69.17.117.6] (HELO mail4.sea5.speakeasy.net) (69.17.117.6) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Feb 2007 06:34:20 -0800 Received: (qmail 17591 invoked from network); 19 Feb 2007 14:33:58 -0000 Received: from dsl093-092-040.det1.dsl.speakeasy.net (HELO [192.168.2.104]) (haggood@[66.93.92.40]) (envelope-sender ) by mail4.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-MD5 encrypted SMTP for ; 19 Feb 2007 14:33:57 -0000 Subject: OverlappingFileLockException using DerbyPersistenceManager From: Patrick Haggood To: users@jackrabbit.apache.org Content-Type: text/plain Date: Mon, 19 Feb 2007 09:33:56 -0500 Message-Id: <1171895636.3173.25.camel@lapzilla> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I'm using Linux, Sun Java 6 and Jackrabbit 1.3 with Derby persistance. I have a putNode(object) function that's giving the above error in unit tests. It always fails after the second update, even when I swap tests (i.e. save user doc then save user). Prior to each test, I delete the repository directory. Do I need to set explicit locks before/after each session.save()? *********** Unit Test DBConn dbc; public SessionUtilTest(String testName) { super(testName); dbc = new DBConn(); } // Note - putUser and putDocument both use putNode after determining which rootnode will be used /** * Test of putUnityUser method, of class unityjsr170.jr.SessionUtil. */ public void testPutUnityUser() { System.out.println("putUnityUser"); UnityUser usr = usr1; SessionUtil instance = dbc.getSutil(); String result = instance.putUnityUser(usr1); assertNotNull(result); usr = (UnityUser) instance.getUnityUserByID(result); assertEquals(usr1.getName(),usr.getName()); } /** * Test of putUnityDocument method, of class unityjsr170.jr.SessionUtil. */ public void testPutUnityDocument() { System.out.println("putUnityDocument"); UnityDocument udoc = adr1; SessionUtil instance = dbc.getSutil(); String result = instance.putUnityDocument(udoc); <---- File Lock Error assertNotNull(result); udoc = (UnityDocument) instance.getUnityDocumentByID(result); assertEquals(adr1.getName(),udoc.getName()); } ********* Here's where I setup my repository connection public DBConn(){ sutil = null; try { rp = new TransientRepository(); sutil= new SessionUtil(rp); } catch (IOException ex) { ex.printStackTrace(); } } public void shutdown(){ sutil.closeAll(); } public SessionUtil getSutil(){ return sutil; } **************** SessionUtil public SessionUtil(Repository rp){ try { session = rp.login(new SimpleCredentials("username","password".toCharArray())); } catch (LoginException ex) { ex.printStackTrace(); } catch (RepositoryException ex) { ex.printStackTrace(); } } public void closeAll(){ try { session.logout(); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Error closing repository"); } } // Put a node on the tree under the root node, return the uuid of the new or updated node private String putNode(String nodetype, UnityBaseObject ubo){ String resultuuid =null; String uname = ubo.getName(); String utype = ubo.getType(); String objectuid = ubo.getId(); Node pnode; // node to add or update Session ses = null; try { ses = getSession(); // Does updateable node already have node Id? if (objectuid==null) { Node rn = ses.getRootNode(); pnode = rn.addNode(utype); pnode.addMixin("mix:referenceable"); } else{ // grab existing node by uuid pnode = ses.getNodeByUUID(objectuid); } // Did we get an updateable node? if (pnode!=null){ ubo.setId(pnode.getUUID()); String unityXML = utrans.getXMLStringFromUnityBaseObject(ubo); // update all the properties pnode.setProperty("name",ubo.getName()); pnode.setProperty("type",ubo.getType()); pnode.setProperty("xmldata",unityXML); ses.save(); resultuuid = ubo.getId(); } } catch(Exception e) { e.printStackTrace(); } return resultuuid; } private Session getSession(){ return session; } ************ repository.xml