JSF/Primefaces doesn't work, when Primefaces is inside WEB-INF/lib

Description

I had a case when primefaces + myfaces 2.2.x were embedded inside war's WEB-INF/lib. I checked that almost everything works (JSF factories are properly discovered and everything from primefaces META-INF/faces-config.xml is properly registered.

But unfortunately actual facelet taglibs (files ending with .taglib.xml) are not loaded properly.

The culprit is org.apache.myfaces.view.facelets.util.Classpath#_searchResource method and under normal Tomcat (no OSGi) it's invoked like this:

Under pax-web:

The prefix of resource to search (recursively) is META-INF/ and suffix is .taglib.xml.

In Tomcat, these URLs are returned from java.lang.ClassLoader#getResources():

In pax-web:

In Tomcat, java.net.URL#openConnection() returns instance of sun.net.www.protocol.jar.JarURLConnection, In pax-web it's instance of org.apache.felix.framework.URLHandlersBundleURLConnection

That's enough to break the process in pax-web...

Because in Tomcat, the classloader is org.apache.catalina.loader.ParallelWebappClassLoader and in pax-web it's org.ops4j.pax.web.service.spi.util.ResourceDelegatingBundleClassLoader there's some change that we can fix this at pax-web level.

But I'm not yet sure.

Environment

None

Status

Assignee

Grzegorz Grzybek

Reporter

Grzegorz Grzybek

Labels

None

Affects versions

Priority

Major
Configure