2 Replies Latest reply on Aug 20, 2007 10:50 AM by Pete Muir

    security rules problem from cvs,

    Stateless Bean Novice

      hi,
      I try to run new CVS version of seam, and I get error on security rules line.


      ERROR 16-08 23:38:38,937 [org.jboss.seam.drools.RuleBase.compileRuleBase():68] errors parsing rules in: /META-INF/security-rules.drl
      ERROR 16-08 23:38:38,937 [org.jboss.seam.drools.RuleBase.compileRuleBase():74] Rule Compilation error The method insert(Role) is undefined for the type Rule_AdminIsAUser_0 (/META-INF/security-rules.drl:8)
      2007-08-16 23:38:39 org.apache.catalina.session.StandardSession tellNew

      SEVERE: Session event listener threw exception
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.identity
      at org.jboss.seam.Component.newInstance(Component.java:1966)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:187)
      at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:124)
      at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:44)
      at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:397)
      at org.apache.catalina.session.StandardSession.setId(StandardSession.java:369)
      at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:829)
      at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:291)
      at org.apache.catalina.connector.Request.doGetSession(Request.java:2312)
      at org.apache.catalina.connector.Request.getSession(Request.java:2075)
      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
      at com.sun.faces.context.SessionMap.getSession(ExternalContextImpl.java:1002)
      at com.sun.faces.context.SessionMap.get(ExternalContextImpl.java:962)
      at org.jboss.seam.contexts.BasicContext.get(BasicContext.java:48)
      at org.jboss.seam.Component.getInstance(Component.java:1847)
      at org.jboss.seam.Component.getInstance(Component.java:1825)
      at org.jboss.seam.web.Session.getInstance(Session.java:122)
      at org.jboss.seam.contexts.FacesLifecycle.beginRequest(FacesLifecycle.java:54)
      at org.jboss.seam.jsf.SeamPhaseListener.beforeRestoreView(SeamPhaseListener.java:361)
      at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:139)
      at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:82)
      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:72)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:149)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Unknown Source)
      Caused by: org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule name=AdminIsAUser, agendaGroup=MAIN, salience=10, no-loop=true]
      SeamSpacePermissions/Rule_AdminIsAUser_0.java (9:345) : The method insert(Role) is undefined for the type Rule_AdminIsAUser_0


      at org.drools.rule.Package.checkValidity(Package.java:368)
      at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:250)
      at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:87)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2078)
      at org.jboss.seam.Component.callCreateMethod(Component.java:2001)
      at org.jboss.seam.Component.newInstance(Component.java:1972)
      at org.jboss.seam.Component.getInstance(Component.java:1869)
      at org.jboss.seam.Component.getInstance(Component.java:1836)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
      at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
      at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
      at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
      at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
      at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
      at org.jboss.seam.Component$ELInitialValue.getValue(Component.java:2356)
      at org.jboss.seam.Component.initialize(Component.java:1388)
      at org.jboss.seam.Component.instantiateJavaBean(Component.java:1314)
      at org.jboss.seam.Component.instantiate(Component.java:1267)
      at org.jboss.seam.Component.newInstance(Component.java:1962)
      ... 50 more


      Here is my rule

      package SeamSpacePermissions;

      import java.security.Principal;

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

      rule AdminIsAUser
      salience 10
      no-loop
      when
      Role(name == "admin")
      not Role(name == "user")
      then
      insert(new Role("user"));
      end


      <?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:security="http://jboss.com/products/seam/security"
       xmlns:drools="http://jboss.com/products/seam/drools"
       xmlns:web="http://jboss.com/products/seam/web"
       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/components http://jboss.com/products/seam/components-2.0.xsd
       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd
       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd">
      
       <core:init jndi-pattern="@jndiPattern@" debug="false"/>
      
       <core:manager conversation-timeout="120000"
       concurrent-request-timeout="500"
       conversation-id-parameter="cid"/>
      
       <security:identity authenticate-method="#{authenticator.authenticate}"
       security-rules="#{securityRules}"/>
      
       <drools:rule-base name="securityRules">
       <drools:rule-files>
       <value>/META-INF/security-rules.drl</value>
       </drools:rule-files>
       </drools:rule-base>
      
       <web:multipart-filter create-temp-files="true"
       max-request-size="1000000"
       url-pattern="*.seam"/>
      
       <web:context-filter url-pattern="/content/*"/>
      
       <persistence:managed-persistence-context name="em" auto-create="true"
       persistence-unit-jndi-name="java:/sguEntityManagerFactory"/>
      
       <event type="org.jboss.seam.notLoggedIn">
       <action expression="#{redirect.captureCurrentView}"/>
       </event>
      
       <event type="org.jboss.seam.postAuthenticate">
       <action expression="#{redirect.returnToCapturedView}"/>
       </event>
      
       <factory name="remoteAddr" value="#{facesContext.externalContext.request.remoteAddr}" />
      </components>