Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Component Not Found for identifier <id>.getParent()" in facelets composite component
    primarykey
    data
    text
    <p>I migrated some of my facelets custom components into proper composite components, but encounters the following error while rendering a view that contains the composite component:</p> <pre><code>javax.faces.view.facelets.TagException: /WEB-INF/taglib/cctest.xhtml @15,26 &lt;composite:interface&gt; Component Not Found for identifier: bodyId.getParent(). at com.sun.faces.facelets.tag.composite.InterfaceHandler.validateComponent(InterfaceHandler.java:135) at com.sun.faces.facelets.tag.composite.InterfaceHandler.apply(InterfaceHandler.java:125) at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:320) at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:379) at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:326) at com.sun.faces.facelets.tag.UserTagHandler.apply(UserTagHandler.java:142) at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187) at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) at com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:188) at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:164) at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:906) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.jav </code></pre> <p>In the error message, the name <code>bodyId</code> refers to the id of <code>&lt;h:body&gt;</code> in the file below, and <code>getParent()</code> is hardcoded during the creation of the exception message. <code>@15,26</code> refers to the end of <code>&lt;composite:interface&gt;</code> in cctest.xhtml below.</p> <p>Here is the page that contains the composite component:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:bam="http://bam.mycompany.com/jsftaglib" &gt; &lt;f:view locale="en" id="viewId"&gt; &lt;h:head id="headId"&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt; &lt;title&gt;Title&lt;/title&gt; &lt;/h:head&gt; &lt;h:body id="bodyId"&gt; &lt;bam:cctest value="hello world."/&gt; &lt;/h:body&gt; &lt;/f:view&gt; &lt;/html&gt; </code></pre> <p>Here is the file named <code>cctest.xhtml</code> that declares the composite component <code>cctest</code>:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:h="http://java.sun.com/jsf/html" &gt; &lt;h:head&gt; &lt;title&gt;not used&lt;/title&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;composite:interface&gt; &lt;composite:attribute name="value" required="true"/&gt; &lt;/composite:interface&gt; &lt;composite:implementation&gt; &lt;h:outputText id="text_#{cc.attrs.value}" value="#{cc.attrs.value}"/&gt; &lt;/composite:implementation&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre> <p>The composite component is declared in a file named bam.taglib.xml located in /WEB-INF/taglib/, next to <code>cctext.xhtml</code>. Here is the file:</p> <pre><code>&lt;facelet-taglib 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-facelettaglibrary_2_0.xsd" version="2.0"&gt; &lt;namespace&gt;http://bam.mycompany.com/jsftaglib&lt;/namespace&gt; &lt;tag&gt; &lt;tag-name&gt;cctest&lt;/tag-name&gt; &lt;source&gt;cctest.xhtml&lt;/source&gt; &lt;/tag&gt; &lt;/facelet-taglib&gt; </code></pre> <p>I'm using mojarra 2.1.21 into tomcat 7.0.41. My faces-config.xml file is empty, there's no managed beans or other custom-defined components (validator, etc.). Web.xml only declares a few context param, plus the faces servlet mapped on *.xhtml; here are those context parameters:</p> <ul> <li>javax.faces.FACELETS_REFRESH_PERIOD = 1</li> <li>javax.faces.FACELETS_SKIP_COMMENTS = false</li> <li>javax.faces.FACELETS_LIBRARIES = /WEB-INF/taglib/bam.taglib.xml</li> <li>javax.faces.PROJECT_STAGE = Development</li> <li>javax.faces.VALIDATE_EMPTY_FIELDS = false</li> <li>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL = true</li> </ul> <p>Looking at the component tree that is displayed in the facelets error page, there's no element named <code>bodyId</code>, which might be a hint for my issue. A copy of which is displayed below:</p> <pre><code>&lt;UIViewRoot id="j_id1" inView="true" locale="en" renderKitId="HTML_BASIC" rendered="true" transient="false" viewId="/pages/composite_component_test.xhtml"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;UIOutput id="headId" inView="true" rendered="true" transient="false"&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt; &lt;title&gt;Title&lt;/title&gt; &lt;/UIOutput&gt; &lt;/UIViewRoot&gt; </code></pre> <p>Many thanks in advance for looking at this issue.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload