title: Custom RuntimeException not caught
body: <p>I have my own ApplicationException witch extends RuntimeException:</p>
  
  <pre><code>package com.haslerrail.aura.common.exception;
  
  public class ApplicationException extends RuntimeException {
  
      private static final long serialVersionUID = 1L;
  
      private final ErrorCode errorCode;
  
      private final Object[] arguments;
  
      public ApplicationException(final ErrorCode errorCode, final Object... arguments) {
          super();
          this.errorCode = errorCode;
          this.arguments = arguments;
      }
  
      public ErrorCode getErrorCode() {
          return errorCode;
      }
  
      public Object[] getArguments() {
          return arguments;
      }
  
  }
  </code></pre>
  
  <p>This exception will be thrown be a function of my stateless bean:</p>
  
  <pre><code>public void doSomething()
          throws IOException, ApplicationException, InternalException {
      if (true) {
          throw new ApplicationException(ErrorCode.FILE_TYPE_NOT_SUPPORTED, "test");
      }
  }
  </code></pre>
  
  <p>I would like to catch this runtimeException by my sessionScoped bean like this:</p>
  
  <pre><code>public void doXXX(final FileUploadEvent event) throws SystemException {
      try {
  
          myStatelessbean.doSomething();  // Throw my ApplicationExcetion
  
      } catch (final ApplicationException e) {
          System.out.println("catch ApplicationException");
      } catch (final Exception e) {
          System.out.println("catch Exception");
      }
  
  }
  </code></pre>
  
  <p>My problem is, the exception is caught by the Exception and never by my own  ApplicationException! I have no idea what i'm doing wrong....</p>
  
  <p>e.printStackTrace() gives the exception text:</p>
  
  <pre><code>javax.ejb.EJBException: com.haslerrail.aura.common.exception.ApplicationException
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166)
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230)
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:76)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
      at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
      at XXXX.myStatelessbean.$$$view353.doSomething(Unknown Source)  
  </code></pre>