You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Patrick Haggood (JIRA)" <ji...@apache.org> on 2007/05/11 15:13:15 UTC

[jira] Created: (JCR-912) OverlappingFileLockException using DerbyPersistenceManager

OverlappingFileLockException using DerbyPersistenceManager
----------------------------------------------------------

                 Key: JCR-912
                 URL: https://issues.apache.org/jira/browse/JCR-912
             Project: Jackrabbit
          Issue Type: Bug
          Components: core
    Affects Versions: 1.3
         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
            Reporter: Patrick Haggood


Per email discussion:
On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > just my 2c, I didn't really investigated this issue in more detail...
> >
> > according to the javadoc of FileChannel.tryLock() the
> > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > channel.
> >
> > in contrast, the current check in the repository startup method primarily
> > focuses on the situation where *two* JVMs start a repository on the same home
> > directory.
> >
> > I'd say the OverlappingFileLockException is thrown because two repository
> > instances are startup within the *same* JVM using the same repository home
> > directory.
> >
> > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > in addition to IOException.
> >
> > regards
> >   marcel
> >
> > Stefan Guggisberg wrote:
> > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > >
> > > you might want to test on a different platform to further isolate the
> > > issue.
> > > you could also place a breakpoint at the top of the
> > > RepositoryImpl#acquireRepositoryLock
> > > method, step through the code, verify the contents of your fs etc.
> >
>


=== Original email

On 2/19/07, Patrick Haggood <codezilla@> wrote:
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

 <Workspace name="${wsp.name}">
        <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
            <param name="path" value="${wsp.home}"/>
        </FileSystem>
        <PersistenceManager
class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
            <param name="url" value="jdbc:derby:
${wsp.home}/db;create=true"/>
            <param name="schemaObjectPrefix" value="${wsp.name}_"/>
        </PersistenceManager>
        <SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
            <param name="path" value="${wsp.home}/index"/>
            <param name="useCompoundFile" value="true"/>
            <param name="minMergeDocs" value="100"/>
            <param name="volatileIdleTime" value="3"/>
            <param name="maxMergeDocs" value="100000"/>
            <param name="mergeFactor" value="10"/>
            <param name="bufferSize" value="10"/>
            <param name="cacheSize" value="1000"/>
            <param name="forceConsistencyCheck" value="false"/>
            <param name="autoRepair" value="true"/>
            <param name="analyzer"
value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
        </SearchIndex>
    </Workspace>



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-912) OverlappingFileLockException with JRE 1.6

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg updated JCR-912:
----------------------------------

    Summary: OverlappingFileLockException with JRE 1.6  (was: OverlappingFileLockException with JRE 16)

> OverlappingFileLockException with JRE 1.6
> -----------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>         Assigned To: Stefan Guggisberg
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-912) OverlappingFileLockException with JRE 1.6

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526186 ] 

Stefan Guggisberg commented on JCR-912:
---------------------------------------

steve:

please note that this issue refers to the fact that java.nio.channels.OverlappingFileLockException was not caught in jackrabbit < 1.3.1.
this has been fixed in 1.3.1.

however, your 'error' indicates that the specified repository home is already in use, i.e. there's already a Jackrabbit instance running in the same home directory. that's a legitimate error condition and not a bug. 



> OverlappingFileLockException with JRE 1.6
> -----------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>            Assignee: Stefan Guggisberg
>             Fix For: 1.3.1
>
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (JCR-912) OverlappingFileLockException using DerbyPersistenceManager

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg reassigned JCR-912:
-------------------------------------

    Assignee: Stefan Guggisberg

> OverlappingFileLockException using DerbyPersistenceManager
> ----------------------------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>         Assigned To: Stefan Guggisberg
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-912) OverlappingFileLockException with JRE 1.6

Posted by "steve neo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525896 ] 

steve neo commented on JCR-912:
-------------------------------

After I upgrade to 1.3.1, I still got this error. I am using ubuntu server, java version is (build 1.6.0-b105). Obviously, i am not only one person to get this error in 1.3.1. Here is a post in maillist http://www.mail-archive.com/users@jackrabbit.apache.org/msg04351.html.


Here is my error. 
javax.jcr.RepositoryException: The repository home /var/wibokr/data/repository appears to be in use since the file named .lock is already locked by the current process.
        at org.apache.jackrabbit.core.util.RepositoryLock.acquire(RepositoryLock.java:122)
        at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:229)
        at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:521)
        at org.springmodules.jcr.jackrabbit.RepositoryFactoryBean.createRepository(RepositoryFactoryBean.java:57)
        at org.springmodules.jcr.RepositoryFactoryBean.afterPropertiesSet(RepositoryFactoryBean.java:57)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
 

> OverlappingFileLockException with JRE 1.6
> -----------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>            Assignee: Stefan Guggisberg
>             Fix For: 1.3.1
>
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-912) OverlappingFileLockException with JRE 1.6

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg resolved JCR-912.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4

fixed in svn r539491.

thanks for reporting this issue!

> OverlappingFileLockException with JRE 1.6
> -----------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>         Assigned To: Stefan Guggisberg
>             Fix For: 1.4
>
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-912) OverlappingFileLockException with JRE 16

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg updated JCR-912:
----------------------------------

    Summary: OverlappingFileLockException with JRE 16  (was: OverlappingFileLockException using DerbyPersistenceManager)

not derby-related

> OverlappingFileLockException with JRE 16
> ----------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>         Assigned To: Stefan Guggisberg
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-912) OverlappingFileLockException with JRE 1.6

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-912:
------------------------------

    Fix Version/s:     (was: 1.4)
                   1.3.1

Merged to the 1.3 branch in revision 544248.

> OverlappingFileLockException with JRE 1.6
> -----------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>            Assignee: Stefan Guggisberg
>             Fix For: 1.3.1
>
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-912) OverlappingFileLockException with JRE 1.6

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496902 ] 

Stefan Guggisberg commented on JCR-912:
---------------------------------------

the problem is that java.nio.channels.OverlappingFileLockException 
is not caught in RepositoryImpl.acquireRepositoryLock().

the issue apparently only occurs on java1.6. 

> OverlappingFileLockException with JRE 1.6
> -----------------------------------------
>
>                 Key: JCR-912
>                 URL: https://issues.apache.org/jira/browse/JCR-912
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>         Environment: Linux + Java6; however, per http://blogs.sun.com/DaveB/date/200612, this may be a problem on all Java6 platforms
>            Reporter: Patrick Haggood
>         Assigned To: Stefan Guggisberg
>
> Per email discussion:
> On Mon, 2007-02-26 at 10:26 +0100, Marcel Reutegger wrote:
> > > just my 2c, I didn't really investigated this issue in more detail...
> > >
> > > according to the javadoc of FileChannel.tryLock() the
> > > OverlappingFileLockException is thrown if the JVM already holds a lock on the
> > > channel.
> > >
> > > in contrast, the current check in the repository startup method primarily
> > > focuses on the situation where *two* JVMs start a repository on the same home
> > > directory.
> > >
> > > I'd say the OverlappingFileLockException is thrown because two repository
> > > instances are startup within the *same* JVM using the same repository home
> > > directory.
> > >
> > > I suggest we add a catch clause, which also covers OverlappingFileLockException
> > > in addition to IOException.
> > >
> > > regards
> > >   marcel
> > >
> > > Stefan Guggisberg wrote:
> > > > btw, afaik OverlappingFileLockException is only thrown on linux,
> > > > FileChannel#getLock on windows e.g. returns null in the same situation.
> > > >
> > > > you might want to test on a different platform to further isolate the
> > > > issue.
> > > > you could also place a breakpoint at the top of the
> > > > RepositoryImpl#acquireRepositoryLock
> > > > method, step through the code, verify the contents of your fs etc.
> > >
> >
> === Original email
> On 2/19/07, Patrick Haggood <codezilla@> wrote:
> 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
>  <Workspace name="${wsp.name}">
>         <FileSystem
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
>             <param name="url" value="jdbc:derby:
> ${wsp.home}/db;create=true"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>         </PersistenceManager>
>         <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="useCompoundFile" value="true"/>
>             <param name="minMergeDocs" value="100"/>
>             <param name="volatileIdleTime" value="3"/>
>             <param name="maxMergeDocs" value="100000"/>
>             <param name="mergeFactor" value="10"/>
>             <param name="bufferSize" value="10"/>
>             <param name="cacheSize" value="1000"/>
>             <param name="forceConsistencyCheck" value="false"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>         </SearchIndex>
>     </Workspace>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.