You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Karianne Berg <ke...@start.no> on 2008/04/18 21:29:16 UTC
H2PersistenceManager
Hello all,
I'm trying to speed up my DAO tests by using the H2 persistence manager. Till now, I have used Derby Persistence Manager, and everything have worked fine. When I try to run my tests with H2, I get the stacktrace shown below. My configuration for the workspace persistence manager is the following (pretty much copied from javadocs for H2PersistenceManager):
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager">
<param name="bundleCacheSize" value="8"/>
<param name="consistencyCheck" value="false"/>
<param name="minBlobSize" value="16384"/>
<param name="driver" value="org.hsqldb.jdbcDriver"/>
<param name="url" value="jdbc:hsqldb:file:${wsp.home}/db/itemState"/>
<param name="user" value="sa"/>
<param name="password" value=""/>
<param name="schema" value="native"/>
<param name="schemaObjectPrefix" value=""/>
<param name="errorHandling" value=""/>
</PersistenceManager>
The configuration for the versioning persistence manager is almost identical, only with a different url value ("jdbc:hsqldb:file:version/db/itemState"). Does anyone know what the cause of the stacktrace is?
Btw, why is it called H2PersistenceManager when it is using the HSQLDB database?
Thank you for reading this.
Best regards,
Karianne Berg
Stacktrace from log:
ERROR [main] (RepositoryImpl.java:339) - failed to start Repository: Cannot instantiate persistence manager org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager: Unexpected token: LOCK_TIMEOUT in statement [SET LOCK_TIMEOUT]
javax.jcr.RepositoryException: Cannot instantiate persistence manager org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager: Unexpected token: LOCK_TIMEOUT in statement [SET LOCK_TIMEOUT]: Unexpected token: LOCK_TIMEOUT in statement [SET LOCK_TIMEOUT]
at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1163)
at org.apache.jackrabbit.core.RepositoryImpl.createVersionManager(RepositoryImpl.java:383)
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:293)
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:550)
at org.apache.jackrabbit.core.TransientRepository$1.getRepository(TransientRepository.java:186)
at org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:265)
at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:333)
at org.springmodules.jcr.JcrSessionFactory.getSession(JcrSessionFactory.java:268)
at org.springmodules.jcr.jackrabbit.LocalTransactionManager.doBegin(LocalTransactionManager.java:116)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)
at no.uib.ii.dpg2.core.persistence.jcr.JcrPatternDao$$EnhancerByCGLIB$$57f9abe5.importPattern(<generated>)
at no.uib.ii.dpg2.core.persistence.jcr.JcrPatternDaoTest.testGetExistingPatternById(JcrPatternDaoTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:65)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.sql.SQLException: Unexpected token: LOCK_TIMEOUT in statement [SET LOCK_TIMEOUT]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source)
at org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager.checkSchema(H2PersistenceManager.java:107)
at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.init(BundleDbPersistenceManager.java:565)
at org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager.init(H2PersistenceManager.java:98)
at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1159)
... 36 more
java.sql.SQLException: Unexpected token: LOCK_TIMEOUT in statement [SET LOCK_TIMEOUT]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source)
at org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager.checkSchema(H2PersistenceManager.java:107)
at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.init(BundleDbPersistenceManager.java:565)
at org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager.init(H2PersistenceManager.java:98)
at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1159)
at org.apache.jackrabbit.core.RepositoryImpl.createVersionManager(RepositoryImpl.java:383)
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:293)
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:550)
at org.apache.jackrabbit.core.TransientRepository$1.getRepository(TransientRepository.java:186)
at org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:265)
at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:333)
at org.springmodules.jcr.JcrSessionFactory.getSession(JcrSessionFactory.java:268)
at org.springmodules.jcr.jackrabbit.LocalTransactionManager.doBegin(LocalTransactionManager.java:116)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)
at no.uib.ii.dpg2.core.persistence.jcr.JcrPatternDao$$EnhancerByCGLIB$$57f9abe5.importPattern(<generated>)
at no.uib.ii.dpg2.core.persistence.jcr.JcrPatternDaoTest.testGetExistingPatternById(JcrPatternDaoTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:65)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Re: H2PersistenceManager
Posted by Thomas Mueller <th...@gmail.com>.
Hello,
> Thank you for your help, now it works. However, the javadocs for H2PersistenceManager says this:
...
> <param name="driver" value="org.hsqldb.jdbcDriver"/>
> <param name="url" value="jdbc:hsqldb:file:${wsp.home}/db/itemState"/>
> I just copied my configuration from here. Perhaps someone should update the javadocs.
The problem will be fixed in Jackrabbit 1.5, see also:
https://issues.apache.org/jira/browse/JCR-1546
I have also removed the shutdown code because this is not required for
H2; however it will probably not affect you.
To configure H2 you could just use: <PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager"/>
The complete list of settings is:
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager">
<param name="bundleCacheSize" value="8"/>
<param name="consistencyCheck" value="false"/>
<param name="minBlobSize" value="16384"/>
<param name="driver" value="org.h2.Driver"/>
<param name="url" value="jdbc:h2:file:${wsp.home}/db/itemState"/>
<param name="user" value="sa"/>
<param name="password" value="sa"/>
<param name="schema" value="h2"/>
<param name="schemaObjectPrefix" value=""/>
<param name="errorHandling" value=""/>
<param name="lockTimeout" value="10000"/>
</PersistenceManager>
Regards,
Thomas
RE: H2PersistenceManager
Posted by Karianne Berg <ke...@start.no>.
Hello,
Thank you for your help, now it works. However, the javadocs for H2PersistenceManager says this:
public class H2PersistenceManager
extends BundleDbPersistenceManager
Extends the BundleDbPersistenceManager by H2 specific code.
Configuration:
<param name="bundleCacheSize" value="8"/>
<param name="consistencyCheck" value="false"/>
<param name="minBlobSize" value="16384"/>
<param name="driver" value="org.hsqldb.jdbcDriver"/>
<param name="url" value="jdbc:hsqldb:file:${wsp.home}/db/itemState"/>
<param name="user" value="sa"/>
<param name="password" value=""/>
<param name="schema" value="native"/>
<param name="schemaObjectPrefix" value=""/>
<param name="errorHandling" value=""/>
<param name="setLockTimeout(String) (String) lockTimeout}" value="10000"/>
I just copied my configuration from here. Perhaps someone should update the javadocs.
Best regards,
Karianne Berg
-----Original Message-----
From: Thomas Mueller [mailto:thomas.tom.mueller@gmail.com]
Sent: Friday, April 18, 2008 11:00 PM
To: users@jackrabbit.apache.org
Subject: Re: H2PersistenceManager
Hi,
You have used the persistence manager for the H2 database, but in the
database URL you have used HSQLDB. Those are two different databases.
H2: http://www.h2database.com
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager">
<param name="driver" value="org.h2.Driver"/>
<param name="url" value="jdbc:h2:file:${wsp.home}/db/itemState"/>
HSQLDB: http://www.hsqldb.org
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager">
<param name="driver" value="org.hsqldb.jdbcDriver"/>
<param name="url" value="jdbc:hsqldb:file:${wsp.home}/db/itemState"/>
Regards,
Thomas
Re: H2PersistenceManager
Posted by Thomas Mueller <th...@gmail.com>.
Hi,
You have used the persistence manager for the H2 database, but in the
database URL you have used HSQLDB. Those are two different databases.
H2: http://www.h2database.com
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager">
<param name="driver" value="org.h2.Driver"/>
<param name="url" value="jdbc:h2:file:${wsp.home}/db/itemState"/>
HSQLDB: http://www.hsqldb.org
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager">
<param name="driver" value="org.hsqldb.jdbcDriver"/>
<param name="url" value="jdbc:hsqldb:file:${wsp.home}/db/itemState"/>
Regards,
Thomas