[jboss-user] [JBoss Seam] - HELP! get exception when add @Restrict(

yadong do-not-reply at jboss.com
Sun Apr 22 02:13:23 EDT 2007


When I add @Restrict("#(identity.loggedIn)") to an Action (session bean) in class level, it throws exception when it is called.

@Stateful
@Scope(ScopeType.SESSION)
@Name("testAction")
@Restrict("#(identity.loggedIn)")
public class TestAction implements Testing {
 ...
    public String getName(){
          return name;
   }
}

in JSF page:

<h:inputText id="test" value="#{testAction.name}" />



Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
        at org.jboss.seam.security.Identity.evaluateExpression(Identity.java:507)
        at org.jboss.seam.security.Identity.checkRestriction(Identity.java:151)
        at org.jboss.seam.interceptors.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:35)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
        at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
        at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
        at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
        at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:52)
        at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$c3424f41.getSearchString()
        ... 58 more


if I remove the @Restrict("#(identity.loggedIn)") , or replace it by:
@Restrict("#{s:hasRole('admin')}") 
it is running well without execption



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039583#4039583

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039583



More information about the jboss-user mailing list