java.lang.ArrayIndexOutOfBoundsException: Index 2048 out of bounds
search cancel

java.lang.ArrayIndexOutOfBoundsException: Index 2048 out of bounds

book

Article ID: 199872

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

Error java.lang.ArrayIndexOutOfBoundsException: Index 2048 out of bounds for length 2048

  • thrown during upgrade 
    or
  • during service deploy 

Error in logs example: 

9/14/20 10:44 AM (ExecTask) Copying 10 files to d:\clarity\tomcat-app-deploy\conf
9/14/20 10:44 AM (ExecTask) java.lang.ArrayIndexOutOfBoundsException: Index 2048 out of bounds for length 2048
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
9/14/20 10:44 AM (ExecTask)     at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
9/14/20 10:44 AM (ExecTask)     at com.niku.tools.taskdefs.XPath.execute(XPath.java:385)

Environment

Release : Any

Resolution

  • This is not a problem with a port, this is an old bug with XPath.
  • More information on it here: https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=747855
  • It can happen on any xml file, it's usually a rare occurrence
  • If the JVM parameter has additional parameter this can happen, default parameters are below
    • -Xms512m -Xmx2048m -XX:-UseGCOverheadLimit -DforceMemorySettings=false -XX:MaxMetaspaceSize=300m (memory sizing can be based on the enviornment but other parameters should be consistent) 
  • The solution is to modify any value in the affected file (i.e. for the upgrade it's properties.xml file) to make sure it does not hit this exact size.
  • Once you determine the file you could modify any value to bypass the error i.e. remove GC logging from JVM parameters
  • Virtually any change should work as long as the file size changes
  • If the error is happening during service deploy, the file affected may be : deploy.xml or server.xml - this can be determined from the exact stack trace of the error and the line number