1 Reply Latest reply on Jan 19, 2010 8:20 PM by Jonne Deprez

    security.drl fails to compile with strange errors

    Jonne Deprez Newbie

      Even a simple security.drl file fails to compile and generates errors that I don't understand...
      I'm using Seam 2.2.0.GA with the drools libraries provided by seam. Any hints are highly appreciated!


      package eu.eee.havenantwerpen.SurePermissions;
      
      dialect 'mvel'
      
      import java.security.Principal;
      
      import org.jboss.seam.security.permission.PermissionCheck;
      import org.jboss.seam.security.Role;
      
      rule CreateAccount
        no-loop
        activation-group "permissions"
      when
        Role(name == "admin")
        $c: PermissionCheck(target == "surveyHome", action == "read", granted == false)
      then
        $c.grant();
      end;





      Stacktrace:


      19:42:13,768 ERROR [STDERR] [Error: Failed to compile: 1 compilation error(s): 
       - (1,1) unqualified type in strict mode for: e]
      [Near : {... Unknown ....}]
                   ^
      [Line: 1, Column: 0]
      19:42:13,769 ERROR [STDERR]      at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:72)
      19:42:13,769 ERROR [STDERR]      at org.drools.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:365)
      19:42:13,769 ERROR [STDERR]      at org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:288)
      19:42:13,769 ERROR [STDERR]      at org.drools.base.mvel.MVELConsequence.compile(MVELConsequence.java:49)
      19:42:13,769 ERROR [STDERR]      at org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilder.build(MVELConsequenceBuilder.java:107)
      19:42:13,769 ERROR [STDERR]      at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:86)
      19:42:13,769 ERROR [STDERR]      at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1159)
      19:42:13,769 ERROR [STDERR]      at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:649)
      19:42:13,769 ERROR [STDERR]      at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:278)
      19:42:13,769 ERROR [STDERR]      at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:81)
      19:42:13,769 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      19:42:13,769 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      19:42:13,769 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      19:42:13,769 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
      19:42:13,769 ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.newInstance(Component.java:2132)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.getInstance(Component.java:2021)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.getInstance(Component.java:1983)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.getInstance(Component.java:1977)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
      19:42:13,770 ERROR [STDERR]      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
      19:42:13,770 ERROR [STDERR]      at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
      19:42:13,770 ERROR [STDERR]      at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component$ELInitialValue.getValue(Component.java:2531)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.initialize(Component.java:1527)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.postConstructJavaBean(Component.java:1453)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.postConstruct(Component.java:1376)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.Component.newInstance(Component.java:2129)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:233)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:155)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:46)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:397)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.session.StandardSession.setId(StandardSession.java:369)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:829)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:291)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.connector.Request.doGetSession(Request.java:2367)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.connector.Request.getSession(Request.java:2094)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
      19:42:13,770 ERROR [STDERR]      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:844)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.web.IdentityRequestWrapper.<init>(IdentityRequestWrapper.java:23)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      19:42:13,770 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      19:42:13,771 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      19:42:13,771 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      19:42:13,771 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
      19:42:13,771 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      19:42:13,771 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      19:42:13,771 ERROR [STDERR]      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      19:42:13,771 ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      19:42:13,771 ERROR [STDERR]      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
      19:42:13,771 ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
      19:42:13,771 ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      19:42:13,771 ERROR [STDERR]      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      19:42:13,771 ERROR [STDERR]      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
      19:42:13,771 ERROR [STDERR]      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
      19:42:13,771 ERROR [STDERR]      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
      19:42:13,772 ERROR [STDERR]      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      19:42:13,772 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:619)
      19:42:13,774 ERROR [RuleBase] errors parsing rules in: security.drl
      19:42:13,776 ERROR [RuleBase] Unable to build expression for 'consequence': Failed to compile: 1 compilation error(s): 
       - (1,1) unqualified type in strict mode for: e '  $c.grant();
      e' (security.drl)
      19:42:13,855 ERROR [[/HavenAntwerpen]] Session event listener threw exception
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.ruleBasedPermissionResolver
           at org.jboss.seam.Component.newInstance(Component.java:2144)
           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:233)
           at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:155)
           at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:46)
           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:2367)
           at org.apache.catalina.connector.Request.getSession(Request.java:2094)
           at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
           at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:844)
           at org.jboss.seam.web.IdentityRequestWrapper.<init>(IdentityRequestWrapper.java:23)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           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:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           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:235)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: securityRules
           at org.jboss.seam.Component.newInstance(Component.java:2144)
           at org.jboss.seam.Component.getInstance(Component.java:2021)
           at org.jboss.seam.Component.getInstance(Component.java:1983)
           at org.jboss.seam.Component.getInstance(Component.java:1977)
           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:148)
           at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
           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:2531)
           at org.jboss.seam.Component.initialize(Component.java:1527)
           at org.jboss.seam.Component.postConstructJavaBean(Component.java:1453)
           at org.jboss.seam.Component.postConstruct(Component.java:1376)
           at org.jboss.seam.Component.newInstance(Component.java:2129)
           ... 54 more
      Caused by: org.drools.rule.InvalidRulePackage: Unable to build expression for 'consequence': Failed to compile: 1 compilation error(s): 
       - (1,1) unqualified type in strict mode for: e '  $c.grant();
      e' : [Rule name='CreateAccount']
      
           at org.drools.rule.Package.checkValidity(Package.java:477)
           at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:434)
           at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:388)
           at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:121)
           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:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
           at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
           at org.jboss.seam.Component.newInstance(Component.java:2132)
           ... 70 more






      What could this


      unqualified type in strict mode for: e



      mean?