Encounter exception: The 'absolute()' method is only allowed on scroll cursors.

Bug #489045 reported by kvpetrov on 2009-11-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BoneCP
Fix Released
Medium
Wallace Wadge

Bug Description

When I put bonecp datasource in my application I started to get exception:
The 'absolute()' method is only allowed on scroll cursors.

com.pko.dynmem.service.WordServiceException: Error performing 'com.pko.dynmem.service.WordService.findRandomWord(java.lang.Long conceptCollectionId, java.lang.Long[] seenConceptIds)' --> org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select collection0_.ID as ID18_, collection0_.ATTEMPTS as ATTEMPTS18_, collection0_.FAILURES as FAILURES18_, collection0_.ORDINAL_NUMBER as ORDINAL4_18_, collection0_.SMOOTHED_DIFFICULTY as SMOOTHED5_18_, collection0_.CONCEPT_FK as CONCEPT6_18_, collection0_.COLLECTION_FK as COLLECTION7_18_ from COLLECTIONS_CONCEPT_DETAIL collection0_ inner join CONCEPT_COLLECTION conceptcol1_ on collection0_.COLLECTION_FK=conceptcol1_.ID where conceptcol1_.ID=?]; SQL state [XJ061]; error code [20000]; The 'absolute()' method is only allowed on scroll cursors.; nested exception is java.sql.SQLException: The 'absolute()' method is only allowed on scroll cursors.
 at com.pko.dynmem.service.WordServiceBase.findRandomWord(WordServiceBase.java:470)
 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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
 at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:111)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at $Proxy25.findRandomWord(Unknown Source)
 at com.pko.dynmem.service.TestWordService.testRandomWords(TestWordService.java:37)
 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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
 at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
 at org.junit.runners.Suite.runChild(Suite.java:115)
 at org.junit.runners.Suite.runChild(Suite.java:23)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
 at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
 at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
 at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
 at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
 at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
 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 org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
 at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: java.sql.SQLException: The 'absolute()' method is only allowed on scroll cursors.
 at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
 at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
 at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
 at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
 at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
 at org.apache.derby.impl.jdbc.EmbedResultSet.checkScrollCursor(Unknown Source)
 at org.apache.derby.impl.jdbc.EmbedResultSet.absolute(Unknown Source)
 at org.hibernate.loader.Loader.advance(Loader.java:1502)
 at org.hibernate.loader.Loader.getResultSet(Loader.java:1817)
 at org.hibernate.loader.Loader.doQuery(Loader.java:697)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
 at org.hibernate.loader.Loader.doList(Loader.java:2232)
 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
 at org.hibernate.loader.Loader.list(Loader.java:2124)
 at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
 at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
 at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
 at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
 at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
 at com.pko.dynmem.entity.word.CollectionsConceptDetailDaoBase.findByConceptCollectionId(CollectionsConceptDetailDaoBase.java:579)
 at com.pko.dynmem.entity.word.CollectionsConceptDetailDaoBase.findByConceptCollectionId(CollectionsConceptDetailDaoBase.java:561)
 at com.pko.dynmem.entity.word.CollectionsConceptDetailDaoBase.findByConceptCollectionId(CollectionsConceptDetailDaoBase.java:536)
 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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
 at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:111)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at $Proxy20.findByConceptCollectionId(Unknown Source)
 at com.pko.dynmem.service.WordServiceImpl.handleFindRandomWord(WordServiceImpl.java:136)
 at com.pko.dynmem.service.WordServiceBase.findRandomWord(WordServiceBase.java:466)
 ... 50 more

I replaced bonecp with c3p0, everything seems to be fine now. Spring config looks like:
    <!-- Local DataSource that works in any environment
    <bean id="${beanNamePrefix}dataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">
        <property name="driverClass"><value>${driver}</value></property>
        <property name="jdbcUrl"><value>${connectionUrl}</value></property>
        <property name="username"><value>${username}</value></property>
        <property name="password"><value>${password}</value></property>
        <property name="idleConnectionTestPeriod" value="60"/>
  <property name="idleMaxAge" value="240"/>
  <property name="maxConnectionsPerPartition" value="10"/>
  <property name="minConnectionsPerPartition" value="5"/>
  <property name="partitionCount" value="2"/>
  <property name="acquireIncrement" value="5"/>
  <property name="preparedStatementCacheSize" value="100"/>
  <property name="statementsCachedPerConnection" value="30"/>
  <property name="releaseHelperThreads" value="3"/>
    </bean>

3cp0 config looks like:
   <bean id="${beanNamePrefix}dataSource"
          class="com.mchange.v2.c3p0.ComboPooledDataSource"
          destroy-method="close">

        <property name="driverClass"><value>${driver}</value></property>
        <property name="jdbcUrl"><value>${connectionUrl}</value></property>
        <property name="user"><value>${username}</value></property>
        <property name="password"><value>${password}</value></property>

        <property name="initialPoolSize"><value>3</value></property>
        <property name="minPoolSize"><value>3</value></property>
        <property name="maxPoolSize"><value>15</value></property>
        <!-- <property name="timeout"><value>0</value></property> --> <!-- 0 means: no timeout -->
        <property name="idleConnectionTestPeriod"><value>200</value></property>
        <property name="acquireIncrement"><value>1</value></property>
        <property name="maxStatements"><value>30</value></property> <!-- 0 means: statement caching is turned off. -->
        <property name="numHelperThreads"><value>3</value></property> <!-- 3 is default -->

    </bean>

The database is derby.

Wallace Wadge (wwadge) wrote :

I think I've figured this out.

Can you try disabling the preparedStatementCache by setting it to 0 for now?

i.e. preparedStatementCacheSize = 0 in the config

It will make it a bit slower but should work. I'll provide a fix for this ASAP and let you know.

Thanks for reporting!

Wallace

Changed in bonecp:
importance: Undecided → Medium
assignee: nobody → Wallace Wadge (wwadge)
Wallace Wadge (wwadge) wrote :

Just released v0.5.3-rc1 that should fix this issue. The JARs are available on the main download site (http://jolbox.com) or via maven.

Please test if the fix is ok so that I can issue a full release.

Regards,
Wallace

Changed in bonecp:
status: New → Fix Committed
Wallace Wadge (wwadge) on 2009-12-02
Changed in bonecp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers