I have an application that can start a regular (RepositoryImpl) repository or 
a transient repository.  I have upgraded to JackRabbit 2.1.2 and have noticed a 
problem when using the transient repository.  The filesystem configuration is 
using a DataSource to configure the database through JNDI.  The first session 
used works fine.  The filesystem initializes and a ConnectionFactory is 
injected into the instance.  Once the session closes, the connection factory is 
shutdown and its internal field 'closed' is set to true.

  On the next call to the repository, the transient repository creates a new 
instance of the filesystem, which gets the same connection factory instance 
that was previously created injected into it.  The factory has already 
shutdown, so as soon as the getDataSource() method is called the sanityCheck() 
method within the ConnectionFactory throws an IllegalStateException saying that 
the factory has already been closed.

  I looked through JIRA but didn't see anything similar to the problem I'm 
encountering.  Is it expected that the ConnectionFactory will be cached after 
the repository is shut down?  I can restructure the code so the transient 
repository is never used, but I'd like to verify whether I have a configuration 
issue or uncovered an actual defect first.  The resulting stacktrace is:

2011-01-03 15:37:47,495 [Thread-3] ERROR - failed to start Repository: File 
system initialization failure.
javax.jcr.RepositoryException: File system initialization failure.
                at 
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$6.getFileSystem(RepositoryConfigurationParser.java:1064)
                at 
org.apache.jackrabbit.core.config.RepositoryConfig.getFileSystem(RepositoryConfig.java:892)
                at 
org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:311)
                at 
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673)
                at 
org.apache.jackrabbit.core.TransientRepository$1.getRepository(TransientRepository.java:179)
                at 
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:279)
                at 
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:375)
                ...
Caused by: org.apache.jackrabbit.core.fs.FileSystemException: failed to 
initialize file system
                at 
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:210)
                at 
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$6.getFileSystem(RepositoryConfigurationParser.java:1061)
                ... 19 more
Caused by: java.lang.IllegalStateException: this factory has already been closed
                at 
org.apache.jackrabbit.core.util.db.ConnectionFactory.sanityCheck(ConnectionFactory.java:213)
                at 
org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataBaseType(ConnectionFactory.java:134)
                at 
org.apache.jackrabbit.core.fs.db.DbFileSystem.getDataSource(DbFileSystem.java:228)
                at 
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:190)

Thanks,

  Chris Schmidt

Reply via email to