0

I have created a custom exception class to handle all my project's errors.
It's linked to a SOAP web service, that's why there is @WebFault.

GTWException class

@WebFault(name = "GTWFaultBean", targetNamespace = "http://www.raiffeisen.lu")
public class GTWException extends Exception implements Serializable
{   
/**
 * 
 */
private static final long serialVersionUID = 6512673270706929264L;
private String errorDescription;
private String errorLocation;

public GTWException(String errorDescription){
    super();
    this.errorDescription = errorDescription;
}

public GTWException(String errorDescription, String errorLocation) {
    super();
    this.errorDescription = errorDescription;
    this.errorLocation = errorLocation;
}

public String getException()
{
    String error = "location:"+errorLocation+"|*SEP*|"+"description:"+errorDescription;
    return error;
}

public int getExceptionId()
{
    int exceptionId = 1;
    if(errorDescription!=null)
    {
        exceptionId = 0;
    }
    return exceptionId;
}

public static String toString(Throwable th) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    th.printStackTrace(pw);
    return sw.toString();
  }
}

GTWFaultBean class

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GTWFaultBean", propOrder = {
"errorMessage"
})
public class GTWFaultBean implements Serializable {
/**
 * 
 */
private static final long serialVersionUID = 2774168704928329294L;
private String errorMessage;
private String errorCode;

public String getErrorMessage() {
    return errorMessage;
}
public void setErrorMessage(String errorMessage) {
    this.errorMessage = errorMessage;
}
public String getErrorCode() {
    return errorCode;
}
public void setErrorCode(String errorCode) {
    this.errorCode = errorCode;
}


}

Here is my console output

exception.GTWException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createUserDefinedException(SOAPFaultBuilder.java:309)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:130)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
at com.sun.proxy.$Proxy10.create(Unknown Source)
at controller.WSconsumer.consumeWS(WSconsumer.java:69)
at controller.WSconsumer.main(WSconsumer.java:87)

I searched a lot by myself but I couldn't figure the problem out.

What am I Doing wrong ?

johnywhite
  • 21
  • 1
  • 8
  • try also adding an empty constructor – cralfaro Jul 04 '16 at 12:13
  • @cralfaro I tried. Same issue. – johnywhite Jul 04 '16 at 12:17
  • I was checking this example, https://docs.oracle.com/cd/E24329_01/web.1211/e24965/faults.htm#WSADV641, could you verify you created correctly the class GTWFaultBean? – cralfaro Jul 04 '16 at 12:21
  • @cralfaro The class GTWFaultBean seems correct to me. I added it to my post, could you check if the class is ok ? – johnywhite Jul 04 '16 at 12:31
  • Seems ok, only difference is the Serializable implementation and i dont think this could generate any prblem, have a look at this link and check if could be useful http://stackoverflow.com/questions/28462923/noclassdeffounderror-for-com-sun-xml-internal-ws-fault-soapfaultbuilder – cralfaro Jul 04 '16 at 12:36
  • 1
    The issue may come from a conflict between my project's jars. Indeed I have two linked projects in my work space that have the same jars. – johnywhite Jul 04 '16 at 12:55

1 Answers1

0

Hint - Are you using testContainers. If yes can you verify the docker daemon is running which provides required dependencies.

Akash Verma
  • 638
  • 1
  • 11
  • 15