Search code examples
oracle11gjcrjackrabbit

Unable to create JOURNAL_VERSIONS table for jackrabbit in Oracle. {tablespace} variable is not resolved


I have been trying to configure Jackrabbit with Oracle. I get an exception while the schema check is performed for the version table in cluster.

While the cluster configuration is being initialized it calls the init() method in the DataBaseJournal class. In there it calls checkLocalRevisionSchema(); That method in turns call CheckSchemaOperation.run() to check whether the LOCAL_REVISIONS table exists if not it creates it. At first time it does not have the table so it tries to create the table with:

create table ${schemaObjectPrefix}JOURNAL (
  REVISION_ID number(20,0) NOT NULL,
  JOURNAL_ID varchar(255),
  PRODUCER_ID varchar(255),
  REVISION_DATA blob
)
${tablespace} 

Before executing the query the variable ${schemOBjectPrefix} is replaced with PBVP_Journal but the ${tablespace} is not being replaced. I am not sure what I am doing wrong.

My file system and persistence manager configuration looks like:

<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
 <param name="driver" value="javax.naming.InitialContext"/>
 <param name="url" value="java:/jcr/repositoryDB"/>
 <param name="schemaObjectPrefix" value="PBVP_version_"/>
 <param name="schema" value="oracle"/>
</FileSystem>
<PersistenceManager  class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
<param name="driver" value="javax.naming.InitialContext"/>
<param name="url"  value="java:/jcr/repositoryDB"/>
<param name="databaseType" value="oracle"/>
<param name="schemaObjectPrefix" value="PBVP_version_"/>
<param name="bundleCacheSize" value="32"/>
<param name="tableSpace" value="default"/>
</PersistenceManager>
</Versioning>

My cluster configuration looks like

 <Cluster id="node1" syncDelay="2000">
                          <Journal   class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
 <param name="revision"  value="${rep.home}/revision.log"/>
 <param name="driver" value="javax.naming.InitialContext"/>
  <param name="url" value="java:/jcr/repositoryDB"/>
   <param name="schemaObjectPrefix" value="PBVP_journal_"/>
  <param name="databaseType" value="oracle"/>
  <param name="schemaCheckEnabled" value="false"/>
    <param name="tablespace" value="default"/>
                          </Journal>
           </Cluster>

Solution

  • Finally now I know what is going on.The Jackrabbit configuration loading mechanism goes through two routes

    1. When jackrabbit is deployed for the first time it executes table creation statements through the class OracleDatabaseJournal which is aware of ${tablespace} so it resolves it.
    2. When it is deployed second time and the first deployment fails it executes through DatabaseJournal class which is base class of OracleDatabaseJournal it does not know about ${tablespace} so it does not resolve it.

    When I debugged I was following the second route so I concentrated on why does not it try to resolve the ${tablespace} in the sql statement. It should not take the second route if the first deployment is success. In our case the first deployment failed because of the length of table name. If we change the length of the table name it deploys ok so it should never come to second scenario