3 Replies Latest reply on Oct 27, 2009 8:06 AM by Amalraj Palanichamy

    Losing Credentials After Call to Method

    Paul Carroll Newbie

      I am using JBoss 5.1.0.
      1. I call a method that requires a role which the calling user is a member of. This call succeeds.
      2. The next call is to a class that creates a JMS message and publishes the message. This call succeeds.
      3. The next call is to the same method as in #1. However this time I receive an exception as in the following:

      Caused by: javax.ejb.EJBAccessException: Caller unauthorized
       at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:199)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:176)
       at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:216)
       at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
       at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
       at $Proxy361.setDocumentStatus(Unknown Source)


      I have narrowed it down to where I call:

      TopicConnetion connection = myTopicFactory.createTopicConnection();


      It appears that after that call, I lose the user credentials for the next method call. The class that produces the JMS factory, connection and session is a utility class and is not part of a persistent unit. Does that have anything to do with it? Thanks.