You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Phil Bradley <ph...@tower.ie> on 2014/03/10 12:49:51 UTC

Corrupt database: ArrayIndexOutOfBoundsException on connect

Hi, 

I have a derby database that I am unable to connect to; when I try I get
"java.lang.ArrayIndexOutOfBoundsException". The full stack trace is
shown below. 

Firstly, some background:

- I'm using derby 10.8.2.2 with a Java Webstart application that
connects in embedded mode. The clients are using Java 7u45 on Windows 7,
32 bit

- The application is configured to run SYSCS_UTIL.SYSCS_COMPRESS_TABLE()
every 5 days on each table on startup

- The client was running SYSCS_UTIL.SYSCS_COMPRESS_TABLE() on a
particular table and based on the application logs, it looks like either
the JVM crashed or the application was ended via task manager. 

- On subsequent attempts to start the application, the client was unable
to connect to the database as per the stack trace below. I have made a
copy of the database and I get this error reliably on accessing the
copy. 

I have two questions:

1. Is there anything that I can do to recover from this kind of scenario
automatically? 
2. Is there any debugging or other investigation that I can do that will
help reduce the severity of this kind of problem? 

Thanks,
Phil





java.sql.SQLException: Failed to start database
'C:\Users\Administrator\.myapp\myapp_db' with class loader
com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
details.
	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.seeNextException(Unknown
	Source)
	at
	org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown
	Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown
	Source)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown
	Source)
	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown
	Source)
	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown
	Source)
	at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
	at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown
	Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at
	com.mycompany.database.DbInitializer.runScript(DbInitializer.java:143)
	at
	com.mycompany.myapp.ApplicationRunner.initialiseDb(ApplicationRunner.java:817)
	at
	com.mycompany.myapp.ApplicationRunner.startApplication(ApplicationRunner.java:945)
	at
	com.mycompany.myapp.ApplicationRunner.run(ApplicationRunner.java:581)
	at
	com.mycompany.myapp.ApplicationRunner.main(ApplicationRunner.java:552)
	at
	com.mycompany.myapp.ApplicationLoader.main(ApplicationLoader.java:90)
	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 com.sun.javaws.Launcher.executeApplication(Unknown Source)
	at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
	at com.sun.javaws.Launcher.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Failed to start database
'C:\Users\Administrator\.myapp\myapp_db' with class loader
com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
details.
	at
	org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
	Source)
	at
	org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
	Source)
	... 27 more
Caused by: java.sql.SQLException: Java exception: ':
java.lang.ArrayIndexOutOfBoundsException'.
	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.javaException(Unknown Source)
	... 24 more
Caused by: java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at
	org.apache.derby.impl.store.raw.data.AllocPage.ReadContainerInfo(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.FileContainer.readHeader(Unknown
	Source)
	at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown
	Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at
	org.apache.derby.impl.store.raw.data.RAFContainer.openContainer(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.RAFContainer4.openContainer(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.FileContainer.setIdent(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.FileContainer.setIdentity(Unknown
	Source)
	at
	org.apache.derby.impl.services.cache.ConcurrentCache.find(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openDroppedContainer(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.xact.Xact.openDroppedContainer(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.ContainerBasicOperation.findContainer(Unknown
	Source)
	at
	org.apache.derby.impl.store.raw.data.ContainerBasicOperation.needsRedo(Unknown
	Source)
	at org.apache.derby.impl.store.raw.log.FileLogger.redo(Unknown
	Source)
	at org.apache.derby.impl.store.raw.log.LogToFile.recover(Unknown
	Source)
	at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
	Source)
	at
	org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
	Source)
	at
	org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
	Source)
	at
	org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
	Source)
	at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown
	Source)
	at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown
	Source)
	at
	org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown
	Source)
	at
	org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown
	Source)
	... 24 more
2014-03-08 06:10:59,357 javawsApplicationMain ERROR  Initialisation
error [40000] [XJ040] Failed to start database
'C:\Users\Administrator\.myapp\myapp_db' with class loader
com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
details.
2014-03-08 06:10:59,357 javawsApplicationMain ERROR Initialisation error
[0] [XJ001] Java exception: ':
java.lang.ArrayIndexOutOfBoundsException'.




Re: Corrupt database: ArrayIndexOutOfBoundsException on connect

Posted by Peter Ondruška <pe...@yahoo.com>.
Just a reminder to do backups and run the database with log archiving. Everything is built in Derby. I know for you it is too late for you :(

Peter

> On 10 Mar 2014, at 17:20, Myrna van Lunteren <m....@gmail.com> wrote:
> 
> Although Derby has transaction control and a recovery mechanism, if a JVM crashes or gets interrupted, the normal transaction steps might be interrupted in unfortunate places, especially during compress. Was the database shutdown before compress? Do you have a backup?
> 
> But perhaps there is something of use to you on this page:
> https://wiki.apache.org/db-derby/DatabaseCorruption
> 
> HTH
> Myrna
> 
> 
> 
>> On Mon, Mar 10, 2014 at 4:49 AM, Phil Bradley <ph...@tower.ie> wrote:
>> 
>> Hi,
>> 
>> I have a derby database that I am unable to connect to; when I try I get
>> "java.lang.ArrayIndexOutOfBoundsException". The full stack trace is
>> shown below.
>> 
>> Firstly, some background:
>> 
>> - I'm using derby 10.8.2.2 with a Java Webstart application that
>> connects in embedded mode. The clients are using Java 7u45 on Windows 7,
>> 32 bit
>> 
>> - The application is configured to run SYSCS_UTIL.SYSCS_COMPRESS_TABLE()
>> every 5 days on each table on startup
>> 
>> - The client was running SYSCS_UTIL.SYSCS_COMPRESS_TABLE() on a
>> particular table and based on the application logs, it looks like either
>> the JVM crashed or the application was ended via task manager.
>> 
>> - On subsequent attempts to start the application, the client was unable
>> to connect to the database as per the stack trace below. I have made a
>> copy of the database and I get this error reliably on accessing the
>> copy.
>> 
>> I have two questions:
>> 
>> 1. Is there anything that I can do to recover from this kind of scenario
>> automatically?
>> 2. Is there any debugging or other investigation that I can do that will
>> help reduce the severity of this kind of problem?
>> 
>> Thanks,
>> Phil
>> 
>> 
>> 
>> 
>> 
>> java.sql.SQLException: Failed to start database
>> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
>> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
>> details.
>>         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.seeNextException(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown
>>         Source)
>>         at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown
>>         Source)
>>         at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown
>>         Source)
>>         at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown
>>         Source)
>>         at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown
>>         Source)
>>         at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
>>         at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown
>>         Source)
>>         at java.sql.DriverManager.getConnection(Unknown Source)
>>         at java.sql.DriverManager.getConnection(Unknown Source)
>>         at
>>         com.mycompany.database.DbInitializer.runScript(DbInitializer.java:143)
>>         at
>>         com.mycompany.myapp.ApplicationRunner.initialiseDb(ApplicationRunner.java:817)
>>         at
>>         com.mycompany.myapp.ApplicationRunner.startApplication(ApplicationRunner.java:945)
>>         at
>>         com.mycompany.myapp.ApplicationRunner.run(ApplicationRunner.java:581)
>>         at
>>         com.mycompany.myapp.ApplicationRunner.main(ApplicationRunner.java:552)
>>         at
>>         com.mycompany.myapp.ApplicationLoader.main(ApplicationLoader.java:90)
>>         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 com.sun.javaws.Launcher.executeApplication(Unknown Source)
>>         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
>>         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
>>         at com.sun.javaws.Launcher.run(Unknown Source)
>>         at java.lang.Thread.run(Unknown Source)
>> Caused by: java.sql.SQLException: Failed to start database
>> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
>> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
>> details.
>>         at
>>         org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>>         Source)
>>         ... 27 more
>> Caused by: java.sql.SQLException: Java exception: ':
>> java.lang.ArrayIndexOutOfBoundsException'.
>>         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.javaException(Unknown Source)
>>         ... 24 more
>> Caused by: java.lang.ArrayIndexOutOfBoundsException
>>         at java.lang.System.arraycopy(Native Method)
>>         at
>>         org.apache.derby.impl.store.raw.data.AllocPage.ReadContainerInfo(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.FileContainer.readHeader(Unknown
>>         Source)
>>         at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown
>>         Source)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at
>>         org.apache.derby.impl.store.raw.data.RAFContainer.openContainer(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.RAFContainer4.openContainer(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.FileContainer.setIdent(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.FileContainer.setIdentity(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.cache.ConcurrentCache.find(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openDroppedContainer(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.xact.Xact.openDroppedContainer(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.ContainerBasicOperation.findContainer(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.raw.data.ContainerBasicOperation.needsRedo(Unknown
>>         Source)
>>         at org.apache.derby.impl.store.raw.log.FileLogger.redo(Unknown
>>         Source)
>>         at org.apache.derby.impl.store.raw.log.LogToFile.recover(Unknown
>>         Source)
>>         at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
>>         Source)
>>         at
>>         org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
>>         Source)
>>         at
>>         org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
>>         Source)
>>         at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown
>>         Source)
>>         at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown
>>         Source)
>>         at
>>         org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown
>>         Source)
>>         at
>>         org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown
>>         Source)
>>         ... 24 more
>> 2014-03-08 06:10:59,357 javawsApplicationMain ERROR  Initialisation
>> error [40000] [XJ040] Failed to start database
>> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
>> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
>> details.
>> 2014-03-08 06:10:59,357 javawsApplicationMain ERROR Initialisation error
>> [0] [XJ001] Java exception: ':
>> java.lang.ArrayIndexOutOfBoundsException'.
> 

Re: Corrupt database: ArrayIndexOutOfBoundsException on connect

Posted by Myrna van Lunteren <m....@gmail.com>.
Although Derby has transaction control and a recovery mechanism, if a JVM
crashes or gets interrupted, the normal transaction steps might be
interrupted in unfortunate places, especially during compress. Was the
database shutdown before compress? Do you have a backup?

But perhaps there is something of use to you on this page:
https://wiki.apache.org/db-derby/DatabaseCorruption

HTH
Myrna



On Mon, Mar 10, 2014 at 4:49 AM, Phil Bradley <ph...@tower.ie> wrote:

>
> Hi,
>
> I have a derby database that I am unable to connect to; when I try I get
> "java.lang.ArrayIndexOutOfBoundsException". The full stack trace is
> shown below.
>
> Firstly, some background:
>
> - I'm using derby 10.8.2.2 with a Java Webstart application that
> connects in embedded mode. The clients are using Java 7u45 on Windows 7,
> 32 bit
>
> - The application is configured to run SYSCS_UTIL.SYSCS_COMPRESS_TABLE()
> every 5 days on each table on startup
>
> - The client was running SYSCS_UTIL.SYSCS_COMPRESS_TABLE() on a
> particular table and based on the application logs, it looks like either
> the JVM crashed or the application was ended via task manager.
>
> - On subsequent attempts to start the application, the client was unable
> to connect to the database as per the stack trace below. I have made a
> copy of the database and I get this error reliably on accessing the
> copy.
>
> I have two questions:
>
> 1. Is there anything that I can do to recover from this kind of scenario
> automatically?
> 2. Is there any debugging or other investigation that I can do that will
> help reduce the severity of this kind of problem?
>
> Thanks,
> Phil
>
>
>
>
>
> java.sql.SQLException: Failed to start database
> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
> details.
>         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.seeNextException(Unknown
>         Source)
>         at
>         org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown
>         Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown
>         Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown
>         Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown
>         Source)
>         at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown
>         Source)
>         at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
>         at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown
>         Source)
>         at java.sql.DriverManager.getConnection(Unknown Source)
>         at java.sql.DriverManager.getConnection(Unknown Source)
>         at
>
> com.mycompany.database.DbInitializer.runScript(DbInitializer.java:143)
>         at
>
> com.mycompany.myapp.ApplicationRunner.initialiseDb(ApplicationRunner.java:817)
>         at
>
> com.mycompany.myapp.ApplicationRunner.startApplication(ApplicationRunner.java:945)
>         at
>
> com.mycompany.myapp.ApplicationRunner.run(ApplicationRunner.java:581)
>         at
>
> com.mycompany.myapp.ApplicationRunner.main(ApplicationRunner.java:552)
>         at
>
> com.mycompany.myapp.ApplicationLoader.main(ApplicationLoader.java:90)
>         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 com.sun.javaws.Launcher.executeApplication(Unknown Source)
>         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
>         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
>         at com.sun.javaws.Launcher.run(Unknown Source)
>         at java.lang.Thread.run(Unknown Source)
> Caused by: java.sql.SQLException: Failed to start database
> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
> details.
>         at
>
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>         Source)
>         ... 27 more
> Caused by: java.sql.SQLException: Java exception: ':
> java.lang.ArrayIndexOutOfBoundsException'.
>         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.javaException(Unknown Source)
>         ... 24 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException
>         at java.lang.System.arraycopy(Native Method)
>         at
>
> org.apache.derby.impl.store.raw.data.AllocPage.ReadContainerInfo(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.data.FileContainer.readHeader(Unknown
>         Source)
>         at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown
>         Source)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
>
> org.apache.derby.impl.store.raw.data.RAFContainer.openContainer(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.data.RAFContainer4.openContainer(Unknown
>         Source)
>         at
>         org.apache.derby.impl.store.raw.data.FileContainer.setIdent(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.data.FileContainer.setIdentity(Unknown
>         Source)
>         at
>         org.apache.derby.impl.services.cache.ConcurrentCache.find(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openDroppedContainer(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.xact.Xact.openDroppedContainer(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.data.ContainerBasicOperation.findContainer(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.store.raw.data.ContainerBasicOperation.needsRedo(Unknown
>         Source)
>         at org.apache.derby.impl.store.raw.log.FileLogger.redo(Unknown
>         Source)
>         at org.apache.derby.impl.store.raw.log.LogToFile.recover(Unknown
>         Source)
>         at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
>         at
>         org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
>         Source)
>         at
>
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
>         Source)
>         at
>         org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
>         Source)
>         at
>         org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
>         Source)
>         at
>
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
>         Source)
>         at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown
>         Source)
>         at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
>         at
>         org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown
>         Source)
>         at
>
> org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown
>         Source)
>         at
>
> org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown
>         Source)
>         ... 24 more
> 2014-03-08 06:10:59,357 javawsApplicationMain ERROR  Initialisation
> error [40000] [XJ040] Failed to start database
> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
> details.
> 2014-03-08 06:10:59,357 javawsApplicationMain ERROR Initialisation error
> [0] [XJ001] Java exception: ':
> java.lang.ArrayIndexOutOfBoundsException'.
>
>
>
>

Re: Corrupt database: ArrayIndexOutOfBoundsException on connect

Posted by "Dag H. Wanvik" <da...@oracle.com>.
Some advice can be found here:

http://wiki.apache.org/db-derby/DatabaseCorruption

Thanks,
Dag

On 10. mars 2014 12:49, Phil Bradley wrote:
> Hi,
>
> I have a derby database that I am unable to connect to; when I try I get
> "java.lang.ArrayIndexOutOfBoundsException". The full stack trace is
> shown below.
>
> Firstly, some background:
>
> - I'm using derby 10.8.2.2 with a Java Webstart application that
> connects in embedded mode. The clients are using Java 7u45 on Windows 7,
> 32 bit
>
> - The application is configured to run SYSCS_UTIL.SYSCS_COMPRESS_TABLE()
> every 5 days on each table on startup
>
> - The client was running SYSCS_UTIL.SYSCS_COMPRESS_TABLE() on a
> particular table and based on the application logs, it looks like either
> the JVM crashed or the application was ended via task manager.
>
> - On subsequent attempts to start the application, the client was unable
> to connect to the database as per the stack trace below. I have made a
> copy of the database and I get this error reliably on accessing the
> copy.
>
> I have two questions:
>
> 1. Is there anything that I can do to recover from this kind of scenario
> automatically?
> 2. Is there any debugging or other investigation that I can do that will
> help reduce the severity of this kind of problem?
>
> Thanks,
> Phil
>
>
>
>
>
> java.sql.SQLException: Failed to start database
> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
> details.
> 	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.seeNextException(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown
> 	Source)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown
> 	Source)
> 	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown
> 	Source)
> 	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown
> 	Source)
> 	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown
> 	Source)
> 	at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
> 	at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown
> 	Source)
> 	at java.sql.DriverManager.getConnection(Unknown Source)
> 	at java.sql.DriverManager.getConnection(Unknown Source)
> 	at
> 	com.mycompany.database.DbInitializer.runScript(DbInitializer.java:143)
> 	at
> 	com.mycompany.myapp.ApplicationRunner.initialiseDb(ApplicationRunner.java:817)
> 	at
> 	com.mycompany.myapp.ApplicationRunner.startApplication(ApplicationRunner.java:945)
> 	at
> 	com.mycompany.myapp.ApplicationRunner.run(ApplicationRunner.java:581)
> 	at
> 	com.mycompany.myapp.ApplicationRunner.main(ApplicationRunner.java:552)
> 	at
> 	com.mycompany.myapp.ApplicationLoader.main(ApplicationLoader.java:90)
> 	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 com.sun.javaws.Launcher.executeApplication(Unknown Source)
> 	at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
> 	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
> 	at com.sun.javaws.Launcher.run(Unknown Source)
> 	at java.lang.Thread.run(Unknown Source)
> Caused by: java.sql.SQLException: Failed to start database
> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
> details.
> 	at
> 	org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
> 	Source)
> 	... 27 more
> Caused by: java.sql.SQLException: Java exception: ':
> java.lang.ArrayIndexOutOfBoundsException'.
> 	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.javaException(Unknown Source)
> 	... 24 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException
> 	at java.lang.System.arraycopy(Native Method)
> 	at
> 	org.apache.derby.impl.store.raw.data.AllocPage.ReadContainerInfo(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.FileContainer.readHeader(Unknown
> 	Source)
> 	at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown
> 	Source)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at
> 	org.apache.derby.impl.store.raw.data.RAFContainer.openContainer(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.RAFContainer4.openContainer(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.FileContainer.setIdent(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.FileContainer.setIdentity(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.cache.ConcurrentCache.find(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openDroppedContainer(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.xact.Xact.openDroppedContainer(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.ContainerBasicOperation.findContainer(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.raw.data.ContainerBasicOperation.needsRedo(Unknown
> 	Source)
> 	at org.apache.derby.impl.store.raw.log.FileLogger.redo(Unknown
> 	Source)
> 	at org.apache.derby.impl.store.raw.log.LogToFile.recover(Unknown
> 	Source)
> 	at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> 	Source)
> 	at
> 	org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> 	Source)
> 	at
> 	org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
> 	Source)
> 	at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown
> 	Source)
> 	at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown
> 	Source)
> 	at
> 	org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown
> 	Source)
> 	at
> 	org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown
> 	Source)
> 	... 24 more
> 2014-03-08 06:10:59,357 javawsApplicationMain ERROR  Initialisation
> error [40000] [XJ040] Failed to start database
> 'C:\Users\Administrator\.myapp\myapp_db' with class loader
> com.sun.jnlp.JNLPClassLoader@1bef5e8, see the next exception for
> details.
> 2014-03-08 06:10:59,357 javawsApplicationMain ERROR Initialisation error
> [0] [XJ001] Java exception: ':
> java.lang.ArrayIndexOutOfBoundsException'.
>
>
>