1 Reply Latest reply on Apr 18, 2005 9:49 AM by Thomas Diesler

    Custom exception containing an array

    Dan Smith Newbie

      Hi all,

      I am trying to get custom exceptions to work. I have succeeded in getting a simple custom exception to work, that I can catch on the client and get the error etc. I am using:

      - JBoss 4.0.2RC1
      - Document literal service

      For example, the following works fine:

      public class CustomException extends Exception
      {
       private int errorCode;
      
       public CustomException( String message, int errorCode )
       {
       super( message );
       this.errorCode = errorCode;
       }
      
       public int getErrorCode()
       {
       return errorCode;
       }
      }
      


      However, when I change this to contain an array of errors, I get an exception thrown on the server. For example, this does not work:
      package com.danny;
      
      public class CustomException extends Exception
      {
       private int[] errorCodes;
      
       public CustomException( String message, int[] errorCodes )
       {
       super( message );
       this.errorCodes = errorCodes;
       }
      
       public int[] getErrorCodes()
       {
       return errorCodes;
       }
      }
      


      My deployment descriptors etc. should be fine since I don't change them when I go from the simple example to the one with the array. I just rebuild the generated files using wscompile and redeploy.

      Is there any known reason why this should not work?

      Here is the RemoteException caught on the client side:
      Apr 18, 2005 8:41:00 AM com.sun.xml.messaging.saaj.soap.MessageImpl <init>
      SEVERE: SAAJ0535: Unable to internalize message
      
      java.rmi.RemoteException: HTTP transport error: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message; nested exception is:
       HTTP transport error: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message
       at com.danny.CustomExceptionDocLitService_Stub.throwException(CustomExceptionDocLitService_Stub.java:91)
       at com.danny.CustomExceptionDocLitClient.testException(CustomExceptionDocLitClient.java:49)
       at com.danny.CustomExceptionDocLitClient.test(CustomExceptionDocLitClient.java:30)
       at com.danny.CustomExceptionDocLitClient.main(CustomExceptionDocLitClient.java:67)
      Caused by: HTTP transport error: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message
       at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:140)
       at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:92)
       at com.danny.CustomExceptionDocLitService_Stub.throwException(CustomExceptionDocLitService_Stub.java:68)
       ... 3 more
      


      Any insight on this would be much appreciated ;-) Thanks!