4 Replies Latest reply on Sep 21, 2010 11:19 AM by Robert Morse

    Security.drl not read

    Ranganathan Kaliyur Mannar Newbie

      Hi,
      I am using Seam 2.2.0 GA. My security.drl file is simply not read at all. To test this, I literally typed :
      blah blah


      in the .drl file. There are no errors during deployment. However, when I try to create an user through identityManager.createUser, I get an AuthorizationException.


      components.xml - I included the security lines from the seam tutorial.


      I have searched google and the forums for the past several days - some people do mention there are some changes in 2.2.0, but am unable to find out what change to make.



      Ranga.

        • 1. Re: Security.drl not read
          Leo van den berg Master

          Hi,


          Check the relative path of the file and see if the DRL is inside a sub directory and change the components.xml definition if needed. The other thing is that it depends of the location of the file, if you have a WAR-deployment, I've found that the application cannot find resources in the classes dir of WEB-INF. I'am using EAR deployment, so I have solved by placing the file in another location, but for WAR there must be another solution.


          Maybe somebody on this forum can help on the classpath problem with WAR (and for the comparable problem with jBPM for that matter)


          Leo


          • 2. Re: Security.drl not read
            Robert Morse Apprentice

            Not sure if you have a WAR or EAR deployment, but for an EAR deployment the following works for me:




                 <drools:rule-base name="securityRules">
                      <drools:rule-files>
                           <value>/META-INF/security.drl</value>
                 </drools:rule-files>
                 </drools:rule-base>
                 <security:rule-based-permission-resolver
                      security-rules="#{securityRules}" />
            



            and I have the security.drl file located in the META-INF directory of my EJB (same place as persistence.xml).

            • 3. Re: Security.drl not read
              Ranganathan Kaliyur Mannar Newbie

              Hi,
              I am having an ear deployment.
              I tried having the drl both inside META-INF and also outside - both do not work...


              Also I tried having:


              <security:rule-base name="securityRules" rule-files="/META-INF/security.drl"/>



              instead of <drools:rule-base> tag - that also doesn't work...


              What I can't understand is - there is absolutely nothing in the log that says the rules file was read - even if I type junk in the file it is ignored...
              I am wondering if I am missing something...

              • 4. Re: Security.drl not read
                Robert Morse Apprentice

                Using the configuration I provided earlier, and JBoss 5.1.0.GA, I see the following in the logs when I start up:




                18:37:44,174 INFO  [STDOUT] 18:37:44,174 DEBUG [org.jboss.seam.contexts.Lifecycle] Session started
                18:37:44,320 INFO  [STDOUT] 18:37:44,320 DEBUG [org.jboss.seam.drools.RuleBase] parsing rules: /META-INF/security.drl
                18:37:44,321 INFO  [STDOUT] 18:37:44,321 DEBUG [org.jboss.seam.util.Resources] Loaded resource from context classloader: META-INF/security.drl
                



                I would compare your configuration.xml file to that described in the Seam Reference PDF (section 15.6.9.2 in my copy).
                Can't think of any reason why it shouldn't work if you're following this example.