We're updating the issue view to help you get more done. 

Custom tag libraries not supported together with libraries external bundles

Description

I have a web application bundle using JSF which I run via pax web in karaf.
There I tried using a custom JSF tag library, defined via context parameter javax.faces.FACELETS_LIBRARIES in my web.xml:

1 2 3 4 <context-param> <param-name>javax.faces.FACELETS_LIBRARIES</param-name> <param-value>/WEB-INF/sensorlink.taglib.xml</param-value> </context-param>

I am also using PrimeFaces in my bundle which provides its own two tag libraries.

Problem:

When running my application either my own tag library is found or the ones from PrimeFaces (this is random) but never all of them.
Occurred with pax web version 4.2.8.

Likely cause:

I tracked down the bug to class org.ops4j.pax.web.extender.war.internal.parser.WebAppParser: https://github.com/ops4j/org.ops4j.pax.web/blob/9445ed8fb4bc9880a5282314dd3aca020cd9a345/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L245. Incidentally there is a TODO which relates to my problem: // TODO merge with any user-defined values.
When defining a custom tag library and including tag libraries from other bundles, multiple entries for FACELETS_LIBRARIES are added to the list of context parameters. Later these are added to a HashMap where the values overwrite each other (same key), which explains the random behavior I see.
As this code is still present in version 6.0.6 I assume it would fail there too (not tested though).
The respective code was added in issue PAXWEB-614.

Workaround:

Move your custom tag library to its own bundle. Including mutliple tag libraries from multiple bundles works fine, as long as no FACELETS_LIBRARIES are defined in the web.xml.
Unfortunately the cause is hard to track down for a new user (especially because of the random behavior).

Environment

None

Status

Assignee

Grzegorz Grzybek

Reporter

Benjamin Wiesmüller

Labels

Components

Fix versions

Affects versions

4.2.8
6.0.6

Priority

Minor