开发者

wsimport out of memory issues in Java 1.6

I'm using wsimport in Java 1.6 (i.e. build 1.6.0-b105) on Windows XP 5.1 and I'm getting a out of memory exception. I used to JConsole and it seems wsimpo开发者_运维百科rt process is maxing out at 64 MB. How can I increase the heap memory for wsimport?

Thanks,


For me setting environment variable WSIMPORT_OPTS (suggested in another answer, and apparently working in older versions of wsimport) does not seem to have any effect.

For me the following does work: instead of wsimport use

java -classpath $JAVA_HOME/lib/tools.jar com.sun.tools.internal.ws.WsImport

where $JAVA_HOME is the JDK (not JRE) root folder.

On this Java command line you can then add whatever JVM options you want. (I needed -Djavax.net.debug=all for SSL trust debugging.)

(I'm using Ubuntu with OpenJDK 6, package version 6b20-1.9.7-0ubuntu1.)


wsimport accepts JVM arguments through the WSIMPORT_OPTS environment variable. So on Windows, try running "set WSIMPORT_OPTS=-Xmx512M" on the command-line before running wsimport to give the JVM 512Mb of heap.


If you're on a sufficiently modern JDK, you can use the -Xnocompile option and then supply the javac process with additional memory the usual way. (Try wsimport --help to see if your version supports the flag.)


wsimport seems to be able to pass through java arguments using the -J option:

wsimport -J-Xmx1024M ...

should work.


I figured to get past this issue. The easiest way is to use Netbeans (I'm using v6.8). Replace the default memory settings in Netbeans.conf under /etc directory like this: -J-Xms768m -J-Xmx768m -J-XX:PermSize=128m and follow the usual way to create Web Service Client following JAX WS in Netbeans. From JConsole, I see that loading ~18,500 classes overall in the memory tends to use between ~400MB to ~650MB. The # of classes generated based on my WSDL/Schemas are ~1500 classes. Hope this helps for someone running into a similar issue.


Just do as below(WINDOWS)

set CLASSPATH=<JAVA_HOME>\lib\tools.jar;%classpath%
java -Xmx1024m com.sun.tools.internal.ws.WsImport <YOUR_WSDL>

It should work

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜