title: Tomcat 7 locks the jackrabbit repository
body: <p>Hi I am trying to reach my repository via JNDI.</p>
  
  <p>I recieve the following message when i try to connect:</p>
  
  <blockquote>
    <p>"The repository home C:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin\myrepo > appears to be in use since the file named .lock is already locked by the current  process."</p>
  </blockquote>
  
  <p>This code is runing on a web application, deployed on the same Tomcat.</p>
  
  <pre><code>InitialContext context = new InitialContext();
  Context environment = (Context) context.lookup("java:comp/env");        
  Repository repository = (Repository) environment.lookup("jcr/repository");
  </code></pre>
  
  <p>Tomcat is locking "myrepo" when it starts and wont release it until I shuts it down.
  Why is this happening?</p>
  
  <p>Im running apache-tomcat-7.0.53-windows-x64 on Windows 7, using jackrabbit-webapp-2.6.5.war.</p>
  
  <p>Edit May 10:
  I have now tried to edit server.xml ann context.xml for my tomcat.</p>
  
  <p>server.xml:</p>
  
  <pre><code>&lt;GlobalNamingResources&gt;
      &lt;!-- Editable user database that can also be used by
           UserDatabaseRealm to authenticate users --&gt;
      &lt;Resource name="UserDatabase" auth="Container"
                type="org.apache.catalina.UserDatabase"
                description="User database that can be updated and saved"
                factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                pathname="conf/tomcat-users.xml" /&gt;
  
        &lt;Resource configFilePath="C:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin\myrepo\repository.xml"
                factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
                name="jcr/globalRepository" repHomeDir="C:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin\myrepo"
                type="javax.jcr.Repository"
                auth="Container" /&gt;
  
    &lt;/GlobalNamingResources&gt;
  </code></pre>
  
  <p>context.xml</p>
  
  <pre><code>&lt;ResourceLink name="jcr/repository"
                global="jcr/globalRepository"
                type="javax.jcr.Repository"/&gt;
  </code></pre>
  
  <p>The error is still the same.</p>