tags:

views:

422

answers:

3

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 wsimport process is maxing out at 64 MB. How can I increase the heap memory for wsimport?

Thanks,

+1  A: 

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.

DaGGeRRz
Setting the argument as WSIMPORT_OPTS=-Xmx512M doesn't help. The memory through JConsole is still 64MB and I'm still getting the out of memory error.
java_pill
Strange, you're in the same console session right (ie running the SET command in the same window as the wsimport command)? Try checking you're wsimport.bat file and adding the -Xmx flag directly after %JAVA% in the ":LAUNCH" section. ("%JAVA% -Xmx512M %WSIMPORT_OPTS% -jar "%JAXWS_HOME%\lib\jaxws-tools.jar" %*")
DaGGeRRz
With Java 1.6 JAX WS comes bundled in rt.jar and wsimport comes as an executable like javac or java. There is no wsimport.bat however, creating one and calling wsimport with -Xmx setting doesn't work. Not sure how one can pass memory options to wsimport.exe
java_pill
A: 

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.

java_pill
+1  A: 

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.)

Paul Brown