4 Replies Latest reply on Oct 31, 2007 8:03 AM by Pete Muir

    no such setter method: org.jboss.seam.security.Identity.secu

    John Smith Newbie

      Hello,

      I hope someone can help me on this issue. I am using JBoss AS 4.2.1, Seam 1.2.1GA. I wish to use jboss rules security as defined in components.xml:

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

      <security:identity authenticate-method="#{authenticator.authenticate}"
      security-rules="#{securityRules}"/>


      If I package the security jars

      drools-compiler-3.0.5.jar
      drools-core-3.0.5.jar
      commons-jci-core-1.0-406301.jar
      commons-jci-janino-2.4.3.jar
      commons-lang-2.1.jar
      janino-2.4.3.jar
      stringtemplate-2.3b6.jar
      antlr-2.7.6.jar
      antlr-3.0ea8.jar

      in the ear application I get the following exception on startup:


      java.lang.RuntimeException: Could not create Component: org.jboss.seam.security.identity
      at org.jboss.seam.init.Initialization.addComponent(Initialization.java:865)
      at org.jboss.seam.init.Initialization.installComponents(Initialization.java:796)
      at org.jboss.seam.init.Initialization.init(Initialization.java:503)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
      at org.apache.catalina.core.StandardContext.listenerStart
      ..
      ..

      Caused by: java.lang.IllegalArgumentException: no such setter method: org.jboss.seam.security.Identity.securityRules
      at org.jboss.seam.util.Reflections.getSetterMethod(Reflections.java:219)
      at org.jboss.seam.Component.initInitializers(Component.java:401)
      at org.jboss.seam.Component.(Component.java:263)
      at org.jboss.seam.Component.(Component.java:203)
      at org.jboss.seam.init.Initialization.addComponent(Initialization.java:851)


      If I move the jar files into Jboss4.2.1/server/default/lib, the application startups with no problems. But then throws the following runtime exception :

      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.identity
      at org.jboss.seam.Component.newInstance(Component.java:1740)
      at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
      at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:235)
      at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:41)
      at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:397)
      ..
      ..
      Caused by: org.drools.rule.InvalidRulePackage: Unable to create Field Extractor for 'name'
      Unable to create Field Extractor for 'action'
      Unable to create Field Extractor for 'name'
      Rule Compilation error File Permissions/Rule_CanUserViewAllUsers_0.java, Line 10, Column 16: Expression "c.grant()" is not a type

      at org.drools.rule.Package.checkValidity(Unknown Source)
      at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
      at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:70)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(
      ... 52 more
      ..
      ..


      In regards of the second exception, here is my security.drl

      package Permissions;

      import java.security.Principal;

      import org.jboss.seam.security.PermissionCheck;
      import org.jboss.seam.security.Role;

      rule CanUserViewAllUsers
      when
      c: PermissionCheck(name == "userManager", action == "getAllUsers")
      Role(name == "admin")
      then
      c.grant()
      end;

      Any help would be much apprecitated!

        • 1. Re: no such setter method: org.jboss.seam.security.Identity.
          John Smith Newbie

          Problem solved, the application.xml didn't include the security jar modules. I didn't realise they weren't automatically configured in maven. A case of teething problems while switching from ant to maven!

          • 2. Re: no such setter method: org.jboss.seam.security.Identity.
            Mick Knutson Newbie

            Can you please post the code that added the required entries through Maven?

            • 3. Re: no such setter method: org.jboss.seam.security.Identity.
              John Smith Newbie

              Sure can, by the way, using local repository in cases such as com.ricall.*;

              <build>
               <plugins>
               <plugin>
               <artifactId>maven-ear-plugin</artifactId>
               <configuration>
               <displayName>Ricall</displayName>
               <modules>
               <webModule>
               <groupId>com.ricall</groupId>
               <artifactId>site-webapplication</artifactId>
               <bundleFileName>ricall.war</bundleFileName>
               <contextRoot>/</contextRoot>
               </webModule>
               <jarModule>
               <groupId>com.ricall</groupId>
               <artifactId>site-component</artifactId>
               <bundleFileName>ricall.jar</bundleFileName>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall</groupId>
               <artifactId>template-component</artifactId>
               <bundleFileName>ricall-template.jar</bundleFileName>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.seam</groupId>
               <artifactId>jboss-seam</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.drools-core</groupId>
               <artifactId>drools-core</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>
               com.ricall.drools-compiler
               </groupId>
               <artifactId>drools-compiler</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.commons</groupId>
               <artifactId>commons-jci-core</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.commons</groupId>
               <artifactId>commons-jci-janino</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <!--jarModule>
               <groupId>commons-lang</groupId>
               <artifactId>commons-lang</artifactId>
               <includeInApplicationXml>true</includeInApplicationXml>
               </jarModule-->
               <jarModule>
               <groupId>com.ricall.janino</groupId>
               <artifactId>janino</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.jBPM</groupId>
               <artifactId>jBPM</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.stringtemplate</groupId>
               <artifactId>stringtemplate</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.antlr</groupId>
               <artifactId>antlr</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>antlr</groupId>
               <artifactId>antlr</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.richfaces</groupId>
               <artifactId>richfaces-api</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.richfaces</groupId>
               <artifactId>richfaces-impl</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               <jarModule>
               <groupId>com.ricall.richfaces</groupId>
               <artifactId>richfaces-ui</artifactId>
               <includeInApplicationXml>
               true
               </includeInApplicationXml>
               </jarModule>
               </modules>
               <container>
               <containerId>jboss4x</containerId>
               <home>c:/Java/jboss-4.2.1.GA</home>
               </container>
               </configuration>
               </plugin>
               </plugins>
               </build>


              • 4. Re: no such setter method: org.jboss.seam.security.Identity.
                Pete Muir Master

                You should bundle all your ear libs in the lib directory in the ear, not reference them from application.xml (no, I don't know how to make Maven do this).