[jboss-user] [JBoss Seam] - SEAM - TRINIDAD - @Restrict

FabBoco do-not-reply at jboss.com
Thu Mar 15 06:59:21 EDT 2007


Hi,

I actually need help ! I am getting crazy tring to configure Seam security 
(SEAM 1.2.0.PATCH1)

I have been following istructions from twiki:

http://wiki.apache.org/myfaces/TrinidadSeamAjax4JsfFaceletDetail

and I am using the sample-web-1-2-0.xml file as web.xml

I have not ajax so I have removed the related lines.

First problem

When I deploy to jboss-4.0.5 I get the following error:


  | .... StandardWrapper.Throwable
  | java.lang.IllegalStateException: No Factories configured for this Application. 
  | This happens if the faces-initialization does not work at all - make sure 
  | that you properly include all configuration settings necessary for a basic 
  | faces application and that all the necessary libs are included. Also check 
  | the logging output of your web application and your container for any 
  | exceptions!
  | If you did that and find nothing, the mistake might be due to the fact that 
  | you use some special web-containers which do not support registering 
  | context-listeners via TLD files and a context listener is not setup in your 
  | web.xml.
  | A typical config looks like this;
  | <listener> 
  | <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  | </listener>
  | 

Then I had at the very top of web.xml and I am able to deploy.

This behavior is different from which described onto the wiki. All the 
indicated libraries are into the WEB-INF/lib.

Second Problem - The PROBLEM

I am trying to use SEAM security and I have annotated a session bean method  
with

@Restrict ("#{s:hasRole('Administrator')}")

and I have put an exception into the pages file:

  |         <exception class="org.jboss.seam.security.AuthorizationException">
  |                 <end-conversation before-redirect="true" />
  |                 <redirect view-id="/Error.xhtml">
  |                         <message severity="warn">message</message>
  |                 </redirect>             
  |         </exception>
  | 

When an unauthorized user try to call the method the error is not intercepted, 
my Error.xhtml is not shown  and I get the following error on the jboss 
console:


  | 11:07:53,624 ERROR [STDERR] Mar 15, 2007 11:07:53 AM 
  | com.sun.facelets.FaceletViewHandler handleRenderException
  | SEVERE: Error Rendering View[/list/ProgettoList.xhtml]
  | org.jboss.seam.security.AuthorizationException: Authorization check failed for 
  | expression [#{s:hasRole('Administrator')}]
  |         at 
  | org.jboss.seam.security.Identity.checkRestriction(Identity.java:162)
  |         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.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
  |         at 
  | org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:52)
  |         at 
  | anomalie.manager.managerInterface.ProgettoManager$$EnhancerByCGLIB$$9cdb4989.findAll(<generated>)
  |         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:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
  |         at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:121)
  |         at org.jboss.seam.Component.callComponentMethod(Component.java:1802)
  |         at 
  | org.jboss.seam.Component.getInstanceFromFactory(Component.java:1664)
  |         at org.jboss.seam.Component.getInstance(Component.java:1601)
  |         at org.jboss.seam.Component.getInstance(Component.java:1578)
  |         at 
  | org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
  |         at 
  | org.apache.myfaces.trinidadinternal.el.TrinidadVariableResolver.resolveVariable(TrinidadVariableResolver.java:55)
  |         at 
  | org.apache.myfaces.trinidadinternal.el.TrinidadVariableResolver.resolveVariable(TrinidadVariableResolver.java:55)
  |         at 
  | org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
  |         at 
  | com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
  |         at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
  |         at 
  | com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
  |         at 
  | com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
  |         at 
  | com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
  |         at 
  | org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
  |         at 
  | org.apache.myfaces.trinidad.component.UIXComponentBase.getProperty(UIXComponentBase.java:1119)
  |         at 
  | org.apache.myfaces.trinidad.component.UIXIterator.getValue(UIXIterator.java:397)
  |                                                         

As you can see, the handler which is responding is

com.sun.facelets.FaceletViewHandler

so I think that the reason why my error page is shown is that the  
SeamFaceletViewHandler is not (correctly) installed despite my indication in 
web.xml

Third Problem 

The SEAM documentation ask to put 

        <view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>


into the faces-config.xml.

If I do that, I get the following error when I call my first application page:


  | java.lang.IllegalStateException: No RenderingContext
  |         at 
  | org.apache.myfaces.trinidad.render.CoreRenderer.encodeBegin(CoreRenderer.java:159)
  |         at 
  | org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:671)
  |         at 
  | com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
  |         at 
  | com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
  |         at 
  | com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
  |         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
  |         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  |         at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
  |         at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
  |         at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
  |         at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
  |         at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
  |         at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
  |         at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
  |         at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  |         at 
  | org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:210)
  |         at 
  | org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:167)
  |         at 
  | org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:140)
  |         at 
  | org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:93)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  |         at 
  | org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  |         at 
  | org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  |         at 
  | org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  |         at 
  | org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
  |         at 
  | org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
  |         at 
  | org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)                                                                                                                          
  | 

Is there any body out there that can help me ? 

Thank you in advance

Fabrizio

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

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



More information about the jboss-user mailing list