Apache Axis 1.4 OutOfMemoryError:Java 堆空间

发布于 2024-10-31 12:41:09 字数 1761 浏览 0 评论 0原文

我有一个奇怪的问题,突然出现在使用 Apache Axis 1.4 向 Web 服务发出 SOAP 请求的客户端上。一年来一切都很顺利。随着时间的推移,响应的大小一直在缓慢增长,最近我在调用时收到相当随机的 OutOfMemoryError: Java heap space 异常。跟踪的顶部部分显示在底部。这种情况可能发生在 1/10 的调用中。如果发生这种情况,我捕获了异常,然后再次尝试调用,那么它在 100 种情况中的 99 种情况下都有效。

当我第一次开始看到这一点时,我自然地认为需要增加我的最大堆大小。我正在运行 Tomcat 6,并将之前的 -Xmx1024M 设置更改为 -Xmx2048M(计算机上有足够的 RAM)。然而,这并没有改变任何事情。查看 Tomcat 的状态,堆似乎有足够的空间来容纳 SOAP 响应。该问题似乎也与可用的 PermGen 空间无关。

该错误与应用程序运行的时间无关,它可能在 Tomcat 启动时立即发生。因此,它似乎与服务器上的总体负载无关。

有人对此有什么想法吗?我是否正在处理 Axis 中的已知错误?我发现一些情况下,人们在通过 SOAP 发送巨大附件时遇到 OutOfMemoryError 异常,但是,这不是我正在做的事情。

我正在为 SOAP Web 服务使用wrapped/literal。

Exception in thread "Thread-6" java.lang.OutOfMemoryError: Java heap space
        at org.apache.axis.message.SAX2EventRecorder$objArrayVector.add(SAX2EventRecorder.java:254)
        at org.apache.axis.message.SAX2EventRecorder.newElement(SAX2EventRecorder.java:136)
        at org.apache.axis.encoding.DeserializationContext.pushNewElement(DeserializationContext.java:769)
        at org.apache.axis.message.SOAPHandler.startElement(SOAPHandler.java:94)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:504)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)

I have a peculiar problem that have suddenly appeared on the client side that uses Apache Axis 1.4 to make SOAP requests to a web service. Everything has been running smoothly for a year. The size of the responses have been growing slowly over time, and recently I'm getting rather random OutOfMemoryError: Java heap space exceptions upon the call. The top part of the trace shown at the bottom. This happens at perhaps 1/10 of the calls made. If it happens and I catch the exception and just try the call again, it works in 99 cases out of 100.

When I first started seeing this, I naturally assumed that my maximum heap size needed to be increased. I'm running Tomcat 6, and changed my previous -Xmx1024M setting to -Xmx2048M (there's plenty of RAM on the machine). However, this didn't change anything. Looking at the status of Tomcat, the heap seems to have plenty of space to accomodate the SOAP response. The problem does not seem to be related to PermGen space available either.

The error is not related to the time the application have been running, it can happen immediately upon start of Tomcat. Hence it seems not related to the overall load on the server.

Does anybody have any ideas about this? Am I dealing with a known bug in Axis? I've found a few cases of people getting OutOfMemoryError exception when sending huge attachments over SOAP, however, this is not what I'm doing.

I'm using wrapped/literal for the SOAP web service.

Exception in thread "Thread-6" java.lang.OutOfMemoryError: Java heap space
        at org.apache.axis.message.SAX2EventRecorder$objArrayVector.add(SAX2EventRecorder.java:254)
        at org.apache.axis.message.SAX2EventRecorder.newElement(SAX2EventRecorder.java:136)
        at org.apache.axis.encoding.DeserializationContext.pushNewElement(DeserializationContext.java:769)
        at org.apache.axis.message.SOAPHandler.startElement(SOAPHandler.java:94)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:504)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事与诗 2024-11-07 12:41:09

从表面上看,我认为问题不在于 Axis。您是否尝试过进行内存分析?使用内存分析器工具 (MAT) 等工具。

From the look of it, I'd say the problem is not with Axis. Did you try to perform a memory analysis? With a tool like Memory Analyzer Tool (MAT).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文