Cannot connect to h2db
Asked by AlexandreP:

Hi,

Confluence didn't start anymore, I was using a h2db for testing purpose with already some configuration :

Can you help ?

(We plan also to migrate to Confluence Cloud, but before we need to be able to connect Confluence h2db back again)

Error : "Could not load bootstrap from environment"

2021-03-24 11:19:25,493 ERROR \[Catalina-utility-2\] \[atlassian.confluence.setup.ConfluenceConfigurationListener\] contextInitialized An error was encountered while bootstrapping Confluence (see below):  
Cannot connect to h2db  
java.lang.RuntimeException: Cannot connect to h2db  
at com.atlassian.h2.DatabaseCreatingServerLifecycle.start(DatabaseCreatingServerLifecycle.java:57)  
at com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateConfig.getHibernateProperties(ConfluenceHibernateConfig.java:51)  
at com.atlassian.confluence.setup.DefaultBootstrapManager.getHibernateProperties(DefaultBootstrapManager.java:634)  
at com.atlassian.confluence.setup.DefaultBootstrapManager.performPersistenceUpgrade(DefaultBootstrapManager.java:318)  
at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.init(DefaultAtlassianBootstrapManager.java:81)  
at com.atlassian.confluence.setup.DefaultBootstrapManager.init(DefaultBootstrapManager.java:188)  
at com.atlassian.config.util.BootstrapUtils.init(BootstrapUtils.java:36)  
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.initialiseBootstrapContext(ConfluenceConfigurationListener.java:146)  
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.contextInitialized(ConfluenceConfigurationListener.java:65)  
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4716)  
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5177)  
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)  
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)  
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)  
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)  
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
at java.base/java.lang.Thread.run(Unknown Source)  
Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.lang.ArrayIndexOutOfBoundsException: Index 59 out of bounds for length 59" \[50000-196\]  
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)  
at org.h2.message.DbException.get(DbException.java:168)  
at org.h2.message.DbException.convert(DbException.java:295)  
at org.h2.engine.Database.openDatabase(Database.java:307)  
at org.h2.engine.Database.\<init\>(Database.java:270)  
at org.h2.engine.Engine.openSession(Engine.java:64)  
at org.h2.engine.Engine.openSession(Engine.java:176)  
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:154)  
at org.h2.engine.Engine.createSession(Engine.java:137)  
at org.h2.engine.Engine.createSession(Engine.java:27)  
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:354)  
at org.h2.jdbc.JdbcConnection.\<init\>(JdbcConnection.java:116)  
at org.h2.jdbc.JdbcConnection.\<init\>(JdbcConnection.java:100)  
at org.h2.Driver.connect(Driver.java:69)  
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)  
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)  
at com.atlassian.h2.DatabaseCreatingServerLifecycle.start(DatabaseCreatingServerLifecycle.java:52)  
... 19 more  
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 59 out of bounds for length 59  
at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:330)  
at org.h2.index.PageDataLeaf.getRowWithKey(PageDataLeaf.java:453)  
at org.h2.index.PageDataNode.getRowWithKey(PageDataNode.java:280)  
at org.h2.index.PageDataIndex.getRowWithKey(PageDataIndex.java:426)  
at org.h2.store.PageStore.redoDelete(PageStore.java:1548)  
at org.h2.store.PageLog.recover(PageLog.java:346)  
at org.h2.store.PageStore.recover(PageStore.java:1407)  
at org.h2.store.PageStore.openExisting(PageStore.java:368)  
at org.h2.store.PageStore.open(PageStore.java:289)  
at org.h2.engine.Database.getPageStore(Database.java:2490)  
at org.h2.engine.Database.open(Database.java:697)  
at org.h2.engine.Database.openDatabase(Database.java:276)

Thank you


Answers:
author: Nic Brough -Adaptavist-
body: This is the sort of error we see when the h2 database has become corrupted.

You may be able to rescue some of it if you are willing to spend some time tinkering with h2 database tools, but it would probably be quicker and easier to start up a new system, and import the latest standard xml backup from the broken one.

comments: author: AlexandreP
body: Hi,

Thank you for the feedback.

I don't have any XML backup :/

I also start with success a new installation of Confluence with an empty database.

With h2 tools I can navigate to the corrupted one, but,

1)How can I find the corrupted data/values ?

2)and What are the records/table that need to be copied to the new H2 ?

Thank you


author: Nic Brough -Adaptavist-
body: This is a bit too far outside my area of knowledge. I've used h2 a lot for development and testing, not just for Atlassian stuff, but I've only rescued one from a minor mistake once, all the other times it has failed (for Atlassian), I have been able to go back to an xml backup.

I'm afraid that if you don't have a backup, I am stuck. I do not know how to undo the damage.


Tags: confluence-server

server