Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The warning of "Unable to save dynamic action with clientId 'j_idX' because the UIComponent cannot be found" occur, with using CombinedResourceHandler

I get the warnings of below once, when I submit and update="@form".

14:03:23,139 WARNING [javax.enterprise.resource.webcontainer.jsf.application.view] (default task-27) Unable to save dynamic action with clientId 'j_id2' because the UIComponent cannot be found
14:03:23,139 WARNING [javax.enterprise.resource.webcontainer.jsf.application.view] (default task-27) Unable to save dynamic action with clientId 'j_id3' because the UIComponent cannot be found

But removing "org.omnifaces.resourcehandler.CombinedResourceHandler" from faces-config.xml, the warnings dosen't get.

Developing enviroment is ...

  • Primefaces 7.0
  • Omnifaces 3.4
  • WildFly 16.0.0.Final

Here is minimum sample.(but my production code is more complexity, so many(20-1000) the warnings get.)

index.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<f:metadata><f:viewAction action="#{indexView.init()}"/></f:metadata>
<h:body>
    <h:form id="mainForm">
        <p:messages id="messages"/>
        <p:panelGrid id="panelGrid" columns="3" layout="grid">
            <p:outputLabel id="labelInput1" for="@next" value="input"/>
            <p:selectOneMenu id="input" value="#{indexView.selectOne}">
                <f:selectItems value="#{indexView.itemCandidates}" var="i" itemLabel="#{i}" itemValue="#{i}"/>
            </p:selectOneMenu>
            <p:commandButton id="btn" value="submit" process="panelGrid" update="@form" actionListener="#{indexView.submit}"/>
        </p:panelGrid>
    </h:form>
</h:body>
</html>

IndexView.java

package com.sample.primafaces_operation_verification;

import javax.faces.view.ViewScoped;
import // omitted // ;

@Named
@ViewScoped
public class IndexView implements Serializable {

    @Getter
    private List<String> itemCandidates;

    @Getter @Setter
    private String selectOne;

    public void init() {
        this.itemCandidates = List.of("aaa", "bbb", "ccc", "ddd");
    }

    public void submit() {
        Messages.addGlobalInfo("Selected item : {0}", selectOne);
    }
}

faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
              version="2.0">
    <application>
        <resource-handler>org.omnifaces.resourcehandler.CombinedResourceHandler</resource-handler>
        <action-listener>org.primefaces.application.DialogActionListener</action-listener>
        <navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
        <view-handler>org.primefaces.application.DialogViewHandler</view-handler>
    </application>
</faces-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
        <param-value>0</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.CLIENT_SIDE_VALIDATION</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.FONT_AWESOME</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.MOVE_SCRIPTS_TO_BOTTOM</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.numberOfLogicalViews</param-name>
        <param-value>6</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.numberOfViewsInSession</param-name>
        <param-value>6</param-value>
    </context-param>
    <context-param>
        <param-name>org.omnifaces.VIEW_SCOPE_MANAGER_MAX_ACTIVE_VIEW_SCOPES</param-name>
        <param-value>6</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.faces</welcome-file>
    </welcome-file-list>
</web-app>

I expect not getting the warnings. How can i fixt it?

like image 383
hir0ku Avatar asked Oct 26 '25 19:10

hir0ku


1 Answers

I found several references to this warning but not a duplicate on SO worth voting to close your question as duplicate, so I'll attempt to answer by citations:

PrimeFaces nested form inside p:dialog with appendTo="@(body)

Michele Mariotti says:

These warnings, as for my experiments, are harmless and could be safely ignored. However I opened a pull request to eventually fix it.


BootsFaces issue 325 Unable to save dynamic action with clientId 'j_id...'

stephanrauh commented on 22 Mar 2016

This is a warning, not an error. As soon as you set the ProjectStage to production, the warning is gone. So I consider this a minor nuisance, not a serious error. In any case, do you get the warning without using OmniFaces?

stephanrauh commented on 22 Mar 2016

Unlikely. The warning occurs when you manipulate the JSF DOM tree using the wrong API. For instance, by removing a resource file by simply deleting it from the list. That's what OmniFaces used to do in an earlier version. JSF detects that something's missing, gets nervous and reacts with omitting these confusing warnings. It's possible that BootsFaces uses the "forbidden" API, but I believed to have fixed that. In any case, can you upload a simple project that reproduces the warning? This make our job a lot easier.


To conclude the warning is triggered by org.omnifaces.resourcehandler.CombinedResourceHandler removing resources from the view which is part of it's core functionality. Try setting javax.faces.PROJECT_STAGE to Production and ingore the warning while coding.

like image 65
Selaron Avatar answered Oct 29 '25 06:10

Selaron