Upgrade to Confluence 3.5 or Higher Fails due to "java.lang.NegativeArraySizeException"

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Upgrading to Confluence 3.5 or higher from pre-3.5 failed with the following appears in the atlassian-confluence.log:

2012-01-16 16:10:11,910 ERROR [main] [springframework.web.context.ContextLoader] initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginResourceLocator' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'webResourceIntegration' while setting constructor argument with index 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webResourceIntegration' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'settingsManager' while setting constructor argument with index 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'settingsManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'upgradeManager' while setting bean property 'upgradeManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'upgradeManager' defined in class path resource [upgradeSubsystemContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'systemInformationService' defined in class path resource [services/statusServiceContext.xml]: Cannot resolve reference to bean 'luceneConnection' while setting bean property 'luceneConnection'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'luceneConnection' defined in class path resource [indexingSubsystemContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bonnie.LuceneConnection]: Constructor threw exception; nested exception is java.lang.NegativeArraySizeException
....
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bonnie.LuceneConnection]: Constructor threw exception; nested exception is java.lang.NegativeArraySizeException
Caused by: java.lang.NegativeArraySizeException
	at org.apache.lucene.store.IndexInput.readString(IndexInput.java:122)
	at org.apache.lucene.index.FieldInfos.read(FieldInfos.java:356)
	at org.apache.lucene.index.FieldInfos.<init>(FieldInfos.java:71)
	at org.apache.lucene.index.SegmentReader$CoreReaders.<init>(SegmentReader.java:119)
	at org.apache.lucene.index.SegmentReader.get(SegmentReader.java:652)

Cause

There seems to be some corruption in the Confluence index directory. Or there are some indices that the upgraded Confluence search engine couldn't read. Normally, this failure occurred in the pre-upgrade stage which means that the upgrade tasks haven't started yet at all.

Resolution

  1. Shut down your Confluence server.
  2. Make a backup of your <confluence-home>/index/plugin directory if it exists. This is where the Usage Tracking plugin stores it's index for the usage statistics and it cannot be rebuilt.
  3. Remove the <confluence-home>/index directory.
  4. If in step 2, you have the <confluence-home>/index/plugin directory, create the <confluence-home>/index directory and copy in the backup of <confluence-home>/index/plugin directory made in step 2.
  5. Restart Confluence to re-trigger the upgrade. When you upgrade to Confluence 3.5 or higher, an upgrade task will run automatically to rebuild the index.

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.