VMware {code} Community
tpcool
Enthusiast
Enthusiast

"code too large" - Javac complains about VimServiceStub.populateFaults method (generated by Axis2 wsdl2java)

Hi,

I am trying to genreate jar file from java classes by compiling the Vsphere wsd, using the Axis2 wsdl2java utility.

Java complains that the code is tool large for method populateFaults in VimServiceStub

vim25\vim25service\VimServiceStub.java:4552: code too large

javac private void populateFaults(){

javac ^

Looks like there is a 64k limit on the method byte size code in java. This method came upto 4000 lines approximately, and it was trying to build the exception to fault map

Did anyone face this issue? I am using javac 1.6.0_14

Currently, I split this method manually, into two parts and calling them separately.

However, I can't rely on this manual intervention, and I would like to automate the whole process.

Let me know if you have any hints/ideas on how to solve this issue

Thank you

0 Kudos
3 Replies
vmkg
Contributor
Contributor

Hey, did you ever figure this one out?

0 Kudos
chwells
Contributor
Contributor

Unfortunately, the problem still exists.  It is due to a bug in Axis2:

https://issues.apache.org/jira/browse/AXIS2-3618

This bug report includes an attached patch.  However, that patch is not compatible for versions of Axis2 after 1.4 and the 1.4 binaries are no longer available at Apache.  It looks like they finally applied the patch to the Axis2 code base in December 2010, but it doesn't look like that patch made it into the latest release (1.5.4).

0 Kudos
timdaley
Contributor
Contributor

I have attached a perl module that I wrote which rebuilds VimServiceStub.java. It's not pretty but I think it does the job. It extracts over 3800 classes from VimServiceStub into their own files. In addition it completely recodes populateFaults to get around the 65K limit. It reduces VimServiceStub.java from 2.5M lines to about 170K lines. Unfortunately, all I know is that it compiles as I don't know how to test it. Yet...

I've also included an ANT file that I use to build everything. It's designed to be run under the Eclipse development tool and I'm running on OSx 10.9. Place these 2 files at the root level of a Java project, put the xsd and wsdl files in a wsdl folder and the jar files in the lib/axis-1.6.2 folder. The jar files are:

XmlSchema-1.4.7.jar

axiom-api-1.2.13.jar

axiom-impl-1.2.13.jar

axis2-adb-1.6.2.jar

axis2-kernel-1.6.2.jar

axis2-transport-http-1.6.2.jar

axis2-transport-local-1.6.2.jar

commons-codec-1.3.jar

commons-httpclient-3.1.jar

commons-logging-1.1.1.jar

httpcore-4.0.jar

mail-1.4.jar

neethi-3.0.2.jar

wsdl4j-1.6.2.jar

Some of these are only needed to run a program using the stub code and more may be needed to get full functionality, but they should be available from the axis2 distribution. You'll have to modify the ANT file to fit your needs. I haven't included all the instructions here, but if you're used to  using Eclipse, they should suffice.

As an extra aid, I've added the following to my eclipse.ini to give enough storage to Java so some of the compiles will complete:

-Xms5g

-Xmx5g

-XX:PermSize=1g

-Xss1M

0 Kudos