com.sap.conn.jco

## Class JCoException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - com.sap.conn.jco.JCoException

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    AbapClassException, AbapException

      public class JCoException
      extends Exception

  General JCo exception object. It supports getting information about so-called T100 messages, if the ABAP system used a message statement for signalling an exceptional situation. T100 is the possibility in ABAP to define language independent error messages. The true human-readable message can be generated using the key information (message class and number), and the parameters, which should be language-neutral.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `JCO_ERROR_ABAP_CLASS_EXCEPTION` A ABAP class exception has been thrown by a function module in the remote system.
    `static int` | `JCO_ERROR_ABAP_EXCEPTION` An exception has been thrown by a function module in the remote system.
    `static int` | `JCO_ERROR_APPLICATION_EXCEPTION` An application error occurred in a JCo server.
    `static int` | `JCO_ERROR_CANCELLED` A registered server connection has been canceled on the gateway.
    `static int` | `JCO_ERROR_COMMUNICATION` Exception is caused by network problems, connection breakdowns, gateway problems, inavailability of the remote SAP system, etc.
    `static int` | `JCO_ERROR_CONCURRENT_CALL` A concurrent method call has been detected.
    `static int` | `JCO_ERROR_CONFIGURATION` A general configuration error detected.
    `static int` | `JCO_ERROR_CONVERSION` A conversion between two representations of either a parameter, structure, or table field has failed.
    `static int` | `JCO_ERROR_CREATE_SESSION`
    `static int` | `JCO_ERROR_DATA_PROVIDER_ERROR` A data provider signaled an internal error to JCo.
    `static int` | `JCO_ERROR_DESTINATION_DATA_INVALID` An destination instance was used, for which the configuration was either deleted or updated.
    `static int` | `JCO_ERROR_DESTROY_SESSION`
    `static int` | `JCO_ERROR_DSR_LOAD_ERROR` DSR is turned on via JCo property, but the library could not loaded properly.
    `static int` | `JCO_ERROR_EXTENSION` An exception is thrown due to a situation caused by an infrastructure extension.
    `static int` | `JCO_ERROR_FIELD_NOT_FOUND` A field requested from either a JCoRecord or one of its extending.
    `static int` | `JCO_ERROR_FUNCTION_NOT_FOUND` A function template could not completely be retrieved from the repository in a JCo server or an error occured during creation of it.
    `static int` | `JCO_ERROR_ILLEGAL_ARGUMENT` An illegal method argument has been detected.
    `static int` | `JCO_ERROR_ILLEGAL_STATE` An illegal situation occurred within JCo runtime.
    `static int` | `JCO_ERROR_ILLEGAL_TID` An invalid transaction ID has been encountered.
    `static int` | `JCO_ERROR_INITIALIZATION` Some initialization failed within JCo.
    `static int` | `JCO_ERROR_INTERNAL` An internal error in the JCo runtime.
    `static int` | `JCO_ERROR_INVALID_HANDLE` A connection handle used internally is invalid, e.g.
    `static int` | `JCO_ERROR_INVALID_REPOSITORY_CACHE` Indicates an invalid repository cache.
    `static int` | `JCO_ERROR_JARM_LOAD_ERROR` jARM is turned on via JCo property, but the library could not loaded properly.
    `static int` | `JCO_ERROR_LOGON_FAILURE` Authorization failures during the logon phase in the ABAP backend.
    `static int` | `JCO_ERROR_NOT_SUPPORTED` Used for various situations that are not supported within JCo.
    `static int` | `JCO_ERROR_NULL_HANDLE` A connection handle used internally is null.
    `static int` | `JCO_ERROR_PASSIVATE_SESSION`
    `static int` | `JCO_ERROR_PASSWORD_CHANGE_REQUIRED` When connecting to a partner system that does not allow to logon with initial and expired passwords this group will be used.
    `static int` | `JCO_ERROR_PROGRAM` The application using JCo provides JCo wrong information or is behaving incorrectly.
    `static int` | `JCO_ERROR_PROTOCOL` An internal communication protocol error has been detected, while processing data coming over the line.
    `static int` | `JCO_ERROR_REGISTRATION_DENIED` The gateway is protected with a reg_info file, and the registration of a server failed due to incomplete permissions of the current server.
    `static int` | `JCO_ERROR_REPOSITORY_SERIALIZATION` Indicates an error in json stream.
    `static int` | `JCO_ERROR_REQUEST_CANCELLED` A function module execution was cancelled because the scope/session, in which it was running, has been finished.
    `static int` | `JCO_ERROR_RESOURCE` Indicates that JCo has issues with resources, such as connections in a connection pool, destinations, or servers.
    `static int` | `JCO_ERROR_RESTORE_SESSION`
    `static int` | `JCO_ERROR_SERVER_DATA_INVALID` A server instance was used, for which the configuration was either deleted or updated.
    `static int` | `JCO_ERROR_SERVER_STARTUP` Something went wrong during the startup phase of a JCo server.
    `static int` | `JCO_ERROR_SESSION_REF_NOT_VALID`
    `static int` | `JCO_ERROR_SHAREABLE_CONTAINER` Not used in standalone environment.
    `static int` | `JCO_ERROR_STATE_BUSY` The remote ABAP system is busy.
    `static int` | `JCO_ERROR_SYSTEM_FAILURE` A system failure has occurred in the remote SAP system.
    `static int` | `JCO_ERROR_TIMEOUT` A timeout occurred while trying to logon to an ABAP system.
    `static int` | `JCO_ERROR_UNSUPPORTED_CODEPAGE` The remote SAP system or the local systems runs under a codepage, which is not supported by JCoRuntime.
    `static int` | `JCO_ERROR_XML_PARSER` An exception is thrown while processing XML like serialized data.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JCoException(int group, String message)` Creates an instance of the error object with the specified message.
    `JCoException(int group, String key, String message)` Creates an instance of the error object with the specified message.
    `JCoException(int group, String message, String messageClass, char messageType, String messageNumber, String[] messageParameters, Throwable cause, String raisedBy)` Creates an instance of the exception object with the specified message and more information for ABAP messages.
    `JCoException(int group, String key, String message, String messageClass, char messageType, String messageNumber, String[] messageParameters)` Creates an instance of the exception object with the specified message and more information for ABAP messages.
    `JCoException(int group, String key, String message, String messageClass, char messageType, String messageNumber, String[] messageParameters, Throwable cause)` Creates an instance of the exception object with the specified message and more information for ABAP messages.
    `JCoException(int group, String key, String message, String messageClass, char messageType, String messageNumber, String[] messageParameters, Throwable cause, String raisedBy)` Creates an instance of the exception object with the specified message and more information for ABAP messages.
    `JCoException(int group, String key, String message, Throwable cause)` Creates an instance of the error object with the specified message.
    `JCoException(int group, String message, Throwable cause)` Creates an instance of the error object with the specified message.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getGroup()` Returns the error group.
    `String` | `getKey()` Returns the error key.
    `String` | `getMessageClass()` Returns the ABAP message class, if T100 message information is available.
    `String` | `getMessageNumber()` Returns the ABAP message number, if T100 message information is available.
    `String` | `getMessageParameter(int index)` Returns the ABAP message parameter at position index or null if there is none at that position.
    `String[]` | `getMessageParameters()` Returns the ABAP message parameters as array.
    `String` | `getMessageText()` Returns the ABAP message text, if T100 message information is available.
    `char` | `getMessageType()` Returns the ABAP message type, if T100 message information is available.
    `String` | `toString()` Returns a short description of this exception.

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### JCO_ERROR_PROGRAM

          public static final int JCO_ERROR_PROGRAM

      The application using JCo provides JCo wrong information or is behaving incorrectly.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_CONFIGURATION

          public static final int JCO_ERROR_CONFIGURATION

      A general configuration error detected. If the configuration obtained from DestinationDataProvider or ServerDataProvider is wrong, incomplete or not unique
      See Also:
        Constant Field Values

    - #### JCO_ERROR_COMMUNICATION

          public static final int JCO_ERROR_COMMUNICATION

      Exception is caused by network problems, connection breakdowns, gateway problems, inavailability of the remote SAP system, etc. Anything that has to do with general communication failures.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_LOGON_FAILURE

          public static final int JCO_ERROR_LOGON_FAILURE

      Authorization failures during the logon phase in the ABAP backend. Usually caused by unknown user name (typos), wrong password, invalid certificates, expired logon tickets etc. For resolving the issue either the configuration or the ABAP backend settings need to be adjusted. No issue in the JCo runtime.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_SYSTEM_FAILURE

          public static final int JCO_ERROR_SYSTEM_FAILURE

      A system failure has occurred in the remote SAP system. There are different causes possible: a message statement in the code (check out the additional information), a short dump of the work process, a process core or any other unexpected failure, such as uncaught exceptions. In any case, it's a good idea to check the runtime errors in the ABAP system (st22). It's nothing that could be solved in JCo coding.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_APPLICATION_EXCEPTION

          public static final int JCO_ERROR_APPLICATION_EXCEPTION

      An application error occurred in a JCo server.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_RESOURCE

          public static final int JCO_ERROR_RESOURCE

      Indicates that JCo has issues with resources, such as connections in a connection pool, destinations, or servers. Typically, there is a lack of resources, e.g. potentially due to high load or simply no destination available at all
      See Also:
        Constant Field Values

    - #### JCO_ERROR_PROTOCOL

          public static final int JCO_ERROR_PROTOCOL

      An internal communication protocol error has been detected, while processing data coming over the line.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_INTERNAL

          public static final int JCO_ERROR_INTERNAL

      An internal error in the JCo runtime. Typically, this is an unexpected situation, where it does not make sense to continue with normal processing. More details should be available in the message.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_CANCELLED

          public static final int JCO_ERROR_CANCELLED

      A registered server connection has been canceled on the gateway.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_STATE_BUSY

          public static final int JCO_ERROR_STATE_BUSY

      The remote ABAP system is busy. Try again later. This is typically a temporary situation.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_ABAP_CLASS_EXCEPTION

          public static final int JCO_ERROR_ABAP_CLASS_EXCEPTION

      A ABAP class exception has been thrown by a function module in the remote system. Used for `AbapClassException`.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_REQUEST_CANCELLED

          public static final int JCO_ERROR_REQUEST_CANCELLED

      A function module execution was cancelled because the scope/session, in which it was running, has been finished. The backend will rollback anything that has not yet been committed.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_REGISTRATION_DENIED

          public static final int JCO_ERROR_REGISTRATION_DENIED

      The gateway is protected with a reg_info file, and the registration of a server failed due to incomplete permissions of the current server.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_EXTENSION

          public static final int JCO_ERROR_EXTENSION

      An exception is thrown due to a situation caused by an infrastructure extension.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_NULL_HANDLE

          public static final int JCO_ERROR_NULL_HANDLE

      A connection handle used internally is null.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_CONVERSION

          public static final int JCO_ERROR_CONVERSION

      A conversion between two representations of either a parameter, structure, or table field has failed. E.g. this can happen when using one of the `JCoRecord.setValue()` methods. Used in `ConversionException`.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_FUNCTION_NOT_FOUND

          public static final int JCO_ERROR_FUNCTION_NOT_FOUND

      A function template could not completely be retrieved from the repository in a JCo server or an error occured during creation of it.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_ILLEGAL_TID

          public static final int JCO_ERROR_ILLEGAL_TID

      An invalid transaction ID has been encountered. The TID was either longer than 24 characters or contained illegal characters
      See Also:
        Constant Field Values

    - #### JCO_ERROR_UNSUPPORTED_CODEPAGE

          public static final int JCO_ERROR_UNSUPPORTED_CODEPAGE

      The remote SAP system or the local systems runs under a codepage, which is not supported by JCoRuntime.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_ABAP_EXCEPTION

          public static final int JCO_ERROR_ABAP_EXCEPTION

      An exception has been thrown by a function module in the remote system. Used for `AbapException`.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_FIELD_NOT_FOUND

          public static final int JCO_ERROR_FIELD_NOT_FOUND

      A field requested from either a JCoRecord or one of its extending. types does not exist
      See Also:
        Constant Field Values

    - #### JCO_ERROR_NOT_SUPPORTED

          public static final int JCO_ERROR_NOT_SUPPORTED

      Used for various situations that are not supported within JCo. Moreover, it's used if a function received by a server is not supported by any call handler.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_SERVER_STARTUP

          public static final int JCO_ERROR_SERVER_STARTUP

      Something went wrong during the startup phase of a JCo server. Usually, this is caused by network issues or the gateway is shutting down so that a registration is refused.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_XML_PARSER

          public static final int JCO_ERROR_XML_PARSER

      An exception is thrown while processing XML like serialized data. Used for `XMLParserException`.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_ILLEGAL_ARGUMENT

          public static final int JCO_ERROR_ILLEGAL_ARGUMENT

      An illegal method argument has been detected.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_CONCURRENT_CALL

          public static final int JCO_ERROR_CONCURRENT_CALL

      A concurrent method call has been detected. This occurs, if a destination set to stateful in a certain scope/session is used concurrently in several threads. This should be avoided, as otherwise random results are possible.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_INVALID_HANDLE

          public static final int JCO_ERROR_INVALID_HANDLE

      A connection handle used internally is invalid, e.g. if trying to use a connection that was closed by lower layers
      See Also:
        Constant Field Values

    - #### JCO_ERROR_INITIALIZATION

          public static final int JCO_ERROR_INITIALIZATION

      Some initialization failed within JCo.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_TIMEOUT

          public static final int JCO_ERROR_TIMEOUT

      A timeout occurred while trying to logon to an ABAP system.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_ILLEGAL_STATE

          public static final int JCO_ERROR_ILLEGAL_STATE

      An illegal situation occurred within JCo runtime.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_PASSWORD_CHANGE_REQUIRED

          public static final int JCO_ERROR_PASSWORD_CHANGE_REQUIRED

      When connecting to a partner system that does not allow to logon with initial and expired passwords this group will be used.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_DSR_LOAD_ERROR

          public static final int JCO_ERROR_DSR_LOAD_ERROR

      DSR is turned on via JCo property, but the library could not loaded properly.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_SESSION_REF_NOT_VALID

          public static final int JCO_ERROR_SESSION_REF_NOT_VALID

      See Also:
        Constant Field Values

    - #### JCO_ERROR_JARM_LOAD_ERROR

          public static final int JCO_ERROR_JARM_LOAD_ERROR

      jARM is turned on via JCo property, but the library could not loaded properly.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_DATA_PROVIDER_ERROR

          public static final int JCO_ERROR_DATA_PROVIDER_ERROR

      A data provider signaled an internal error to JCo.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_SHAREABLE_CONTAINER

          public static final int JCO_ERROR_SHAREABLE_CONTAINER

      Not used in standalone environment. (Re)Storing connection state failed.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_CREATE_SESSION

          public static final int JCO_ERROR_CREATE_SESSION

      See Also:
        Constant Field Values

    - #### JCO_ERROR_PASSIVATE_SESSION

          public static final int JCO_ERROR_PASSIVATE_SESSION

      See Also:
        Constant Field Values

    - #### JCO_ERROR_RESTORE_SESSION

          public static final int JCO_ERROR_RESTORE_SESSION

      See Also:
        Constant Field Values

    - #### JCO_ERROR_DESTROY_SESSION

          public static final int JCO_ERROR_DESTROY_SESSION

      See Also:
        Constant Field Values

    - #### JCO_ERROR_DESTINATION_DATA_INVALID

          public static final int JCO_ERROR_DESTINATION_DATA_INVALID

      An destination instance was used, for which the configuration was either deleted or updated. Hence, the old instance should no longer be used, but a new one fetched with the `JCoDestinationManager`. `JCoDestination.isValid()` would return `false` in this case.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_SERVER_DATA_INVALID

          public static final int JCO_ERROR_SERVER_DATA_INVALID

      A server instance was used, for which the configuration was either deleted or updated.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_INVALID_REPOSITORY_CACHE

          public static final int JCO_ERROR_INVALID_REPOSITORY_CACHE

      Indicates an invalid repository cache. Used to report issues in ABAP Repository or custom repository data.
      See Also:
        Constant Field Values

    - #### JCO_ERROR_REPOSITORY_SERIALIZATION

          public static final int JCO_ERROR_REPOSITORY_SERIALIZATION

      Indicates an error in json stream.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JCoException

          public JCoException(int group,
                      String key,
                      String message)

      Creates an instance of the error object with the specified message.
      Parameters:
        `group` - the error group identifying the error
        `key` - error code to identify the error
        `message` - the specified detail message.

    - #### JCoException

          public JCoException(int group,
                      String message)

      Creates an instance of the error object with the specified message.
      Parameters:
        `group` - the error group identifying the error
        `message` - the specified detail message.
      Since:
        JCo 3.0.6

    - #### JCoException

          public JCoException(int group,
                      String key,
                      String message,
                      Throwable cause)

      Creates an instance of the error object with the specified message.
      Parameters:
        `group` - the error group identifying the error
        `key` - error code to identify the error
        `message` - the specified detail message.
        `cause` - a Throwable that caused the JCoException.

    - #### JCoException

          public JCoException(int group,
                      String message,
                      Throwable cause)

      Creates an instance of the error object with the specified message.
      Parameters:
        `group` - the error group identifying the error
        `message` - the specified detail message.
        `cause` - a Throwable that caused the JCoException.
      Since:
        JCo 3.0.6

    - #### JCoException

          public JCoException(int group,
                      String key,
                      String message,
                      String messageClass,
                      char messageType,
                      String messageNumber,
                      String[] messageParameters)

      Creates an instance of the exception object with the specified message and more information for ABAP messages.
      Parameters:
        `group` - the error group identifying the error
        `key` - error code to identify the error
        `message` - the specified detail message.
        `messageClass` - the specified ABAP message class.
        `messageType` - the specified ABAP message type, e.g. 'A' or 'E'
        `messageNumber` - the specified ABAP message number.
        `messageParameters` - the specified ABAP message Parameters.

    - #### JCoException

          public JCoException(int group,
                      String key,
                      String message,
                      String messageClass,
                      char messageType,
                      String messageNumber,
                      String[] messageParameters,
                      Throwable cause)

      Creates an instance of the exception object with the specified message and more information for ABAP messages.
      Parameters:
        `group` - the error group identifying the error
        `key` - error code to identify the error
        `message` - the specified detail message.
        `messageClass` - the specified ABAP message class.
        `messageType` - the specified ABAP message type, e.g. 'A' or 'E'
        `messageNumber` - the specified ABAP message number.
        `messageParameters` - the specified ABAP message Parameters.
        `cause` - a Throwable that caused the JCoException.

    - #### JCoException

          public JCoException(int group,
                      String message,
                      String messageClass,
                      char messageType,
                      String messageNumber,
                      String[] messageParameters,
                      Throwable cause,
                      String raisedBy)

      Creates an instance of the exception object with the specified message and more information for ABAP messages.
      Parameters:
        `group` - the error group identifying the error
        `message` - the specified detail message.
        `messageClass` - the specified ABAP message class.
        `messageType` - the specified ABAP message type, e.g. 'A' or 'E'
        `messageNumber` - the specified ABAP message number.
        `messageParameters` - the specified ABAP message Parameters.
        `cause` - a Throwable that caused the JCoException.
        `raisedBy` - some information about the system where the exception / message was raised from.
      Since:
        JCo 3.0.6

    - #### JCoException

          public JCoException(int group,
                      String key,
                      String message,
                      String messageClass,
                      char messageType,
                      String messageNumber,
                      String[] messageParameters,
                      Throwable cause,
                      String raisedBy)

      Creates an instance of the exception object with the specified message and more information for ABAP messages.
      Parameters:
        `group` - the error group identifying the error
        `key` - error code to identify the error
        `message` - the specified detail message.
        `messageClass` - the specified ABAP message class.
        `messageType` - the specified ABAP message type, e.g. 'A' or 'E'
        `messageNumber` - the specified ABAP message number.
        `messageParameters` - the specified ABAP message Parameters.
        `cause` - a Throwable that caused the JCoException.
        `raisedBy` - some information about the system where the exception / message was raised from.

  - ### Method Detail

    - #### getGroup

          public final int getGroup()

      Returns the error group. Valid error groups are the constants in JCoException starting with the prefix JCO_ERROR. Details about the different meanings are available there.
      Returns:
        the error group

    - #### getKey

          public final String getKey()

      Returns the error key. That's a string representation of the group.
      Returns:
        the error key

    - #### getMessageClass

          public String getMessageClass()

      Returns the ABAP message class, if T100 message information is available.
      Returns:
        the ABAP message class

    - #### getMessageNumber

          public String getMessageNumber()

      Returns the ABAP message number, if T100 message information is available.
      Returns:
        the ABAP message number

    - #### getMessageText

          public String getMessageText()

      Returns the ABAP message text, if T100 message information is available. This is a concatenation of all T100 parameters. Calling this method makes sense if the message is mainly built from parameters.
      Returns:
        the ABAP message text

    - #### getMessageParameter

          public String getMessageParameter(int index)

      Returns the ABAP message parameter at position index or null if there is none at that position. Prerequisite is that T100 information is available at all.
      Parameters:
        `index` - index of the parameter valid is between 0 and 3
      Returns:
        the ABAP message parameter

    - #### getMessageParameters

          public String[] getMessageParameters()

      Returns the ABAP message parameters as array. Note: parameters that are not filled can be null. Prerequisite is that T100 information is available at all.
      Returns:
        the ABAP message parameters as array

    - #### getMessageType

          public char getMessageType()

      Returns the ABAP message type, if T100 message information is available.
      Returns:
        the ABAP message type

    - #### toString

          public String toString()

      Returns a short description of this exception.
      Overrides:
        `toString` in class `Throwable`
      Returns:
        a string representation of this `JCoException`.

Copyright © 2016 SAP. All Rights Reserved.