title: Java application throws so many times same Exception
body: <p>We use in our application these technology. Java, JBoss, JMS, EJB .</p>
  
  <pre><code>Package com/net/config/server/security/AccessController.java
  
  public void checkGlobalPermissions throws NotAuthorizedException {
  
  throw new NotAuthorizedException();
  }
  
  Package com/net/config/server/services/ejb/jboss/ServiceSecurityProxy.java
  
  void checkCreatePermission(){
  AccessController ac = AccessController.getInstance();
  ac.checkGlobalPermissions();
  }
  
  Package com/net/config/server/services/ejb/ServiceBean.java
  try {
          securityProxy.checkCreatePermission(type, folderId);
      } catch (Exception ex) {
          Log.error(this, "Exception in check readonly permission for     type:"+type, ex);
          return true;
      }
      return false;
  </code></pre>
  
  <p>When we run our application on jboss server, we are getting infinite exceptions thrown from this piece of code. Here is the exception stack trace.</p>
  
  <pre><code>2012-09-20 11:55:17,792 ERROR [com.powerup.configmgr.server.services.ejb.ServiceBean]        (http-0.0.0.0-8881-4)     
  Exception in check readonly permission for type:Folder
  com.net.config.server.security.NotAuthorizedException: securityException.authenFailed
         at       com.net.config.server.security.AccessController.checkGlobalResourcePermissions(AccessController.java:168)
         at com.net.config.server.services.ejb.jboss.ServiceSecurityProxy.checkCreatePermission(ServiceSecurityProxy.java:219)
      at com.net.config.server.services.ejb.ServiceBean.checkReadOnlyPermission(ServiceBean.java:92)
      at com.net.config.server.services.ejb.ServiceBean.getItemDetails(ServiceBean.java:491)
      at com.net.config.server.services.ejb.ServiceBean.getAllItemDetails(ServiceBean.java:395)
  at sun.reflect.GeneratedMethodAccessor2272.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
      at org.jboss.ejb.plugins.SecurityProxyInterceptor.invoke(SecurityProxyInterceptor.java:175)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130)
      at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.plugins.AbstractInterceptor.invoke(AbstractInterceptor.java:96)
      at com.powerup.service.jboss.plugins.RetryInterceptor.invoke(RetryInterceptor.java:81)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
      at org.jboss.ejb.Container.invoke(Container.java:873)
  at sun.reflect.GeneratedMethodAccessor319.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.invocation.http.servlet.InvokerServlet.processRequest(InvokerServlet.java:147)
      at org.jboss.invocation.http.servlet.InvokerServlet.doPost(InvokerServlet.java:209)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:619)
  </code></pre>
  
  <p>This exception throws 2000 times in 6 hours. I could not identify what could be the cause for this. But noticed that <code>ServiceSecurity class</code> doesnot handle this <code>NotAuthorized Exception</code>. It is in prodcution box so could not reproduce the issue in house.
  This leads to more number of <code>JMS</code> spyobject exceptions and at last getting <code>Out of memory</code> error.
   so Can anyone help on this?</p>