2 Replies Latest reply on Jun 30, 2004 12:33 AM by cbrettin

    How does the cache policy get instatiated?

    kenny1234

      I have written a custom login module that works fine except for the fact that a NullPointerException is raised because of a null CachePolicy:

      ---
      DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] Added jmx-console, org.jboss.security.plugins.JaasSecurityDomain@a00185 to map
      WARN [org.jboss.security.plugins.JaasSecurityManagerService] Failed to locate auth CachePolicy at: java:/timedCacheFactory for securityDomain=jmx-console
      DEBUG [org.jboss.security.plugins.JaasSecurityDomain.jmx-console] CachePolicy set to: null
      DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] setCachePolicy, c=null
      ---

      because of this, I get a nullPointerException during authentication, when the getPrincipal method is invoked on the JaasSecurityManager.

      I have hacked the JaasSecurityManager to initialize the CachePolicy when it is null, but I figure there is a much better way to handle this.
      ---

      My security domain is configured as follows:






      {path to keystore}
      {keystore password}


      ---

      Is there something I am missing that is needed to configure the CachePolicy?

      -Kenneth Shin

        • 1. Re: How does the cache policy get instatiated?
          cbrettin

          I hope that the constructor argument (the policy name) )for the JAASSecurityDomain went missing, or that might be part of the problem.

          A timed cache policy is the default (it can be overridden in the Security management config)
          Does java:/timedCacheFactory exist on your system?
          (I cant find out where is is defined, but it's definitely present in all the JBoss installations I have used)
          http://myhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss%3Aservice%3DJNDIView

          • 2. Re: How does the cache policy get instatiated?
            cbrettin

            In case anyone was dying of curiosity, I happened to come across the definition of java:timedCacheFactory.
            It's in JaasSecurityManagerService- the factory is created (and JNDI-bound) when the MBean is started, so if you didn't have the factory then this service hadn't started properly (check conf/jboss-service.xml and mbean jboss.security:service=JaasSecurityManager).
            It would be quite unusual to run JBoss without the security manager service.

            The name and class for this default seem to be hard coded.