Forum Stats

  • 3,769,970 Users
  • 2,253,039 Discussions
  • 7,875,254 Comments

Discussions

Attempt to use non-open Environment object().

535385
535385 Member Posts: 3
edited Sep 22, 2006 3:14PM in Berkeley DB Java Edition
Hello,

I am trying initialize Environment,Database & View in my main thread and pass this Object to my thread to insert the data. I get following exception:
I know for sure I am initiating all the variables.
If I use everything in main program, it works OK.


com.sleepycat.util.RuntimeExceptionWrapper: (JE 3.0.12) Attempt to use non-open Environment object().
at com.sleepycat.collections.CurrentTransaction.<init>(CurrentTransaction.java:98)
at com.sleepycat.collections.CurrentTransaction.getInstanceInternal(CurrentTransaction.java:76)
at com.sleepycat.collections.DataView.<init>(DataView.java:89)
at com.sleepycat.collections.StoredSortedMap.<init>(StoredSortedMap.java:116)
at com.mailman.bdb.MailOrderView.<init>(MailOrderView.java:42)
at com.mailman.server.commands.InsertCommand.<init>(InsertCommand.java:20)
at com.mailman.server.commands.CommandInvoker.getCommand(CommandInvoker.java:31)

Comments

  • Greybird-Oracle
    Greybird-Oracle Member Posts: 2,690
    Hello,

    I'm not sure why this is happening -- it appears that the environment has been closed.

    The stack trace you are getting is from a RuntimeExceptionWrapper. Please unwrap this exception when you catch it and print the stack trace from the unwrapped exception as follows:

    import com.sleepycat.util.ExceptionUnwrapper;
    import com.sleepycat.util.RuntimeExceptionWrapper;

    // somewhere in your program you must catch the exception:

    try {
    // do the work here that causes the error
    } catch (RuntimeExceptionWrapper e) {
    e = ExceptionUnwrapper.unwrap(e);
    e.printStackTrace();
    }

    Please reply with the unwrapped stack trace -- this will tell me more about the cause of the problem.

    Thanks,
    Mark
  • 535385
    535385 Member Posts: 3
    As suggested I put following:
    catch (RuntimeExceptionWrapper e) {
    System.out.println("Inside RuntimeExceptionWrapper");
    Exception ex = ExceptionUnwrapper.unwrap(e);
    ex.printStackTrace();

    I got following:


    Inside RuntimeExceptionWrapper
    com.sleepycat.je.DatabaseException: (JE 3.0.12) Attempt to use non-open Environm ent object().
    at com.sleepycat.je.Environment.checkHandleIsValid(Environment.java:1020 )
    at com.sleepycat.je.Environment.getConfig(Environment.java:837)
    at com.sleepycat.collections.CurrentTransaction.<init>(CurrentTransactio n.java:86)
    at com.sleepycat.collections.CurrentTransaction.getInstanceInternal(Curr entTransaction.java:76)
    at com.sleepycat.collections.DataView.<init>(DataView.java:89)
    at com.sleepycat.collections.StoredSortedMap.<init>(StoredSortedMap.java :116)
  • 535385
    535385 Member Posts: 3
    Sorry. I found the bug in my code. Thank you for responding.
This discussion has been closed.