com.ibm.ws.exception

Class WsEJBException

  • java.lang.Object
    • java.lang.Throwable
      • java.lang.Exception
        • java.lang.RuntimeException
          • javax.ejb.EJBException
            • com.ibm.ws.exception.WsEJBException
  • All Implemented Interfaces:
    WsNestedException, java.io.Serializable


    public class WsEJBException
    extends javax.ejb.EJBException
    implements WsNestedException
    This subclass is intended to be used by the a container (ejb, web, or client) when it needs to throw an exception from a method that implements a SUN architected J2EE interface and the interface does not permit an appropriate checked exception to be thrown (e.g. ContainerInternalError exception). Since WsEJBException is a RuntimeException, it can be thrown by any method. However, please only use this class when interface does not allow a more appropriate checked exception to be thrown.

    The WsEJBException class is a subclass of javax.ejb.EJBException that provides support for exception chaining semantics that will be available in the JDK 1.4 timeframe. Exceptions that desire to inherit these semantics while running on pre 1.4 JDKs should extend this class.

    It should be noted that this class will provide only the exception chaining semantics available in 1.4. This is a subset of all the new functionality. introduced in 1.4. Most of that functionality requires support from the JVM that is not available on earlier editions.

    Exceptions that subclass this exception only need to add the various constructors and inherit everything else from this class.

    See the javadoc for the JDK 1.4 java.lang.Throwable for a full description of the exception chaining functionality.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      WsEJBException()
      Construct a new WsEJBException with a no detail message.
      WsEJBException(java.lang.String message)
      Construct a new WsEJBException with the specified detail message.
      WsEJBException(java.lang.String message, java.lang.Throwable cause)
      Construct a new WsEJBException with a null detail message and a cause field set to the specified Throwable.
      WsEJBException(java.lang.Throwable cause)
      Construct a new WsEJBException with a null detail message and a cause field set to the specified Throwable.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.Throwable getCause()
      Return the Throwable that is considered the root cause of this WsException.
      java.lang.Exception getCausedByException()
      Obtain the exception that caused the WsEJBException being thrown.
      java.lang.String getMessage() 
      java.lang.Throwable initCause(java.lang.Throwable cause)
      Initialize the cause field for this WsException to the specified value.
      • Methods inherited from class javax.ejb.EJBException

        printStackTrace, printStackTrace, printStackTrace
      • Methods inherited from class java.lang.Throwable

        fillInStackTrace, getLocalizedMessage, getStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WsEJBException

        public WsEJBException()
        Construct a new WsEJBException with a no detail message.
      • WsEJBException

        public WsEJBException(java.lang.String message)
        Construct a new WsEJBException with the specified detail message.
        Parameters:
        message - a detail message. Null is tolerated.
      • WsEJBException

        public WsEJBException(java.lang.Throwable cause)
        Construct a new WsEJBException with a null detail message and a cause field set to the specified Throwable. Subsequent calls to the initCause(java.lang.Throwable) method on this instance will result in an exception. The value of the cause field may be retrieved at any time via the getCause() method.

        Parameters:
        cause - the Throwable that was caught and is considered the root cause of this exception. Null is tolerated.
      • WsEJBException

        public WsEJBException(java.lang.String message,
                      java.lang.Throwable cause)
        Construct a new WsEJBException with a null detail message and a cause field set to the specified Throwable. Subsequent calls to the initCause(java.lang.Throwable) method on this instance will result in an exception. The value of the cause field may be retrieved at any time via the getCause() method.

        Parameters:
        message - the detail message. Null is tolerated.
        cause - the Throwable that was caught and is considered the root cause of this exception. Null is tolerated.
    • Method Detail

      • getCausedByException

        public java.lang.Exception getCausedByException()
        Obtain the exception that caused the WsEJBException being thrown. If a Throwable was used in the constructor, then the Throwable gets wrapped in a WsException. This requires an additional getCause() call on the WsException to get the real Throwable.
        Overrides:
        getCausedByException in class javax.ejb.EJBException
      • getCause

        public java.lang.Throwable getCause()
        Return the Throwable that is considered the root cause of this WsException. Null is returned if the root cause is nonexistent or unknown. The root cause is the throwable that caused this WsException to get thrown.

        The Throwable that is returned is either the Throwable supplied via one of the appropriate constructors, or that set via the initCause(Throwable) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means, such as a legacy exception chaining infrastructure.

        Specified by:
        getCause in interface WsNestedException
        Overrides:
        getCause in class java.lang.Throwable
        Returns:
        the Throwable that is the cause of this WsException, or null if the cause is nonexistent or unknown.
      • initCause

        public java.lang.Throwable initCause(java.lang.Throwable cause)
                                      throws java.lang.IllegalStateException,
                                             java.lang.IllegalArgumentException
        Initialize the cause field for this WsException to the specified value. The cause is the Throwable that caused this WsException to get thrown.

        This method can be called at most once. It is generally called from within a constructor that takes a Throwable, or immediately after constructing this object with a constructor that does not accept a \ Throwable. Thus, if a constructor that takes Throwable as a parameter is used to construct this object, it cannot be called at all.

        Specified by:
        initCause in interface WsNestedException
        Overrides:
        initCause in class java.lang.Throwable
        Parameters:
        cause - the Throwable which caused this WsException to be thrown. Null is tolerated.
        Returns:
        a reference to this Throwable instance.
        Throws:
        java.lang.IllegalArgumentException - if the specified cause is this WsException. An exception cannot be its own cause.
        java.lang.IllegalStateException - if this WsException was created with a constructor that specified a cause, or this method has already been called on this object.
      • getMessage

        public java.lang.String getMessage()
        Overrides:
        getMessage in class javax.ejb.EJBException
IBM WebSphere Application ServerTM
Release 8.5