大型WSDL(播放框架)上的Java内存不足错误 [英] Java out of memory errors on large WSDLs (play framework)

查看:113
本文介绍了大型WSDL(播放框架)上的Java内存不足错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试生成和使用非常大的代理文件时,我们遇到了问题(根据记录,该文件来自MSCRM Dynamics WSDL).在解决这个问题之前:我们已经在使用NetBeans的独立应用程序中进行了此工作.我们使用"WSDL2Java -uri等"生成了所有代理文件.戳一些网络方法并成功获得响应等.

We've got a problem when trying to generate and use a really large proxy file (For the record, it's from a MSCRM Dynamics WSDL). Before I get to the issue: we already have this working in a stand alone app using NetBeans. We generated all the proxy files using "WSDL2Java -uri etc etc". Poked at a few of the web methods and successfully got responses etc.

现在,当我们尝试将其集成到eclipse中的目标项目中(通过play框架启动)时,它会抛出内存不足错误.这发生在我什至尝试致电任何Web服务之前.我已经阅读了有关Play Framework和Axis2的内存问题,但尚未看到解决该问题的任何方法.我已经尝试过增加游戏中的内存,但这并没有帮助.我在Windows上运行,但是即使我有64位操作系统,似乎也只能为游戏堆空间分配1.5gb:

Now, when we try to integrate it into the destination project in eclipse (launched through play framework) it throws out of memory errors. This happens before I even try to make a call to any webservices. I've read about memory issues with Play Framework and Axis2, but haven't as of yet seen any solutions to the problem. I've tried upping the memory on play, but that didn't help. I'm running on windows, but even though I have a 64 bit OS can only seem to allocate 1.5gb to the play heap space:

play clean  
play run . -Xms1536m

我以为就足够了,可惜没有!

I thought this would be enough, but alas no!

作为参考,堆栈跟踪为:

For reference the stack trace is:

 An unexpected error occured caused by exception OutOfMemoryError: Java heap space

 play.exceptions.UnexpectedException: Unexpected Error
         at play.Invoker$Invocation.onException(Invoker.java:244)
         at play.Invoker$Invocation.run(Invoker.java:286)
         at Invocation.HTTP Request(Play!) Caused by: java.lang.OutOfMemoryError: Java heap space
         at java.util.Arrays.copyOfRange(Unknown Source)
         at java.lang.String.<init>(Unknown Source)
         at java.lang.StringBuffer.toString(Unknown Source)
         at java.io.StringWriter.toString(Unknown Source)
         at org.apache.commons.io.IOUtils.toString(IOUtils.java:383)
         at play.libs.IO.readContentAsString(IO.java:60)
         at play.libs.IO.readContentAsString(IO.java:49)
         at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
         at play.classloading.ApplicationClasses$ApplicationClass.refresh(ApplicationClasses.java:199)
         at play.classloading.ApplicationClasses$ApplicationClass.<init>(ApplicationClasses.java:191)
         at play.classloading.ApplicationClasses.getApplicationClass(ApplicationClasses.java:49)
         at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:266)
         at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:478)
         at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
         at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:424)
         at play.Play.start(Play.java:505)
         at play.Play.detectChanges(Play.java:618)
         at play.Invoker$Invocation.init(Invoker.java:198)
         ... 1 more

任何帮助或想法都将不胜感激!

Any help or thoughts would be greatly appreciated!

更新1

根据FloppyDisk的建议,我检查/更改了以下内容以查看是否有帮助:

Following advice from FloppyDisk I've checked / changed the following to see if it helps:

首先,使用帖子

Firstly, using the post How can I tell if I'm running in 64-bit JVM or 32-bit JVM (from within a program)?, I ran the following to ensure I'm running 64 bit jdk:

java -d64 -version

没有抛出任何错误.接下来,我尝试将eclipse中的内存设置更改为以下内容:

Which didn't throw any errors. Next I tried changing my memory settings in eclipse to the following:

-vmargs
-Xms512m
-Xmx1024m
-XX:MaxPermSize=512m

重新开始蚀并重试.不幸的是,同样的问题仍然存在.

Restarted eclipse and retried. Unfortunately the same problem still existed.

最后,我尝试使用Axis2配置在wsdl上引入减少的缓存.修改了Axis2.xml,使其包含以下内容:

Finally, I tried introducing reduced caching on the wsdl using Axis2 config. Modified Axis2.xml to include the following:

<parameter name="reduceWSDLMemoryCache">true</parameter>

不幸的是,同样的问题仍然存在.

Unfortunately, same problem persists.

推荐答案

好吧,经过大量研究,我想出了解决方法.

Ok, after lots of research I figured out how to resolve this.

有效地,动力学是一个巨大的wsdl,这导致了巨大的存根文件.因此,我不得不思考是否有什么办法可以将该文件分解为更小的部分?在开始处理存根文件的大型手动任务之前,我对Axis2和WSDL2Java工具进行了一些研究.这导致我发现了1个主要问题:ADB与XMLBeans

Effectively, dynamics is a flippin enormous wsdl, so it results in a humongous stub file. So I got to thinking is there any way I could break this file down into smaller parts? Before embarking on a massive manual task of going through the stub file I did a bit of research on Axis2 and the WSDL2Java tool. This resulted in me finding out 1 major thing: ADB vs XMLBeans

http://axis.apache.org/axis2 /java/core/docs/userguide-creatingclients.html

http://axis.apache.org /axis2/java/core/docs/userguide-creatingclients-xmlbeans.html

因此,我使用的是ADB(对于合理大小的WSDLS来说可能是完美的选择),但是对于我的库和框架的组合,我真正应该使用的是XMLBeans.这导致了另一个问题(由于我自己的愚蠢,我最终回答了自己!)

So, what I was using was ADB (which is probably perfect for reasonable sized WSDLS), but for my combination of libraries and frameworks what I really should use is XMLBeans. This resulted in another question on here (which I ended up answering myself due to my own stupidity!) org.apache.axiom.om.util.AXIOMUtil cannot be resolved.

无论如何,我遵循了该指南,它消除了我所有的内存问题,现在我可以与动力学建立联系了.与ADB为您提供的代码相比,生成的代码更加笨拙,但是它可以正常工作,而这一切都很重要!

Anyway, I followed that guide and it removed all of my memory issues and now I have a connection to dynamics. The resulting code is a bit more clunky compared to what ADB provides you with, but it's working, and that's all that matters!

感谢所有评论,他们向我提出了解决问题的正确方向.

Thanks for all the comments, they prodded me in the right direction towards solving this.

这篇关于大型WSDL(播放框架)上的Java内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆