This discussion is archived
2 Replies Latest reply: Mar 29, 2012 2:44 AM by 805968 RSS

Unclosed cursors problem

805968 Newbie
Currently Being Moderated
Hi, I have run into a problem while closing an environment. While closing an entity store, I get java.lang.IllegalStateException, that there are cursors open. I do not use any cursors with that entity store, only entity indexes from a secondary index like this:

EntityIndex<IndexClass, DataClass> subIndex = cookieIndex.subIndex(currentIndexItem);

I also insert some items by calling primaryKey.putNoOverwrite() and that's about it.

Still when calling EntityStore.close(), the result is this:

java.lang.IllegalStateException: Database still has 6 open cursors while trying to close.
at com.sleepycat.persist.impl.Store.closeDb(
at com.sleepycat.persist.impl.Store.close(
at com.sleepycat.persist.EntityStore.close(

Any thoughts?
  • 1. Re: Unclosed cursors problem
    greybird Expert
    Currently Being Moderated

    Are you sure you're not calling methods that open cursors, such as the entities() or keys() methods?

    You may not be aware that these methods open a cursor, which must be closed.

  • 2. Re: Unclosed cursors problem
    805968 Newbie
    Currently Being Moderated
    Thank you. There was a call for EntityIndex.entities(), but cursor object was unnamed, and I have failed to spot it. Since I closed it, the error is gone.



  • Correct Answers - 10 points
  • Helpful Answers - 5 points