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
WsEJBExceptionclass is a subclass ofjavax.ejb.EJBExceptionthat 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.ThrowablegetCause()Return the Throwable that is considered the root cause of this WsException.java.lang.ExceptiongetCausedByException()Obtain the exception that caused the WsEJBException being thrown.java.lang.StringgetMessage()java.lang.ThrowableinitCause(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
-
-
-
-
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 theinitCause(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 thegetCause()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 theinitCause(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 thegetCause()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:
getCausedByExceptionin classjavax.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:
getCausein interfaceWsNestedException- Overrides:
getCausein classjava.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.IllegalArgumentExceptionInitialize 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:
initCausein interfaceWsNestedException- Overrides:
initCausein classjava.lang.Throwable- Parameters:
cause- the Throwable which caused this WsException to be thrown. Null is tolerated.- Returns:
- a reference to this
Throwableinstance. - 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:
getMessagein classjavax.ejb.EJBException
-
-