2 Replies Latest reply on Sep 23, 2009 8:53 AM by Sachin Parnami

    Error Parsing identity.hasRole(‘admin’)

    Sachin Parnami Newbie

      Hi All,


      While using


      <s:link view="/admin.xhtml" value="Admin"  rendered="#{identity.hasRole(‘admin’)}" />
      I get mentioned error
      
      My Code for Authenticator is 
      
      public boolean authenticate()
          {
              
              try {
                  currentUser = (User) 
                      entityManager.createQuery("select u from User u where u.userName = #{identity.username} and u.password = #{identity.password}")       
                                   .getSingleResult();
              } catch (PersistenceException e) {
                  return false;
              }
              if(currentUser != null){
                      log.info("ROLE "+ currentUser.getRole());
              identity.addRole(currentUser.getRole());
              return true;
              }else{
                      return false;
              }
          }



      Console throws this error




      11:54:11,199 ERROR [viewhandler] Error Rendering View[/home.xhtml]
      com.sun.facelets.tag.TagAttributeException: /layout/menu.xhtml @22,94 rendered="#{identity.hasRole(‘admin’)}" Error Parsing: #{identity.hasRole(‘admin’)}
              at com.sun.facelets.tag.TagAttribute.getValueExpression(TagAttribute.java:259)
              at com.sun.facelets.tag.jsf.ComponentRule$ValueExpressionMetadata.applyMetadata(ComponentRule.java:69)
              at com.sun.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:36)
              at com.sun.facelets.tag.MetaTagHandler.setAttributes(MetaTagHandler.java:62)
              at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:144)
              at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
              at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
              at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
              at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
              at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
              at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
              at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
              at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
              at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
              at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
              at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
              at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140)
              at com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:65)
              at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
              at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
              at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
              at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
              at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
              at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
              at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
              at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140)
              at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
              at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
              at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
              at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
              at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)
              at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
              at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
              at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
              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.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:598)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.el.ELException: Error Parsing: #{identity.hasRole(‘admin’)}
              at org.jboss.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:130)
              at org.jboss.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:151)
              at org.jboss.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:206)
              at org.jboss.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
              at org.jboss.seam.el.SeamExpressionFactory.createValueExpression(SeamExpressionFactory.java:98)
              at com.sun.facelets.tag.TagAttribute.getValueExpression(TagAttribute.java:256)
              ... 80 more
      Caused by: org.jboss.el.parser.ParseException: Encountered "\u2018" at line 1, column 20.
      Was expecting one of:
          <INTEGER_LITERAL> ...
          <FLOATING_POINT_LITERAL> ...
          <STRING_LITERAL> ...
          "true" ...
          "false" ...
          "null" ...
          "(" ...
          ")" ...
          "!" ...
          "not" ...
          "empty" ...
          "-" ...
          <IDENTIFIER> ...
          <NAMESPACE> ...
          
              at org.jboss.el.parser.ELParser.generateParseException(ELParser.java:2078)
              at org.jboss.el.parser.ELParser.jj_consume_token(ELParser.java:1958)
              at org.jboss.el.parser.ELParser.MethodSuffix(ELParser.java:1160)
              at org.jboss.el.parser.ELParser.DotSuffix(ELParser.java:1048)
              at org.jboss.el.parser.ELParser.Value(ELParser.java:983)
              at org.jboss.el.parser.ELParser.Unary(ELParser.java:951)
              at org.jboss.el.parser.ELParser.Multiplication(ELParser.java:714)
              at org.jboss.el.parser.ELParser.Math(ELParser.java:634)
              at org.jboss.el.parser.ELParser.Compare(ELParser.java:446)
              at org.jboss.el.parser.ELParser.Equality(ELParser.java:340)
              at org.jboss.el.parser.ELParser.And(ELParser.java:284)
              at org.jboss.el.parser.ELParser.Or(ELParser.java:228)
              at org.jboss.el.parser.ELParser.Choice(ELParser.java:182)
              at org.jboss.el.parser.ELParser.Expression(ELParser.java:174)
              at org.jboss.el.parser.ELParser.DeferredExpression(ELParser.java:112)
              at org.jboss.el.parser.ELParser.CompositeExpression(ELParser.java:40)
              at org.jboss.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:98)
              ... 85 more
      



      I am using Jboss.seam 2.2.0.GA on JBossAS 5.1.0.GA


      Any idea whats wrong with this?