Setter not found for property class
Asked Answered
C

2

8

Now,I write sample application with jsf, spring and ibatis.I use facelets and write template.xhtml, header.xhtml, menu.xml, login.xhtml and home page. After login, I found this error.

In browser,

Setter not found for property class
  + Stack Trace
  + Component Tree
  + Scoped Variables

In Console,

21:01:20,890 SEVERE [viewhandler] Error Rendering View[/view/SPAR02.xhtml]
java.lang.IllegalArgumentException: Setter not found for property class
    at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1645)
    at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1526)
    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.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.tag.jstl.core.ForEachHandler.apply(ForEachHandler.java:175)
    at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
    at com.sun.facelets.tag.UserTagHandler.apply(UserTagHandler.java:122)
    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.jstl.core.ChooseWhenHandler.apply(ChooseWhenHandler.java:45)
    at com.sun.facelets.tag.jstl.core.ChooseHandler.apply(ChooseHandler.java:68)
    at com.sun.facelets.tag.jstl.core.ChooseOtherwiseHandler.apply(ChooseOtherwiseHandler.java:41)
    at com.sun.facelets.tag.jstl.core.ChooseHandler.apply(ChooseHandler.java:73)
    at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
    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.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:268)
    at com.sun.facelets.tag.UserTagHandler.apply(UserTagHandler.java:98)
    at com.sun.facelets.tag.jstl.core.IfHandler.apply(IfHandler.java:54)
    at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
    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.jsf.core.ViewHandler.apply(ViewHandler.java:109)
    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 jp.co.dirbi.falcon.online.security.SessionIdExchangeFilter.doFilter(SessionIdExchangeFilter.java:85)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at jp.co.dirbi.falcon.online.component.web.seam.JSessionIDFilter.doFilter(JSessionIDFilter.java:88)
    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 jp.co.dirbi.falcon.online.component.web.seam.SystemFilter.doFilter(SystemFilter.java:253)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    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:390)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
    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)

My template.xml,

<div class="head">    
   <ui:include src="header.xhtml"></ui:include>
   <div>
     <table border="0" class="normal" height="500px" align="center" bgcolor="#F4FFE4"> 
       <tr>
         <td width="13%">
           <ui:include src="menu.xhtml" /> 
         </td>
         <td width="87">
           <ui:insert name="body" />
         </td>
       </tr>
      </table>
   </div>
   <ui:include src="footer.xhtml"></ui:include>

My home page(SPAR02.xhtml),

<ui:define name="head">
    <title>Top Menu</title>
   </ui:define>
   <ui:define name="body">
    <font size="5">Welcome</font>
         You can search user informations, update or delete them and can add new user.
    </ui:define>

I can't find what wrong,anybody help me.

Chloric answered 19/6, 2013 at 14:52 Comment(3)
In the future questions, please post code in SSCCE flavor. Just a single file which is copy'n'paste'n'runnable in its entirety.Stylish
@Stylish How do you that with xhtml AND java files ( jsf controllers, etc.)?Hollins
@StudioWorks: In OP's case I was talking about a single XHTML file instead of a template+client with missing includes and seemingly irrelevant HTML code. For more info see also stackoverflow.com/tags/jsf/infoStylish
S
29

Facelets is trying to set the property class to a component who doesn't accept this property. Most of the time, the property for the HTML class attribute is styleClass.

I don't see the problem in the code you give us. The problem can be anywhere in the facelets page.

See this question for more information.

Silicone answered 19/6, 2013 at 15:24 Comment(1)
The stack trace hints that it's a child component of a hierarchy <f:view><c:if><c:choose><c:when><ui:insert><c:forEach> somewhere in the webapp.Stylish
S
0

I had the same Error,

public static void setFileName(String fileName) {
    LogFile.fileName = fileName;
}

in Spring

<bean id ="logfile" class = "A.B.C.LogFile" >
    <property name ="fileName" value ="${fileName}" />
</bean>

The solution is to just remove static from the method:

// without static 
public  void setFileName(String fileName) {
    LogFile.fileName = fileName;
}

after that he can set it :)

Spang answered 14/10, 2013 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.