1

I'm unable to pack taglibrary in a war file. I moved tags from project to extra library the current project is depending now. I put the taglibrary file into the META-INF directory of the jar containing tags (how is described here). But the page does not work:

Expression Error: Named Object: eu.barbucha.barbatag.simple.PropertyTag not found.

The server is able to find the taglibrary. Otherwise the page works, just one waring appears:

Warning: This page calls for XML namespace http://barbucha.eu/tags declared with prefix br but no taglibrary exists for that namespace.

Thus the question is: Why the server finds just the descriptor, but not the classes? When I copy classes from WEB-INF/lib/barbatag.jar into WEB-INF/classes and restart the webapp in administration console, the page gets working. The server also finds UI-components only if they are involved directly in classes of the applictation, but not in the jar stored in the WEB-INF/lib directory. On other hand the server loads taglib descriptor from the jar. It's really confusing... Declaration of the critical class:

package eu.barbucha.barbatag.simple;    

@FacesComponent("eu.barbucha.barbatag.simple.PropertyTag")
public class PropertyTag extends UIComponentBase { ... }

Definition of critical tag:

<tag>
    <display-name>The component taking values from a property file</display-name>
    <tag-name>property</tag-name>
    <component>
        <component-type>eu.barbucha.barbatag.simple.PropertyTag</component-type>
    </component>
</tag>

One potentionally important point: I'm using Spring MVC.

Community
  • 1
  • 1
Theodor Keinstein
  • 1,653
  • 2
  • 26
  • 47
  • It seems that my taglibrary JAR lacks the `faces-config.xml` file. The JSF specification doesn't require annotation scanning otherwise. (See [Cannot find annotated custom JSF2 component in jar](http://stackoverflow.com/questions/6150926/cannot-find-annotated-custom-jsf2-component-in-jar)) – Theodor Keinstein Jan 26 '12 at 12:48

1 Answers1

3

You need to supply a /META-INF/faces-config.xml file in the JAR in order to get JSF to scan the JAR file for classes with JSF specific annotations like @FacesComponent. This is done so to prevent JSF from unnecessarily scanning every single JAR file for classes (which might be very time and CPU consuming if you have lot of them).

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 1
    Thanks. The empty `faces-config.xml` (containing only ``) situated within the `META-INF` directory of the taglib JAR has solved my problem. – Theodor Keinstein Jan 26 '12 at 14:38