9 Replies Latest reply on Jul 20, 2007 9:48 AM by przemyslawo

    Error using RuleBasedIdentity in Seam 2.0 beta 1

    tuxzilla

      After migrating my app from seam 1.2.1GA to 2.0 beta 1, I am having problem accessing my login page. The exception is


      Caused by: java.lang.IllegalArgumentException: Could not invoke method by reflection: RuleBasedIdentity.setSecurityRules(org.drools.RuleBase) with parameters: (org.jboss.seam.drools.RuleBase) on: org.jboss.seam.security.RuleBasedIdentity
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:31)
      at org.jboss.seam.Component.setPropertyValue(Component.java:1656)
      ... 73 more
      Caused by: java.lang.IllegalArgumentException: argument type mismatch
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)


      I double checked components.xml, it seemed consistent with the drools example:

      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
      xmlns:core="http://jboss.com/products/seam/core"
      xmlns:persistence="http://jboss.com/products/seam/persistence"
      xmlns:drools="http://jboss.com/products/seam/drools"
      xmlns:security="http://jboss.com/products/seam/security"
      xmlns:mail="http://jboss.com/products/seam/mail"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation=
      "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
      http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
      http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
      http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
      http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
      http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">


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

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

      The view is a standard login form:
       <h:form id="login">
      
       <fieldset style="width:300px">
       <legend>Login</legend>
      
       <div class="dialog" align="left">
       <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
       <h:outputLabel for="username">Email</h:outputLabel>
       <h:inputText id="username"
       value="#{identity.username}"/>
       <h:outputLabel for="password">Password</h:outputLabel>
       <h:inputSecret id="password"
       value="#{identity.password}"/>
       <h:outputLabel for="rememberMe">Remember me</h:outputLabel>
       <h:selectBooleanCheckbox id="rememberMe"
       value="#{identity.rememberMe}"/>
       </h:panelGrid>
       </div>
      
       </fieldset>
      
       <div class="actionButtons">
       <h:commandButton value="Login" action="#{identity.login}"/>
       </div>
      
       </h:form>