You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Chris Schmidt <cs...@prospricing.com> on 2011/01/03 23:18:09 UTC
Configuration question with DataSource and TransientRepository
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
RE: Configuration question with DataSource and TransientRepository
Posted by Chris Schmidt <cs...@prospricing.com>.
I was able to create a simple test that reproduces the issue with Derby and Oracle, so I've opened JCR-2870 to track the problem. Does it make sense for the ConnectionFactory to be cleared once the TransientRepository shuts down? It doesn't look like the ConnectionFactory can be reused once it has its closed field set to true.
Thanks,
Chris Schmidt
-----Original Message-----
From: Chris Schmidt [mailto:cschmidt@prospricing.com]
Sent: Tuesday, January 04, 2011 7:19 AM
To: users@jackrabbit.apache.org
Subject: RE: Configuration question with DataSource and TransientRepository
The configuration file is similar to the standard/example configuration file. The only difference is it specifies a custom wrapper class for most items that delegate to either the JackRabbit Oracle or SqlServer instances depending on the database type the application is running against (we maintain a single configuration file and determine at runtime which database type is configured).
Below is a tweaked version of the configuration file currently in use. I switched to use as many 'core' JackRabbit classes to help narrow where the problem is coming from (our custom code vs. Jackrabbit). I can get the same factory closed error with this configuration:
<?xml version="1.0"?>
<!DOCTYPE Repository
PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
"http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
<Repository>
<DataSources>
<DataSource name="ds1">
<param name="driver" value="oracle.jdbc.driver.OracleDriver" />
<param name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" />
<param name="user" value="user" />
<param name="password" value="password" />
<param name="databaseType" value="oracle"/>
</DataSource>
</DataSources>
<!--
virtual file system where the repository stores global state
(e.g. registered namespaces, custom node types, etc.)
-->
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="schemaObjectPrefix" value="JCR_VFS_"/>
<param name="dataSourceName" value="ds1"/>
<param name="tableSpace" value="PDK_DAT"/>
</FileSystem>
<Security appName="Jackrabbit">
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
</AccessManager>
<LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
<param name="anonymousId" value="anonymous"/>
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
<Workspace name="Jackrabbit Core">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_WSFS_"/>
<param name="tableSpace" value="PDK_DAT"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_BNDL_WSPM_"/>
<param name="tableSpace" value="PDK_DAT"/>
</PersistenceManager>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/lucene/index"/>
<param name="indexingConfiguration"
value="${rep.home}/../../../jcr/indexing_configuration.xml"/>
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_VERFS_"/>
<param name="tableSpace" value="PDK_DAT"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_BNDL_VERPM_"/>
<param name="tableSpace" value="PDK_DAT"/>
</PersistenceManager>
</Versioning>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/lucene/repository/index"/>
</SearchIndex>
<Cluster syncDelay="60000">
<Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
<param name="schemaObjectPrefix" value="JCR_JNL_"/>
<param name="tableSpace" value="PDK_DAT"/>
<param name="dataSourceName" value="ds1"/>
</Journal>
</Cluster>
</Repository>
-----Original Message-----
From: Thomas Mueller [mailto:mueller@adobe.com]
Sent: Tuesday, January 04, 2011 2:07 AM
To: users@jackrabbit.apache.org
Subject: Re: Configuration question with DataSource and TransientRepository
Hi,
How does your configuration files look like?
Regards,
Thomas
RE: Configuration question with DataSource and TransientRepository
Posted by Chris Schmidt <cs...@prospricing.com>.
The configuration file is similar to the standard/example configuration file. The only difference is it specifies a custom wrapper class for most items that delegate to either the JackRabbit Oracle or SqlServer instances depending on the database type the application is running against (we maintain a single configuration file and determine at runtime which database type is configured).
Below is a tweaked version of the configuration file currently in use. I switched to use as many 'core' JackRabbit classes to help narrow where the problem is coming from (our custom code vs. Jackrabbit). I can get the same factory closed error with this configuration:
<?xml version="1.0"?>
<!DOCTYPE Repository
PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
"http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
<Repository>
<DataSources>
<DataSource name="ds1">
<param name="driver" value="oracle.jdbc.driver.OracleDriver" />
<param name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" />
<param name="user" value="user" />
<param name="password" value="password" />
<param name="databaseType" value="oracle"/>
</DataSource>
</DataSources>
<!--
virtual file system where the repository stores global state
(e.g. registered namespaces, custom node types, etc.)
-->
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="schemaObjectPrefix" value="JCR_VFS_"/>
<param name="dataSourceName" value="ds1"/>
<param name="tableSpace" value="PDK_DAT"/>
</FileSystem>
<Security appName="Jackrabbit">
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
</AccessManager>
<LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
<param name="anonymousId" value="anonymous"/>
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
<Workspace name="Jackrabbit Core">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_WSFS_"/>
<param name="tableSpace" value="PDK_DAT"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_BNDL_WSPM_"/>
<param name="tableSpace" value="PDK_DAT"/>
</PersistenceManager>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/lucene/index"/>
<param name="indexingConfiguration"
value="${rep.home}/../../../jcr/indexing_configuration.xml"/>
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_VERFS_"/>
<param name="tableSpace" value="PDK_DAT"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
<param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="JCR_BNDL_VERPM_"/>
<param name="tableSpace" value="PDK_DAT"/>
</PersistenceManager>
</Versioning>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/lucene/repository/index"/>
</SearchIndex>
<Cluster syncDelay="60000">
<Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
<param name="schemaObjectPrefix" value="JCR_JNL_"/>
<param name="tableSpace" value="PDK_DAT"/>
<param name="dataSourceName" value="ds1"/>
</Journal>
</Cluster>
</Repository>
-----Original Message-----
From: Thomas Mueller [mailto:mueller@adobe.com]
Sent: Tuesday, January 04, 2011 2:07 AM
To: users@jackrabbit.apache.org
Subject: Re: Configuration question with DataSource and TransientRepository
Hi,
How does your configuration files look like?
Regards,
Thomas
Re: Configuration question with DataSource and TransientRepository
Posted by Thomas Mueller <mu...@adobe.com>.
Hi,
How does your configuration files look like?
Regards,
Thomas