7 Replies Latest reply on Nov 27, 2007 5:57 PM by Shane Bryzak

    Seam rule file problem

    Stateless Bean Novice

      Hi,
      I try to run my app on tomcat 6 and my rule file (which works on jboss 4.0.5) don't work on tomcat?
      I get parsing error>?

      ERROR 21-10 23:06:36,906 [org.jboss.seam.drools.RuleBase.compileRuleBase():68] errors parsing rules in: /META-INF/security-rules.drl
      ERROR 21-10 23:06:36,921 [org.jboss.seam.drools.RuleBase.compileRuleBase():74] Rule Compilation error Type mismatch: cannot convert from Role to boolean (/META-INF/security-rules.drl:8)
      2007-10-21 23:06:37 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:1975)
       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:1856)
       at org.jboss.seam.Component.getInstance(Component.java:1834)
       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:83)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       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]
       Security/Rule_AdminIsAUser_0.java (9:338) : Type mismatch: cannot convert from Role to boolean
      
       at org.drools.rule.Package.checkValidity(Package.java:419)
       at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:292)
       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:125)
       at org.jboss.seam.Component.callComponentMethod(Component.java:2087)
       at org.jboss.seam.Component.callCreateMethod(Component.java:2010)
       at org.jboss.seam.Component.newInstance(Component.java:1981)
       at org.jboss.seam.Component.getInstance(Component.java:1878)
       at org.jboss.seam.Component.getInstance(Component.java:1845)
       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:2365)
       at org.jboss.seam.Component.initialize(Component.java:1394)
       at org.jboss.seam.Component.instantiateJavaBean(Component.java:1320)
       at org.jboss.seam.Component.instantiate(Component.java:1273)
       at org.jboss.seam.Component.newInstance(Component.java:1971)
       ... 50 more


      Here is my rule file

      package Security;

      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
      assert(new Role("user"));
      end;


      Can anyone tell me what's wrong?