Pax won't find your TLDs, if they are in a bundle different from your webapp:
Tag Libs
In order to get your custom tag libs working your TLD files will have to be reachable in your bundle in "special" places:
- all tld files in any jar referenced by your Bundle-ClassPath manifest entry
- all tld files in WEB-INF directory or sub-directory of WEB-INF in your bundle jar
Please note that your imported packages will not be searched (it may be that this support will be added later on)
I'm having this problem in a Struts-based system where I share an OSGi-fied Struts bundle between multiple webapp bundles. The webapps have JSPs that need the Struts taglib.
A slightly hackish (because it copies the TLD all over the place) workaround is putting the TLD in your webapp's META-INF
directory and make the webapp bundle import required Struts packages (or, if you don't use Struts, whatever classes process the tags). This can be automated with Maven like so:
<plugin>
<!--
Extract the TLD file from the Struts bundle you are using
and place it in src/main/resources/META-INF of your webapp's
project directory during generate-resources. This will make
the file end up in the appropriate place in the resulting WAR
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>extract-tld</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts.version}</version>
<outputDirectory>src/main/resources</outputDirectory>
<includes>META-INF/struts-tags.tld</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--
Add the required Manifest headers using the maven-bundle-plugin
-->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<!-- ... -->
<instructions>
<!-- ... -->
<Import-Package>[...],org.apache.struts2.views.jsp</Import-Package>
<!-- ... -->
</instructions>
</configuration>
</plugin>