Appendix A. Jolt Class Library Errors and Exceptions

This appendix describes the Jolt Class Library errors and exceptions. The Jolt Class Library returns both Jolt and TUXEDO errors and exceptions. The Jolt Class Library errors and exceptions are also listed for each class, constructor, and method listed in Chapter 7, "Jolt Class Library Reference."

The following topics are included in this appendix:

TUXEDO errors are described briefly in this appendix. For a complete explanation of TUXEDO errors, refer to the TUXEDO System Reference Manual.


Jolt Error and Exception Handling

An error condition indicates that a nonrecoverable error has occurred. When an error occurs, a message is displayed and the current method stops executing.

Note: In general, these errors are not caught in your application. Normally, Java errors and exceptions are automatically caught by Jolt.

An exception indicates that a condition occurred that requires special handling to prevent the application from terminating. Exceptions can be caught and handled.

Each exception or error comes with an error code and a simple text message. The following table describes the relationship between the error code types and their messages.

Table A-1 Error Code Text Messages

If the error code Then the text message

Is one of the TUXEDO errors (e.g., TPENOENT)

Is the text message from ATMI tpstrerror(3).

TPEJOLT

Provides useful information about what error has occurred and its location. You can use a getErrno to get the error number and a getMessage to obtain the error message for the exception object.

The Jolt Class Library uses exceptions to report run-time problems. All Jolt exceptions extend from Java's RuntimeException and Error classes. Figure A-1 illustrates the relationship of the JoltException classes to the Java RuntimeException class.

Figure A-1 Jolt Exception Class Hierarchy

Since Java's RuntimeException and Error conditions are caught automatically by the Java virtual machine (VM), programmers can ignore these and rely on the Java VM to trap them. However, programmers must catch the exceptions or errors that are important to their particular applications so that application-specific recovery can be initiated.


ApplicationException Class

java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----bea.jolt.ApplicationException

The ApplicationException class is used by the JoltRemoteService class and its methods. The ApplicationException is thrown only when the service calls a tpreturn (TPFAIL, tpurcode, ...).

public class ApplicationException extends
java.lang.RuntimeException

ApplicationException Methods

The following methods are used with the ApplicationException class.

getMessage Method

The getMessage method gets the error message.

Synopsis

public String getMessage();

Usage

This method is taken from the Java RuntimeException class.

getApplicationCode Method

The getApplicationCode method gets the application code (tpurcode).

Synopsis

public int getApplicationCode();

getObject Method

The getObject method gets the object that throws this exception.

Synopsis

public Object getObject();

Usage

In Jolt 1.1, the object retrieved by getObject is an instance of the JoltRemoteService class. The caller can still use this object to retrieve all the output parameters. See getStringDef() or similar methods in JoltRemoteService class.


JoltException Class

java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----bea.jolt.JoltException

All Jolt exceptions are derived from the Java RuntimeException class. The Java virtual machine catches them by default, thus the programmer is not required to catch any of these exceptions.

public class JoltException extends java.lang.RuntimeException
{
public final static int TPEABORT = 1; // Tuxedo error codes
public final static int TPEBADDESC = 2;
public final static int TPEBLOCK = 3;
public final static int TPEINVAL = 4;
public final static int TPELIMIT = 5;
public final static int TPENOENT = 6;
public final static int TPEOS = 7;
public final static int TPEPERM = 8;
public final static int TPEPROTO = 9;
public final static int TPESVCERR = 10;
public final static int TPESVCFAIL = 11;
public final static int TPESYSTEM = 12;
public final static int TPETIME = 13;
public final static int TPETRAN = 14;
public final static int TPGOTSIG = 15;
public final static int TPERMERR = 16;
public final static int TPEITYPE = 17;
public final static int TPEOTYPE = 18;
public final static int TPERELEASE = 19;
public final static int TPEHAZARD = 20;
public final static int TPEHEURISTIC = 21;
public final static int TPEEVENT = 22;
public final static int TPEMATCH = 23;
public final static int TPEDIAGNOSTIC = 24;
public final static int TPEMIB = 25;
public final static int TPEJOLT = 100; // Jolt error or
/programming error

JoltException Methods

The JoltException methods are used to obtain information about the error or the condition that causes the error.

getMessage Method

The getMessage method gets the error message.

Synopsis

public String getMessage();

Usage

This method is taken from the Java RuntimeException class.

getErrno Method

The getErrno method gets the error code.

Synopsis

public int getErrno();

getObject Method

The getObject method gets the object that throws this exception.

Synopsis

public Object getObject();

Usage

In some situations, this method returns a "null" object.


EventException Class

java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----bea.jolt.JoltException
|
+----bea.jolt.EventException

This exception is thrown when the user encounters any error during the event subscription.

public class EventException extends JoltException 

MessageException Class

java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----bea.jolt.MessageException

This exception is thrown when there is an error in parsing the internal message object.

public class MessageException 
extends RuntimeException

ServiceException Class

java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----bea.jolt.JoltException
|
+----bea.jolt.ServiceException

The ServiceException class extends JoltException. The ServiceException class is used by the JoltRemoteService class and its methods.

public class ServiceException extends JoltException

SessionException Class

java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----bea.jolt.JoltException
|
+----bea.jolt.SessionException

The SessionException extends JoltException. The SessionException is used by the JoltSession class and its methods.

public class SessionException extends JoltException

TransactionException Class

java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----java.lang.RuntimeException
|
+----bea.jolt.JoltException
|
+----bea.jolt.TransactionException

The TransactionException class extends JoltException. The TransactionException class is used by the JoltTransaction class and class methods.

public class TransactionException extends JoltException

TUXEDO Errors

Expanded references to TUXEDO will be available in a future release of the Jolt product documentation. If you require an immediate, expanded reference for TUXEDO related errors, see the TUXEDO System Reference Manual.
Table A-2 TUXEDO Errors

Error Description

TPEABORT

A transaction could not commit because the work performed by the initiator, or by one or more of its participants, could not commit.

TPEBADDESC

A call descriptor is invalid or is not the descriptor with which a conversational service was invoked.

TPEBLOCK

A blocking condition exists and TPNOBLOCK was specified.

TPEDIAGNOSTIC

To be determined.

TPEEVENT

An event occurred; the event type is returned in revent.

TPEHAZARD

Due to a failure, the work done on behalf of the transaction can have been heuristically completed.

TPEHEURISTIC

Due to a heuristic decision, the work done on behalf of the transaction was partially committed and partially aborted.

TPEINVAL

An invalid argument was detected.

TPEITYPE

The type and subtype of the input buffer is not one of the types and subtypes that the service accepts.

TPELIMIT

The caller's request was not sent because the maximum number of outstanding requests or connections has been reached.

TPEMATCH

svcname is already advertised for the server but with a function other then func.

TPEMIB

To be determined.

TPENOENT

Cannot send to svc because it does not exist or is not the correct type of service.

TPEOS

An operating system error has occurred.

TPEOTYPE

The type and subtype of the reply are not known to the caller.

TPEPERM

A client cannot join an application because it does not have permission to do so or because it has not supplied the correct application password.

TPEPROTO

A library routine was called in an improper context.

TPERELEASE

To be determined.

TPERMERR

A resource manager failed to open or close correctly.

TPESVCERR

A service routine encountered an error either in tpreturn(3) or tpforward(3). For example, bad arguments were passed.

TPESVCFAIL

The service routine sending the caller's reply called.

TPESYSTEM

A System/T error occurred.

TPETIME

A time-out occurred.

TPETRAN

The caller cannot be placed in transaction mode.

TPGOTSIG

A signal was received and TPSIGRSTRT was not specified.