1 Reply Latest reply on Jun 4, 2010 5:25 AM by Ambrish Singh

    Seam 2.0.1 Security with Drools Showing Exception on Home Page

    Ambrish Singh Newbie

      Hi Everyone ,


      We are implementing Seam 2.0.1 Security in our project using Drools. Our rule is that only vendor role user can delete the Company.


      Component Name : manageCompany


      Method Name : deleteConfirmCompany


      But when the my home page is displaying then some exceptions are displaying on the console.


      Here are the required files :


      components.xml




      <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}" remember-me="true" />
      





      security.drl




      package Permissions;
      
      import java.security.Principal;
      
      import org.jboss.seam.security.PermissionCheck;
      import org.jboss.seam.security.Role;
      
      
      rule DeleteCompany
      when
      exists Principal()
      c: PermissionCheck(target == "manageCompany",
      action == "deleteConfirmCompany")
      Role(name == "vendor")
      then
      c.grant();
      end;



      And following are the Exceptions :




      12:46:17,999 ERROR [RuleBase] errors parsing rules in: /security.drl
      12:46:18,002 ERROR [RuleBase] Unable to create Field Extractor for 'target' of '[ClassObjectType class=org.jboss.seam.security.PermissionCheck]' in rule 'DeleteCompany' (/security.drl:12)
      12:46:18,192 ERROR [[/Poseidon]] 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:1970)
           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:191)
           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:828)
           at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:291)
           at org.apache.catalina.connector.Request.doGetSession(Request.java:2310)
           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:1851)
           at org.jboss.seam.Component.getInstance(Component.java:1829)
           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:368)
           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.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           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.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:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           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.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at com.poseidon.framework.TimingFilter.doFilter(TimingFilter.java:22)
           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:230)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           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:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Thread.java:619)
      Caused by: org.drools.rule.InvalidRulePackage: Unable to create Field Extractor for 'target' of '[ClassObjectType class=org.jboss.seam.security.PermissionCheck]' in rule 'DeleteCompany' : [Rule name=DeleteCompany, agendaGroup=MAIN, salience=0, no-loop=false]
      
           at org.drools.rule.Package.checkValidity(Package.java:424)
           at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:364)
           at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:87)
           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:21)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
           at org.jboss.seam.Component.callCreateMethod(Component.java:2005)
           at org.jboss.seam.Component.newInstance(Component.java:1976)
           at org.jboss.seam.Component.getInstance(Component.java:1873)
           at org.jboss.seam.Component.getInstance(Component.java:1840)
           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:2360)
           at org.jboss.seam.Component.initialize(Component.java:1389)
           at org.jboss.seam.Component.instantiateJavaBean(Component.java:1315)
           at org.jboss.seam.Component.instantiate(Component.java:1268)
           at org.jboss.seam.Component.newInstance(Component.java:1966)
           ... 73 more






      Regards,


      Ambrish