[ https://issues.apache.org/jira/browse/JCR-1879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12701564#action_12701564 ]
Ryan Vanderwerf commented on JCR-1879: -------------------------------------- I'm having the same issue in 1.4.2. Is this issue back ported to a 1.5 release? > "Directory was previously created with a different LockFactory" when open, > close, delete a repository in a loop > --------------------------------------------------------------------------------------------------------------- > > Key: JCR-1879 > URL: https://issues.apache.org/jira/browse/JCR-1879 > Project: Jackrabbit Content Repository > Issue Type: Bug > Components: jackrabbit-core > Affects Versions: 1.6.0 > Environment: Mac OS X > Reporter: Thomas Mueller > Priority: Minor > Fix For: 1.6.0 > > > Opening a TransientRepository in a loop throws the exception "Directory was > previously created with a different LockFactory instance". > Test case: > for (int i = 0; i < 3; i++) { > FileUtils.deleteDirectory(new File("repository")); > Repository rep = new TransientRepository(); > Session session = rep.login(new SimpleCredentials("", new char[0])); > session.logout(); > } > The problem seems to be that org.apache.lucene.store.FSDirectory.DIRECTORIES > is not cleared (FSDirectory.close() is not called?). > Stack trace: > Exception in thread "main" javax.jcr.RepositoryException: Directory was > previously created with a different LockFactory instance; please pass null as > the lockFactory instance and use setLockFactory to change it: Directory was > previously created with a different LockFactory instance; please pass null as > the lockFactory instance and use setLockFactory to change it: Directory was > previously created with a different LockFactory instance; please pass null as > the lockFactory instance and use setLockFactory to change it > at > org.apache.jackrabbit.core.SearchManager.initializeQueryHandler(SearchManager.java:555) > at > org.apache.jackrabbit.core.SearchManager.<init>(SearchManager.java:239) > at > org.apache.jackrabbit.core.RepositoryImpl.getSystemSearchManager(RepositoryImpl.java:688) > at > org.apache.jackrabbit.core.RepositoryImpl.access$3(RepositoryImpl.java:681) > at > org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager(RepositoryImpl.java:1780) > at > org.apache.jackrabbit.core.RepositoryImpl.initWorkspace(RepositoryImpl.java:667) > at > org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:480) > at > org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:321) > at > org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:618) > at > org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:241) > at > org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:261) > Caused by: java.io.IOException: Directory was previously created with a > different LockFactory instance; please pass null as the lockFactory instance > and use setLockFactory to change it > at > org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:192) > at > org.apache.jackrabbit.core.query.lucene.directory.FSDirectoryManager.getDirectory(FSDirectoryManager.java:64) > at > org.apache.jackrabbit.core.query.lucene.MultiIndex.<init>(MultiIndex.java:227) > at > org.apache.jackrabbit.core.query.lucene.SearchIndex.doInit(SearchIndex.java:477) > at > org.apache.jackrabbit.core.query.AbstractQueryHandler.init(AbstractQueryHandler.java:59) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.