Getting stack trace: java.lang.reflect.InvocationTargetException when consuming a SOAP service

Date:24 July 2006
Product/Release:LANSA Integrator V11.0
Abstract:Executing a SOAP agent gives 'stack trace: java.lang.reflect.InvocationTargetException' error in Service.txt
Submitted By:LANSA Technical Support

Description:

The following error is produced in the SERVICE.TXT Trace file when consuming a SOAP Service.

stack trace: java.lang.reflect.InvocationTargetException
    ...
    ...
    ...
Caused by: java.lang.NoClassDefFoundError:

Solution:

The above exception will be generated when the jar file being referred to on the iSeries does not contain the correct code (method/Class).

Make sure that the right version of the jar file is kept in the JAR folder on the iSeries and that there are NO old versions of that JAR file stored in that folder. THIS IS IMPORTANT!~

The correct method/class/jar file may not be able to be located due to any of the following reasons.

  1. the right JAR file does not exist on the server
  2. the WSDL and the subsequent Jar file on the Server has been updated and the WSDL consumed is NOT the latest
  3. there are multiple jar files of the same type in the JAR folder. In most cases users rename their old JAR files before placing the newly updated JAR files. This should NOT be done as the right methods are not picked up. So get rid of ALL unnecessary JAR files from the SERVER. see below
  4. existence of unnecessary/duplicate/old JAR files in the ENDORSED directory?
  5. It may also be that your agent JAR file was not generated using the latest WSDL. It may be worth checking this as well.