简体   繁体   中英

ArrayIndexOutOfBoundsException when invoking webservice from my application deployed in glassfish server

I'm new to this website. Subscribed just now after hearing from my friends that this site would actually help me grow technically.

I have the following issue reported:

My application is developed in such a way that it has to hit 5 external services (Web service call) for processing. These services are invoked using axis2 stubs.

My application is deployed in glassfish application server version 2.1 as an enterprise application.

The processing is going fine but webservice request fails for some requests (ie) fails with following error for every 1000 requests 20 requests fail.

Error log found in axis2 trace is as follows:

2012-04-19 15:42:10,328 DEBUG org.apache.axiom.om.util.StAXUtils - XMLStreamReader is com.sun.xml.stream.XMLReaderImpl
2012-04-19 15:42:10,326 DEBUG org.apache.axis2.description.ParameterIncludeImpl - ==================
2012-04-19 15:42:10,328 DEBUG org.apache.axis2.description.ParameterIncludeImpl -  Parameter add on object org.apache.axis2.description.ParameterIncludeImpl@3ee78dcc
2012-04-19 15:42:10,328 DEBUG org.apache.axis2.description.ParameterIncludeImpl -   Key =enableMTOM
2012-04-19 15:42:10,328 DEBUG org.apache.axis2.description.ParameterIncludeImpl -   Value =false
2012-04-19 15:42:10,328 DEBUG org.apache.axis2.description.ParameterIncludeImpl -   Value Class = java.lang.String
2012-04-19 15:42:10,328 DEBUG org.apache.axis2.description.ParameterIncludeImpl -   Value Classloader = null
2012-04-19 15:42:10,328 ERROR webServiceRequestConnector - Exception >>> webServiceRequestConnector.postRequest() >>> Interface Request >>> 3652467 >>> Exception Message is >>> 
java.lang.ArrayIndexOutOfBoundsException: -1
    at com.sun.xml.stream.xerces.util.NamespaceSupport.popContext(NamespaceSupport.java:223)
    at com.sun.xml.stream.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:359)
    at com.sun.xml.stream.XMLReaderImpl.setInputSource(XMLReaderImpl.java:207)
    at com.sun.xml.stream.ZephyrParserFactory.getXMLStreamReaderImpl(ZephyrParserFactory.java:291)
    at com.sun.xml.stream.ZephyrParserFactory.createXMLStreamReader(ZephyrParserFactory.java:173)
    at com.sun.xml.stream.ZephyrParserFactory.createXMLStreamReader(ZephyrParserFactory.java:156)
    at org.apache.axiom.om.util.StAXUtils$2.run(StAXUtils.java:137)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:133)
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:596)
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:581)
    at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
    at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:86)
    at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:641)
    at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
    at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)
    at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143)
    at QueryScoreStub.<init>(QueryScoreStub.java:91)
    at QueryScoreStub.<init>(QueryScoreStub.java:77)
    at QueryScoreStub.<init>(QueryScoreStub.java:125)
    at QueryScoreStub.<init>(QueryScoreStub.java:117)
    at webServiceRequestConnector.handleService(webServiceRequestConnector.java:1014)
    at webServiceRequestConnector.postRequest(webServiceRequestConnector.java:173)
    at FinalInterface.receiveResponse(FinalInterface.java:76)
    at ExtConnectionManager.processRequest(ExtConnectionManager.java:88)
    at ExtConnectionManager.processRequest(ExtConnectionManager.java:112)
    at InterfaceWorkflowExecutor.call(InterfaceWorkflowExecutor.java:242)
    at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:178)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
    at java.lang.Thread.run(Thread.java:595)

No clue why this is failing for some requests alone.

Did read the following from internet:

  1. Glassfish has a jar named webservice-rt.jar which it makes use of while invoking webservice.
  2. This error is thrown inside NamespaceSupport class inside popContext() method.
  3. Also, this error might be due to trying to popContext without calling pushContext method first.

Apart from the above, no other help could be identified.

Could anyone please help me out on what exactly is the problem?

Also, out of the 5 services, not just 1 service alone fails. Sometimes 2 services fail and sometimes 1 and sometimes 3 services.

Hence, i doubt that the problem is with the external service. :( :(

This issue is probably related to AXIOM-74 . Package Woodstox into your application and it will likely go away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM