Monday, August 20, 2012

BundleDbPersistenceManager.java:901 FATAL error while writing the bundle: deadbeef-cafe-babe-cafe-babecafebabe

I got the below exception when I try to configure Jackrabbit with mysql on Tomcat.


BundleDbPersistenceManager.java:901 FATAL error while writing the bundle: deadbeef-cafe-babe-cafe-babecafebabe
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'Þ­¾ïÊþº¾Êþº¾Êþº¾' for key 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_05]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_05]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_05]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[na:1.7.0_05]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379) ~[mysql-connector-java-5.1.21-bin.jar:na]
        at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169) ~[commons-dbcp-1.2.2.jar:1.2.2]
        at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169) ~[commons-dbcp-1.2.2.jar:1.2.2]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.execute(ConnectionHelper.java:473) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.reallyUpdate(ConnectionHelper.java:335) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper$2.call(ConnectionHelper.java:323) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper$2.call(ConnectionHelper.java:319) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper$RetryManager.doTry(ConnectionHelper.java:486) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.update(ConnectionHelper.java:319) ~[jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:888) [jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.putBundle(AbstractBundlePersistenceManager.java:769) [jackrabbit-core-2.4.0.jar:2.4.0]
        at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.storeInternal(AbstractBundlePersistenceManager.java:686) [jackrabbit-core-2.4.0.jar:2.4.0]


I was following the instructions here [1], but it doesn't provide the proper instruction on how to edit the repository.xml file. The above issue comes when you give the wrong schemaObjectPrefix
when you edit the repository.xml. If you give the same schemaObjectPrefix for workspace configuration and version configuration it will give you the above error. So when you follow the instructions in [1], you have to make sure that you will give unique schemaObjectPrefix for both configuration. You can download a working repository.xml here.


[1]http://wiki.apache.org/jackrabbit/JackrabbitOnTomcat6