we have implemented the XML parsing using the Apache XML API (xalan.jar) in our web application and in the production environment.
Some times when load on the server is heavy we are getting the "ArrayIndexOutOfBoundException -1" error messages during the XML parsing process and this is leading to the severe server problems. The error messages are appeared when huge number of users are accessing the application at the same time and number of instances are accessing the "selectNodeList(contextnode, string)" method of CachedXPathAPI" class.
Upon rigorous investigation I am able to reproduce this error in a sample java program in Eclipse.
I designed the java program very similar to our program in the application and tested it in the ecilipse. To replicate the scenario I implemented multi threading and created 100 threads and accessed the method selectNodeList(contextNode,string) simultaniously.
The error is as below
This error is not reproducible always. similarly in our production environment also we are getting this message when server load is heavy.
My sample program is as below:
The XML file content has this data
The class "com.philips.sc.impulse.util.xml.XMLHelper" is our own proprietery class file
How to solve this problem. Can anybody help us here please...