Cannot find annotated custom JSF2 component in jar

We are porting JSF1.2 to the JSF2 application, and I ran into a problem with custom components. We have a separate jar with components, and in this jar I have this:

@FacesComponent(value = "Panel2")
public class Panel2 extends UIOutput { ... }

In my taglib in META-INF, I have this:

<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
    id="mw">
    <namespace>http://www.ssss.be/jsf/mw</namespace>
    <composite-library-name>mw</composite-library-name>
    <tag>
        <tag-name>panel2</tag-name>
        <component>
            <component-type>Panel2</component-type>
        </component>
    </tag>
</facelet-taglib>

Having done the jar of all this and applying it in another project, I use the tag as follows:

xmlns:mw="http://www.sofico.be/jsf/mw"

And then:

<mw:panel2 />

But, unfortunately, the result:

javax.faces.FacesException: Expression Error: Named Object: Panel2 not found. at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1858)
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1129)

What am I doing wrong here?

+5
source share
1 answer
  • make sure the JSF version in faces-config.xml is at least version 2
  • make sure the attribute metadata-completein faces-config.xml is not set to true.
  • , WEB-INF/classes; , WEB-INF/lib, jar faces-config.xml( )
  • , Panel2 XML ( )

. JSF 2; 11.5.1.

+8

All Articles