Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-761

SessionContext.getCallerPrincipal() throws NullPointerException in embedded container

    Details

    • Type: Patch
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate Issue
    • Affects Version/s: EJB 3.0 RC8 - FD
    • Fix Version/s: None
    • Component/s: Security
    • Labels:
      None

      Description

      The exception happens in org.jboss.security.plugins.JaasSecurityManager.getPrincipal(Principal principal) when it is synchronized on domainCache. domainCache is null because org.jboss.ejb3.embedded.JaasSecurityManagerService does not initialize it.

      There are two possible fixes:
      1 - org.jboss.security.plugins.JaasSecurityManager should check for null first like it does in most of the methods.
      2 - have org.jboss.ejb3.embedded.JaasSecurityManagerService initialize the cache with a mock cache policy. This is what I did to fix mine.

      private static JaasSecurityManager getSecurityManager(String name)

      { ... manager = new JaasSecurityManager(name, new SecurityAssociationHandler()); manager.setCachePolicy(new MockCachePolicy()); //MockCachePolicy is just a noop impl ... }

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  wolfc Carlo de Wolf
                  Reporter:
                  jgilbert John Gilbert
                • Votes:
                  5 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: