Evandro Pomatti
Evandro Pomatti

Reputation: 15094

Eclipse can't find JSF 2.2 taglibs

I am using JSF 2.2 taglibs but Eclipse is displaying the following warning message:

Can't find facelet tag library for uri http://xmlns.jcp.org/jsf

What bugs me is that I've faced this issue before and it was related to classpath JARs, but now it is only affecting JSF 2.2 tag libs.

Taglib xmlns:h="http://xmlns.jcp.org/jsf/html" is working fine, the warning is shown to JSF 2.2 specifics like "/jsf" and "/jsf/passthrough". Here is an image showing warnings for JSF 2.2. tag libs, but prior namespaces are loaded correctly.

Warnings for JSF 2.2 tag libs

I have tried to solve the issue with help of posts like this but none of the procedures (clean, restart, close/open, validate, etc) have worked for me.

Dependencies for JSF (derived from WildFly 10.1 pom.xml):

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.13</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.13.SP1</version>
        <scope>provided</scope>
    </dependency>

Eclipse info:

Version: Neon.1a Release (4.6.1)
Build id: 20161007-1200

Update

After looking into the taglib files I found no "passthrough" or "friendly markup" reference. So there is no surprise Eclipse won't find it...

There is no file under com.sun.faces.metadata.taglib for Friendly Markup and Passthrough, for both Glassfish and JBoss implementations.

enter image description here

The question now is where should these files be?

Upvotes: 4

Views: 9000

Answers (1)

Evandro Pomatti
Evandro Pomatti

Reputation: 15094

Update: opened issue WFLY-9579

It seems that the taglib files are missing from the implementation JARs, for both Glassfish and JBoss projects. I hope to be wrong but I found no other explanation.

enter image description here

I've posted a thread so this behavior can be investigated.

https://developer.jboss.org/thread/274046

Workaround

To stop the IDE from warning simply create empty taglibs files and associate to the web.xml. Files should go under /WEB-INF/ and have the appropriate extension taglib.xml.

The JSF implementation will behave normally and should process the facelets correctly.

friendly_markup.taglib.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
    version="2.2">
    <namespace>http://xmlns.jcp.org/jsf</namespace>
</facelet-taglib>

passthrough.taglib.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
    version="2.2">
    <namespace>http://xmlns.jcp.org/jsf/passthrough</namespace>
</facelet-taglib>

web.xml

<context-param>
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    <param-value>/WEB-INF/passthrough.taglib.xml;/WEB-INF/friendly_markup.taglib.xml</param-value>
</context-param>

Here is what it looks like. Now the warnings are gone (and my OCD is calm again). I would like to try and make JAR dependency for it, if I find some spare time.

enter image description here

Upvotes: 5

Related Questions