目前處於使用Apache Jackrabbit和Oracle數據庫進行評估的早期階段。當測試的repository.xml配置的初始設置,收到此錯誤:Root Node Bundle上的唯一約束違規,Oracle Jackrabbit with Oracle
15:18:32.281 [main] ERROR o.a.j.c.p.p.BundleDbPersistenceManager - FATAL error while writing the bundle: deadbeef-cafe-babe-cafe-babecafebabe
java.sql.SQLException: ORA-00001: unique constraint (REPO_BUNDLE_IDX) violated
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:754) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:972) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1192) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3415) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3521) ~[ojdbc14-10.2.0.4.jar:Oracle JDBC Driver version - "10.2.0.5.0"]
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) ~[commons-dbcp-1.3.jar:1.3]
at org.apache.jackrabbit.core.util.db.ConnectionHelper.execute(ConnectionHelper.java:515) ~[jackrabbit-data-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.util.db.ConnectionHelper.reallyUpdate(ConnectionHelper.java:344) ~[jackrabbit-data-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.util.db.ConnectionHelper$2.call(ConnectionHelper.java:331) ~[jackrabbit-data-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.util.db.ConnectionHelper$2.call(ConnectionHelper.java:327) ~[jackrabbit-data-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.util.db.ConnectionHelper$RetryManager.doTry(ConnectionHelper.java:536) ~[jackrabbit-data-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.util.db.ConnectionHelper.update(ConnectionHelper.java:327) ~[jackrabbit-data-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:950) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.putBundle(AbstractBundlePersistenceManager.java:800) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.storeInternal(AbstractBundlePersistenceManager.java:715) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.store(AbstractBundlePersistenceManager.java:593) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager.store(BundleDbPersistenceManager.java:482) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.state.SharedItemStateManager.createRootNodeState(SharedItemStateManager.java:1725) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.state.SharedItemStateManager.<init>(SharedItemStateManager.java:217) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.RepositoryImpl.createItemStateManager(RepositoryImpl.java:1396) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doInitialize(RepositoryImpl.java:2062) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:2035) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:543) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:326) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:615) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.TransientRepository$3.getRepository(TransientRepository.java:250) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:280) [jackrabbit-core-2.12.4.jar:2.12.4]
at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:376) [jackrabbit-core-2.12.4.jar:2.12.4]
調試,我可以看到,它首先檢查,如果這包 - 在System Root Node
- 存在,而且它已經找到它在數據庫中,但那麼當試圖插入不在數據庫中的Root Node
時,它會嘗試再次插入System Root Node
,這也是它違反約束條件的地方。
這是我用來創建存儲庫實例代碼:
Map<String, String> props = new HashMap<>();
props.put(RepositoryFactoryImpl.REPOSITORY_HOME, "jackrabbit");
props.put(RepositoryFactoryImpl.REPOSITORY_CONF, "classpath:jackrabbit/repository.xml");
Repository repository = JcrUtils.getRepository(props);
repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
而且我的repository.xml:
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="url" value="jdbc:oracle:thin:@mydb:1521:XE"/>
<param name="user" value="myuser"/>
<param name="password" value="mypassword"/>
<param name="schemaObjectPrefix" value="REPO_"/>
<param name="schemaCheckEnabled" value="false"/>
</FileSystem>
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
<param name="url" value="jdbc:oracle:thin:@mydb:1521:XE"/>
<param name="user" value="myuser"/>
<param name="password" value="mypassword"/>
<param name="databaseType" value="oracle"/>
<param name="driver" value="oracle.jdbc.driver.OracleDriver"/>
<param name="schemaObjectPrefix" value="REPO_"/>
<param name="schemaCheckEnabled" value="false"/>
</DataStore>
<Security appName="Jackrabbit">
<SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager"
workspaceName="security"/>
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"/>
<LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"/>
</Security>
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="ContentRepo"/>
<Workspace name="ContentRepo">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="url" value="jdbc:oracle:thin:@mydb:1521:XE"/>
<param name="user" value="myuser"/>
<param name="password" value="mypassword"/>
<param name="schemaObjectPrefix" value="REPO_"/>
<param name="schemaCheckEnabled" value="false"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
<param name="url" value="jdbc:oracle:thin:@mydb:1521:XE"/>
<param name="user" value="myuser"/>
<param name="password" value="mypassword"/>
<param name="schemaObjectPrefix" value="REPO_"/>
<param name="schemaCheckEnabled" value="false"/>
</PersistenceManager>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/index"/>
<param name="textFilterClasses" value="org.apache.jackrabbit.extractor.PlainTextExtractor,org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
<param name="extractorPoolSize" value="2"/>
<param name="supportHighlighting" value="true"/>
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="url" value="jdbc:oracle:thin:@mydb:1521:XE"/>
<param name="user" value="myuser"/>
<param name="password" value="mypassword"/>
<param name="schemaObjectPrefix" value="REPO_"/>
<param name="schemaCheckEnabled" value="false"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
<param name="url" value="jdbc:oracle:thin:@mydb:1521:XE"/>
<param name="user" value="myuser"/>
<param name="password" value="mypassword"/>
<param name="schemaObjectPrefix" value="REPO_"/>
<param name="schemaCheckEnabled" value="false"/>
</PersistenceManager>
</Versioning>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index"/>
<param name="textFilterClasses" value="org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
<param name="extractorPoolSize" value="2"/>
<param name="supportHighlighting" value="true"/>
</SearchIndex>
<Cluster>
<Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
<param name="url" value="jdbc:oracle:thin:@mydb:1521:XE"/>
<param name="user" value="myuser"/>
<param name="password" value="mypassword"/>
<param name="schemaObjectPrefix" value="REPO_"/>
<param name="schemaCheckEnabled" value="false"/>
</Journal>
</Cluster>
版本: Oracle 11.2.0
Java 8
Apache Jackrabbit 2.12.4
任何幫助表示讚賞。