You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by AshokBS <as...@altimetrik.com> on 2014/03/14 10:21:46 UTC

Why do i get this OverlappingFileLockException exception?

Why am i getting this exception even though i am still trying to register the
repository:

*catch (OverlappingFileLockException e) {
            // JCR-912: OverlappingFileLockException with JRE 1.6
            throw new RepositoryException(
                    "The repository home " + directory + " appears to be in
use"
                    + " since the file named " + file.getName()
                    + " is already locked by the current process.");
        }*

I have used the below setup as described below:

1) In bootstrap.properties , I have the following settings:
repository.config=/jackrabbit/repository/repository.xml
repository.home=/jackrabbit/repository
repository.name=jackrabbit.repository

# RMI Settings
rmi.enabled=true
rmi.port=0
rmi.host=localhost
jndi.enabled=true

2) In my java code, i am trying this:

*******************************************************************
private static Repository getRepository() throws NamingException,
RepositoryException {
  String configFile = "/jackrabbit/repository/repository.xml";
  String repHomeDir = "/jackrabbit/repository";

  Hashtable<String,String> env = new Hashtable<String,String>();
 
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.jackrabbit.core.jndi.provider.
DummyInitialContextFactory");
  env.put(Context.PROVIDER_URL, "localhost");
  InitialContext ctx = new InitialContext(env);
 
RegistryHelper.registerRepository(ctx,"jackrabbit.repository",configFile,repHomeDir,
true); //line 9
  Repository r = (Repository)ctx.lookup("jackrabbit.repository"); //line10
  return r;
}  

*******************************************************************
By the time it reaches line9, a .lock file is already found in the location
D:/jackrabbit/repository and hence the above exception? Please can anyone
explaing, why this exception is happening even though the repository is not
yet registered ? why the lock file is created and hence not allowing to
succeed to line10 above. Any thoughts??






--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Why-do-i-get-this-OverlappingFileLockException-exception-tp4660526.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.