Facelets: Setter not found for property class
“Setter not found for property class” is one of the most frustrating errors you can get in a Seam / facelets project.
It usually appears late, and you spend a long time trying to solve it. The solution is so simple you have to bang your hand when you finally find it.
I write this in the hope that it shows first in Google searches for this error…
The stack trace
The stack trace is not very useful:
at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1594)
at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1499)
at com.sun.facelets.tag.jsf.ComponentRule$LiteralAttributeMetadata.applyMetadata(ComponentRule.java:49)
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.ui.DefineHandler.applyDefinition(DefineHandler.java:64)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:131)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:337)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:307)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
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.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:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
The issue is actually quite simple – you used a class attribute on a non-html element. I always get it when I translate our designer’s pages to JSF:
See the problem? the <s:div> element actually requires a styleClass attribute, not a class.
Popularity: 19% [?]
17 Responses to Facelets: Setter not found for property class
Leave a Reply Cancel reply
Categories
- Android (1)
- appengine (3)
- Be nice to your users (6)
- CakePHP (13)
- General (6)
- Googlemaps (3)
- Java (16)
- javaScript (5)
- jQuery (11)
- Seam (2)
- Security (5)
- Spring MVC (6)
- Spring Webflow (2)
- Ubuntu (1)
- User Interface (6)
- Wordpress (2)
- Zope (2)
Recent Comments
- paskuale: @Duck Ranger framework’s name: Yii (Yes it is)
- Hanzel: I’m having a hard time understanding why when i click “run as…” in the project it...
- paskuale: Great article, thanks to your article I realized the same thing but with another framework, I don’t...
- Radix: This indeed came first in google and saved heck lot of time for me. Thanks
- Aditya: Spot on!! Thank you!! Had no idea why this error was occurring.
- paskuale: @Duck Ranger framework’s name: Yii (Yes it is)
Archives
- April 2012 (5)
- March 2012 (1)
- February 2012 (1)
- January 2012 (2)
- December 2011 (1)
- July 2011 (2)
- June 2011 (4)
- May 2011 (1)
- December 2010 (3)
- November 2010 (1)
- August 2010 (2)
- July 2010 (2)
- June 2010 (4)
- May 2010 (4)
- April 2010 (5)
- March 2010 (3)
Growing Kiwis
Growing Kiwis is my free service for early childhood education centers, preschools, daycares, kindies and more- any group of children, really.
Let me know what you think!











Thanks! With tags are allowed?
I have a div with and with one should I use, and how?
Thanks you!
@Albertoimpl – Do you mean which UI tags are allowed? This depends on what tag libraries you are using.
Thank you so much !! You made me win some precious time !! Indeed the exception ‘s cause is not so easy to figure out because with “class” in its label we thing about a Java class and are not focused on the html tag class attribute ‘class=”" !
Bye,
Gunhed french guy
Thanks a lot! You have saved my time!!!!
cheers
@gunhed, @Peter – happy to help
Thank you.
Thank you!
It solve my problem. Thank you!
Thanks
Nailed it, saved me a lot of time. Thanks.
This post saved my hair from falling out but yeah, I beat my head against the wall now too
I love you, man. I would have spent many long frustrating hours finding out this one.
Thsnk you so much! IT WORKS, just replace class with styleClass!
Thanks dude, going mad about the current problem. You saved me
Thanks Dude. Gone crazy with this issue.
Spot on!! Thank you!! Had no idea why this error was occurring.
This indeed came first in google and saved heck lot of time for me.
Thanks