12 Replies Latest reply: Sep 28, 2011 9:44 AM by joao massan RSS

WARN renderkit 'for' attribute cannot be null

Simon Berube Newbie

Hi,


Each time a page load this display this annoying message appears in the console :


WARN  [renderkit] 'for' attribute cannot be null


I searched in Seam source code to see where this message is logged and I found that this line is located in MessageRenderer class, line 130 and in the JSF implementation jar
(jsf-impl.jar). The version of JSF is 1.2_09-b01-BETA1 and the version of Seam I use is 2.1.0.SP1.


So, when I debugged the code I found that the component who cause this warning was a <s:message> component for a template file that I use. Here is my source code :


<rich:simpleTogglePanel
        switchType="client"
        label="#{messages['Details']}: #{messages['Estimate']} #{plan.name}"    
        id="usecasePanel">

...

<s:decorate id="codeDecoration" template="editPlan.xhtml">
        <ui:define name="label">#{messages['Code']} :</ui:define>
        <ui:param name="field" value="#{plan.code}" />
        <ui:param name="decoration" value="codeDecoration" />
</s:decorate>

...
</rich:simpleTogglePanel>



editPlan.xhtml (template file)


<div>
        <span class="name"><ui:insert name="label" /></span>
        <span class="value">

        <s:validateAll>
        ...             
        </s:validateAll>
                
        </span>
        <s:span styleClass="required" rendered="#{required}">*</s:span>
        <s:message 
                for="#{decoration}" 
                styleClass="errors" 
                showDetail="false" 
                showSummary="true"/>
</div>



When I debug the code and I inspect the UIMessage component it's show me that the forName property is set to null. But the decoration param is properly set in the xhtml file.


I dont't know what to do ?! I wonder if someone else has this kind of problem before me ?!


Thanks !!

  • 1. Re: WARN renderkit 'for' attribute cannot be null
    Nico de Wet Newbie

    Having the same problem here and am tearing my hair out trying to figure out how to get rid of these annoying WARN  renderkit 'for' attribute cannot be null messages. Also using s:message as above and am on Seam 2.0.1GA.


  • 2. Re: WARN renderkit 'for' attribute cannot be null
    Nico de Wet Newbie

    I managed to get my situation sorted out by brute force, that is to not use a template in an outputpanel. To be honest I don't know why this fixed the problem, I don't have the time for that, all I know is that the WARN renderkit... messages are gone.


    This is what I used to have:


    <a:outputPanel id="charArea" ajaxRendered="true">
     <s:decorate id="char" template="edit.xhtml">
       <ui:define name="label">Characters Left:</ui:define>
       <ui:param name="whofor" value="char" />
       <h:outputText id="charLeft" value="#{smsClass.charLeft}">
       </h:outputText>                       </s:decorate>                                                                      
    </a:outputPanel>
    



    And this is what I now have, the solution:


    <a:outputPanel id="charArea" ajaxRendered="true">     
     <div class="entry">
     <div class="label">Characters Left:</div>
     <div class="output">
     <h:outputText id="charLeft" value="#{smsClass.charLeft}">
     </h:outputText>     
     </div>
     </div>
    </a:outputPanel>
    

  • 3. Re: WARN renderkit 'for' attribute cannot be null
    Val Sw Expert
    I am also facing the same issue, we have a complex xhtml. I get this message on particular xhtml page and it prints it 3 times.... :(
    16:17:02,191 WARN  [renderkit] 'for' attribute cannot be null
    16:17:02,191 WARN  [renderkit] 'for' attribute cannot be null
    16:17:02,206 WARN  [renderkit] 'for' attribute cannot be null

    Will brute force help to find out which component is creating this message? I have never used it, any specific version I should go for, please suggest.
  • 4. Re: WARN renderkit 'for' attribute cannot be null
    Arbi Sookazian Master

    I'm getting it now.  Never seen this before...


    10:45:11,089 WARN  [renderkit] 'for' attribute cannot be null
    10:45:11,105 INFO  [ProfilingInterceptor] *** Entering method: getSelectedRecoveredEquipmentManagement
    10:45:11,105 INFO  [ProfilingInterceptor] *** Method class org.jboss.ejb3.interceptor.InvocationContextImpl.public com.cox.ers.entity.RecoveredEquipmentManagement com.cox.ers.session.RecoveredEquipmentManagementAction.getSelectedRecoveredEquipmentManagement() executed in 0ms ***
    10:45:11,120 WARN  [renderkit] 'for' attribute cannot be null
    10:45:11,152 INFO  [ProfilingInterceptor] *** Entering method: getSelectedRecoveredEquipmentManagement
    10:45:11,152 INFO  [ProfilingInterceptor] *** Method class org.jboss.ejb3.interceptor.InvocationContextImpl.public com.cox.ers.entity.RecoveredEquipmentManagement com.cox.ers.session.RecoveredEquipmentManagementAction.getSelectedRecoveredEquipmentManagement() executed in 0ms ***
    10:45:11,167 WARN  [renderkit] 'for' attribute cannot be null
    10:45:11,183 INFO  [ProfilingInterceptor] *** Entering method: getSelectedRecoveredEquipmentManagement
    10:45:11,183 INFO  [ProfilingInterceptor] *** Method class org.jboss.ejb3.interceptor.InvocationContextImpl.public com.cox.ers.entity.RecoveredEquipmentManagement com.cox.ers.session.RecoveredEquipmentManagementAction.getSelectedRecoveredEquipmentManagement() executed in 0ms ***
    10:45:11,198 WARN  [renderkit] 'for' attribute cannot be null
    10:45:11,214 INFO  [ProfilingInterceptor] *** Entering method: getSelectedRecoveredEquipmentManagement
    10:45:11,214 INFO  [ProfilingInterceptor] *** Method class org.jboss.ejb3.interceptor.InvocationContextImpl.public com.cox.ers.entity.RecoveredEquipmentManagement com.cox.ers.session.RecoveredEquipmentManagementAction.getSelectedRecoveredEquipmentManagement() executed in 0ms ***
    10:45:11,230 WARN  [renderkit] 'for' attribute cannot be null
    10:45:11,245 INFO  [ProfilingInterceptor] *** Entering method: getEquipmentTypeDescription
    10:45:11,245 INFO  [ProfilingInterceptor] *** Method class org.jboss.ejb3.interceptor.InvocationContextImpl.public java.lang.String com.cox.ers.session.RecoveredEquipmentManagementAction.getEquipmentTypeDescription(int) executed in 0ms ***
    10:45:11,261 WARN  [renderkit] 'for' attribute cannot be null
    10:45:11,417 INFO  [ProfilingInterceptor] *** Entering method: getRecoveryTypeDescription
    10:45:11,417 INFO  [ProfilingInterceptor] *** Method class org.jboss.ejb3.interceptor.InvocationContextImpl.public java.lang.String com.cox.ers.session.RecoveredEquipmentManagementAction.getRecoveryTypeDescription(int) executed in 0ms ***
    10:45:11,448 WARN  [renderkit] 'for' attribute cannot be null
    10:45:11,448 INFO  [ProfilingInterceptor] *** Entering method: getSelectedRecoveredEquipmentManagement
    10:45:11,448 INFO  [ProfilingInterceptor] *** Method class org.jboss.ejb3.interceptor.InvocationContextImpl.public com.cox.ers.entity.RecoveredEquipmentManagement com.cox.ers.session.RecoveredEquipmentManagementAction.getSelectedRecoveredEquipmentManagement() executed in 0ms ***
    10:45:11,464 WARN  [renderkit] 'for' attribute cannot be null



    It's like a virus and my server.log is now 425MB in dev!!!

  • 5. Re: WARN renderkit 'for' attribute cannot be null
    Arbi Sookazian Master

    I commented the <s:message/> in edit.xhtml (see below):


    <div class="entry">
            <s:label styleClass="label #{invalid?'errors':''}">
                <ui:insert name="label"/>
                <s:span styleClass="required" rendered="#{required}">*</s:span>
            </s:label>
            <span class="input #{invalid?'errors':''}">
                <s:validateAll>
                    <ui:insert/>
                </s:validateAll>
            </span>
            <!-- commenting due to "15:25:14,322 WARN  [renderkit] 'for' attribute cannot be null" -->
            <!-- <s:message styleClass="error errors"/> -->
        </div>



    and the error went away.  obviously, this is not a fix, b/c I need the s:message.


    what's the fix???  This is the same code as seam-booking app?  why is this happening for this app all of a sudden?

  • 6. Re: WARN renderkit 'for' attribute cannot be null
    Julien Kronegg Novice

    You should use the edit.xhtml template only if there is something to edit.


    This is because the edit.xhtml template contains a <s:message> which maps to the org.jboss.seam.ui.component.UIMessage class (which extends javax.faces.component.html.HtmlMessage which at some point should use the JSF class MessageRenderer which issue the 'for' attribute cannot be null message). The <s:message> tag looks for a 'for' property as follow:



    1. recursively look for the first parent <s:decorate>

    2. look for the first EditableValueHolder component in the <s:decorate> (Depth-First-Search order)

    3. return the 'for' attribute as the EditableValueHolder id (or null if not found)



    Since there is no EditableValueHolder field, the 'for' attribute is null, hence the error message.


    Abri, do you think the <s:message> should be attached to the <s:decorate> itself if there is no EditableValueHolder field in the decorate?


    The advantage would be to avoid failling when possible (and to remove the warning, of course).

  • 7. Re: WARN renderkit 'for' attribute cannot be null
    Julien Kronegg Novice

    FYI, I created the JBSEAM-4428 JIRA issue for that warning.

  • 8. Re: WARN renderkit 'for' attribute cannot be null
    Lucas Monteiro Newbie
    I've solved this problem in my application.
    I was using "<s:decorate template="/layout/edit.xhtml">" and inside the tag I was using h:commandButon.
    I've change edit.xhtml for display.xhtml.
    Like Julien Kronegg told, there is no EditableValue. So don't use 'edit.xhtml'.






  • 9. Re: WARN renderkit 'for' attribute cannot be null
    Rick Roberts Newbie

    Had the same issue and came here looking for answers.


    Lucas and Julien are correct.


    When using a non-editable component you should be using


    template="/layout/display.xhtml"



    vs


    template="/layout/edit.xhtml"




  • 10. Re: WARN renderkit 'for' attribute cannot be null
    Artur Grigoryan Newbie

    If you use s:message in your template with s:decorate then there should be at least ONE rendered UI input component.

  • 11. Re: WARN renderkit 'for' attribute cannot be null
    joao massan Newbie

    Try this in edit.xhtml



    <s:message styleClass="errors" rendered="#{noEdit == null ? true : noEdit}"/>



    When you need to use a decorate without an input component, you'll do this way:


    <s:decorate template="/layout/edit.xhtml">
        <!-- here is the trick -->
        <ui:param name="noEdit" value="true"/>  
        
        <!-- the label -->
        <ui:define name="label">Value field: </ui:define>
    
        <!-- the non-input component -->
        <h:outputText value="#{component.value}"/>
    </s:decorate>










  • 12. Re: WARN renderkit 'for' attribute cannot be null
    joao massan Newbie

    Sorry... I made a mistake...


    The right way is:


    <ui:param name="noEdit" value="false"/>



    Parameter is FALSE instead of TRUE.