Unable to recover from unclean DB exit - ArrayIndexOutOfBoundsException

128 views
Skip to first unread message

Michael

unread,
Oct 5, 2011, 12:32:46 PM10/5/11
to H2 Database
Hi,

Recently my application has crashed, and the next time I'm trying to
start it I get:

org.h2.jdbc.JdbcSQLException: General error:
"java.lang.ArrayIndexOutOfBoundsException: 69" [50000-158]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convert(DbException.java:281)
at org.h2.engine.Database.openDatabase(Database.java:250)
at org.h2.engine.Database.<init>(Database.java:215)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.engine.Engine.createSession(Engine.java:28)
at
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:
285)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)

Please tell, is there a way to recover from this situation?

H2 version: 1.3.158

Thanks,
Michael

zenixan

unread,
Oct 5, 2011, 3:08:28 PM10/5/11
to H2 Database

Michael

unread,
Oct 6, 2011, 4:43:24 AM10/6/11
to H2 Database
I will try it now. The database is encrypted, so I guess the steps
should be:

1. Decrypt database:

java -cp h2*.jar org.h2.tools.ChangeFileEncryption -dir . -db
database -cipher AES -decrypt pwd

2. Run the recover tool:

java -cp h2*.jar org.h2.tools.Recover

3. Delete the old database:

for i in *.db ; do mv $i $i.bak; done

4. Re-create the database from the script:

java org.h2.tools.RunScript -url jdbc:h2:database -user user -
password pwd -script database*.sql

5. Encrypt the database:

java -cp h2*.jar org.h2.tools.ChangeFileEncryption -dir . -db
database -cipher AES -encrypt pwd

If the steps above are correct I should succeed :-) I'll report back
if anything goes wrong.

Thanks,
Michael

Michael

unread,
Oct 6, 2011, 5:59:03 AM10/6/11
to H2 Database
Unfortunately this didn't work.
There were a lot of exceptions of missing LOBs, and after appending "-
continueOnError" option to the RunScript tool I've got an incomplete
database.
Message has been deleted

Michael Spector

unread,
Oct 11, 2011, 5:45:42 AM10/11/11
to h2-da...@googlegroups.com
Unfortunately, no.

On Thu, Oct 6, 2011 at 9:26 PM, zenixan <zen...@gmail.com> wrote:
In the trace file exists more detailed error message?

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.


Thomas Mueller

unread,
Oct 20, 2011, 2:10:35 PM10/20/11
to h2-da...@googlegroups.com
Hi,

Could you post the complete stack trace (including the root cause stack traces)?

Regards,
Thomas

Michael Spector

unread,
Oct 22, 2011, 2:19:40 PM10/22/11
to h2-da...@googlegroups.com
Hi Thomas,

Here's the complete stack trace:

org.h2.jdbc.JdbcSQLException: General error: "java.lang.ArrayIndexOutOfBoundsException: 53" [50000-158]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convert(DbException.java:281)
at org.h2.engine.Database.openDatabase(Database.java:250)
at org.h2.engine.Database.<init>(Database.java:215)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.engine.Engine.createSession(Engine.java:28)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:285)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.stepwell.core.db.ConnectionFactory.tryLogin(ConnectionFactory.java:137)
at com.stepwell.core.db.ConnectionFactory.login(ConnectionFactory.java:166)
at com.stepwell.rcp.ApplicationWorkbenchAdvisor.getInitialWindowPerspectiveId(ApplicationWorkbenchAdvisor.java:62)
at org.eclipse.ui.internal.Workbench.getDefaultPerspectiveId(Workbench.java:3161)
at org.eclipse.ui.internal.registry.PerspectiveRegistry.verifyDefaultPerspective(PerspectiveRegistry.java:661)
at org.eclipse.ui.internal.registry.PerspectiveRegistry.load(PerspectiveRegistry.java:417)
at org.eclipse.ui.internal.WorkbenchPlugin$2.runWithException(WorkbenchPlugin.java:593)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$33.runWithException(Workbench.java:1595)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.stepwell.rcp.Application.start(Application.java:178)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 53
at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:327)
at org.h2.index.PageDataLeaf.getRowWithKey(PageDataLeaf.java:443)
at org.h2.index.PageDataNode.getRowWithKey(PageDataNode.java:270)
at org.h2.index.PageDataNode.getRowWithKey(PageDataNode.java:270)
at org.h2.index.PageDataIndex.getRowWithKey(PageDataIndex.java:403)
at org.h2.store.PageStore.redoDelete(PageStore.java:1448)
at org.h2.store.PageLog.recover(PageLog.java:332)
at org.h2.store.PageStore.recover(PageStore.java:1328)
at org.h2.store.PageStore.openExisting(PageStore.java:349)
at org.h2.store.PageStore.open(PageStore.java:273)
at org.h2.engine.Database.getPageStore(Database.java:2049)
at org.h2.engine.Database.open(Database.java:553)
at org.h2.engine.Database.openDatabase(Database.java:220)
... 50 more

Regards,
Michael

Thomas Mueller

unread,
Oct 24, 2011, 1:02:36 PM10/24/11
to h2-da...@googlegroups.com
Hi,

If you still have the database file(s), could you send them to me or upload them somewhere so I can have a look? That's probably the easiest solution.

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages