2 Replies Latest reply on Dec 1, 2009 4:19 AM by jaikiran

    Unreasonable Problems with deployed EJBs

    crazy_bytes

      HI,

      I am not sure if this is the right forum for this topic, if not may an admin be so kind and move it to the right spot.

      Recently I have unexpected problems with my JBoss. I am currently running 2 JBoss AS 4.2.3 GA in a clustered environment. There are about 200 EJBs deployed. About 80 - 90% are still EJB 2.0 the remaining beans are EJB 3.0. All beans are Stateless.

      Both JBosses are starting up fine with no errors. But when I try to start one of my applications and a bean gets instanced I sometimes encounter the following exception:

      ===============================================

      09:24:01,137 ERROR [AllowedOperationsAssociation] getCallerPrincipal should not be access from this bean method: IN_EJB_CREATE, allowed is [IN_EJB_TIMEOUT, IN_BUSINESS_METHOD, IN_SERVICE_ENDPOINT_METHOD]
      java.lang.IllegalStateException: getCallerPrincipal should not be access from this bean method: IN_EJB_CREATE
      at org.jboss.ejb.AllowedOperationsAssociation.assertAllowedIn(AllowedOperationsAssociation.java:158)
      at org.jboss.ejb.StatelessSessionEnterpriseContext$SessionContextImpl.getCallerPrincipal(StatelessSessionEnterpriseContext.java:221)
      at com.acme.business.article.sessionBean.ArticleManagementEJB.sendError(ArticleManagementEJB.java:4044)
      at com.acme.business.article.sessionBean.ArticleManagementEJB.ejbCreate(ArticleManagementEJB.java:257)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.ejb.StatelessSessionEnterpriseContext.(StatelessSessionEnterpriseContext.java:78)
      at org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:49)
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:184)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:95)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
      at org.jboss.ejb.plugins.CleanShutdownInterceptor.invokeHome(CleanShutdownInterceptor.java:212)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
      at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:637)
      at org.jboss.ejb.Container.invoke(Container.java:981)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      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:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.invocation.unified.server.UnifiedInvokerHA.invoke(UnifiedInvokerHA.java:148)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:809)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:608)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:420)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173)

      ===============================================

      What confuses me even more is that after I restarted the servers a few times without changing anything, the problem just disappears. One restart later the problem returns.

      And it isn't always the same EJB (in the exception above it is the Stateless session bean ArticleManagement), the problem occurs radomly in the existing beans, no matter if it is a session bean or an entity bean.

      The beans have bean running for about 3 to 4 years without changes or having any problems.

      Has anybody an idea for the cause of this?

      Thanks and Regards,
      CB

        • 1. Re: Unreasonable Problems with deployed EJBs
          crazy_bytes

          If you need more information, just let me know.

          /PUSH :)

          • 2. Re: Unreasonable Problems with deployed EJBs
            jaikiran

            You seem to be having a couple of issues:

            1)

            09:24:01,137 ERROR [AllowedOperationsAssociation] getCallerPrincipal should not be access from this bean method: IN_EJB_CREATE, allowed is [IN_EJB_TIMEOUT, IN_BUSINESS_METHOD, IN_SERVICE_ENDPOINT_METHOD]
            java.lang.IllegalStateException: getCallerPrincipal should not be access from this bean method: IN_EJB_CREATE
            at org.jboss.ejb.AllowedOperationsAssociation.assertAllowedIn(AllowedOperationsAssociation.java:158)
            at org.jboss.ejb.StatelessSessionEnterpriseContext$SessionContextImpl.getCallerPrincipal(StatelessSessionEnterpriseContext.java:221)
            at com.acme.business.article.sessionBean.ArticleManagementEJB.sendError(ArticleManagementEJB.java:4044)
            at com.acme.business.article.sessionBean.ArticleManagementEJB.ejbCreate(ArticleManagementEJB.java:257)

            As the message states, you are not allowed to call getCallerPrincipal from the ejbCreate method.

            2)

            What confuses me even more is that after I restarted the servers a few times without changing anything, the problem just disappears. One restart later the problem returns.

            And it isn't always the same EJB (in the exception above it is the Stateless session bean ArticleManagement), the problem occurs radomly in the existing beans, no matter if it is a session bean or an entity bean.


            Looking at your stacktrace:
            org.jboss.ejb.StatelessSessionEnterpriseContext$SessionContextImpl.getCallerPrincipal(StatelessSessionEnterpriseContext.java:221)
            at com.acme.business.article.sessionBean.ArticleManagementEJB.sendError(ArticleManagementEJB.java:4044)
            at com.acme.business.article.sessionBean.ArticleManagementEJB.ejbCreate(ArticleManagementEJB.java:257)

            the getCallerPrincipal probably gets called *only* when there is some other error and the ArticleManagementEjb decides to send/report that error. While doing so, it tries to get the caller principal - an operation which is not allowed. So effectively the original error is lost and you see this exception instead.