1

我有一个名为ICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage如下定义的类

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);
    }
}

我正在尝试做

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

从哪里来exceptionClassICwsTransactionProcessing_Capture_CWSInvalidOperationFaultFault_FaultMessage日志。

我越来越NoSuchMethodException。为什么?

4

1 回答 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.

于 2013-01-02T15:41:45.750 回答