Previous Topic: GeneralNext Topic: Password Stored in Clear Text


Error When Exposing Many Services

Symptom:

When many services is exposed from CA Identity Manager, Axis2 generates large stub class violating the JVM compilation rule and it returns the following error:

error: code too large for try statement

Solution:

When you receive such compilation error, perform the following steps to resolve:

  1. Open the generated Stub class file from the following samples directory:
    <samples_dir>\wsdl2java\src\tew6\wsdl
    

    Axis2 generates the stub class in the following format:

    <Service_name>Stub.java
    

    Note: Retrieve the service name from WSDL.

  2. In the stub class file, split the fromOM and populateFaults methods. The following script is an example of fromOM method from the stub class file:
    public org.apache.xmlbeans.Xmlobject fromOM (
    org.apache.axiom.om.OMElement param,
    java.lang.Class type,
    java.util.Map extraNamespaces) throws
    org.apache.axis2.AxisFault {
    try {
    .......
    .......
    .......
    }catch (java.lang.Exception e) {
    throw org.apache.axis2.AxisFault.makeFault(e);
    }
    return null;
    }
    
  3. Split the method script into two halves and name the other half, for instance, fromOMExtended.
  4. Call the newly created method from the fromOM method. The following script is an example of the modified fromOM method:
    public org.apache.xmlbeans.Xmlobject fromOM (
    org.apache.axiom.om.OMElement param,
    java.lang.Class type,
    java.util.Map extraNamespaces) throws
    org.apache.axis2.AxisFault {
    try {
    .......
    .......
    .......
    }catch (java.lang.Exception e) {
    throw org.apache.axis2.AxisFault.makeFault(e);
    }
    //invoking the new method
    return this. fromOMExtended(param, type, extraNamespaces);
    }
    
  5. Repeat the steps 3 and 4 for populateFaults method.
  6. Save the changes and run the following command from the samples directory location for compiling the changes:
    sample_dir_location> ant -Dnowsdlgen=true
    

    The compilation returns no error.