1

I have one class called ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage as defined below

public class ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage
        extends java.lang.Exception {

    private static final long serialVersionUID = 1354218639401L;

    public ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage() {
        super("ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage");
    }

    public ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage(
            java.lang.String s) {
        super(s);
    }

    public ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage(
            java.lang.String s, java.lang.Throwable ex) {
        super(s, ex);
    }

    public ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage(
            java.lang.Throwable cause) {
        super(cause);
    }
}

I am trying to do

java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"Capture"));
                    LOGGER.debug("ExceptionClassName"+exceptionClassName);
                    java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
                    java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);

where exceptionClass is ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage from the log.

I am getting NoSuchMethodException. Why?

9
  • Is this an inner class by any chance? Commented Jan 1, 2013 at 19:34
  • No it is not an inner class. Commented Jan 1, 2013 at 19:36
  • 3
    Then I can't reproduce it. Works fine for me. My guess is that you're not using the class you think you are. Commented Jan 1, 2013 at 19:39
  • 2
    Please show a short but complete example (ideally with a much short class name) which demonstrates the example. Don't put it into comments. Put it into your question. Commented Jan 1, 2013 at 19:49
  • 1
    @PraveenYadav: why don't you add a bit of code to list all constructors? Then create a couple of constructors with weird arguments and see if they appear in the list. If they do not appear, then you are not loading the right class... Commented Jan 1, 2013 at 20:36

1 Answer 1

2

This was a Axis2 bug in the client stub code generated by wsdl2java .

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

The String class used in the generated code should have been java.lang.String but since the WSDL import was using microsoft serialized types, Axis2 had generated an inner class by name String.

The correct code generation should have used java.lang.String for the constructor reflection parameters.

It was a bit difficult to spot because the generated stub has 200k+ lines.

The bug is fixed in the unreleased Axis2 1.6.3 and 1.7 branches.

Thank you all for the help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.