Package javassist.tools.reflect

# Class CannotInvokeException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
javassist.tools.reflect.CannotInvokeException

All Implemented Interfaces:
  `Serializable`

public class CannotInvokeException extends RuntimeException
Thrown when method invocation using the reflection API has thrown an exception.

See Also:
  - `Metaobject.trapMethodcall(int, Object[])`
  - `ClassMetaobject.trapMethodcall(int, Object[])`
  - `ClassMetaobject.invoke(Object, int, Object[])`
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`CannotInvokeException(ClassNotFoundException e)`
Constructs a CannotInvokeException with an ClassNotFoundException.
`CannotInvokeException(IllegalAccessException e)`
Constructs a CannotInvokeException with an IllegalAccessException.
`CannotInvokeException(InvocationTargetException e)`
Constructs a CannotInvokeException with an InvocationTargetException.
`CannotInvokeException(String reason)`
Constructs a CannotInvokeException with an error message.

## Method Summary

Modifier and Type
Method
Description
`Throwable`
`getReason()`
Returns the cause of this exception.

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

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

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

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

## Constructor Details

### CannotInvokeException

public CannotInvokeException(String reason)
Constructs a CannotInvokeException with an error message.

### CannotInvokeException

public CannotInvokeException(InvocationTargetException e)
Constructs a CannotInvokeException with an InvocationTargetException.

### CannotInvokeException

public CannotInvokeException(IllegalAccessException e)
Constructs a CannotInvokeException with an IllegalAccessException.

### CannotInvokeException

public CannotInvokeException(ClassNotFoundException e)
Constructs a CannotInvokeException with an ClassNotFoundException.

## Method Details

### getReason

public Throwable getReason()
Returns the cause of this exception. It may return null.