Pax will not find your TLDs if they are bundled different from your webapp:
Tag libs
For your custom tag libraries to work, your TLD files must be available in your package in βspecialβ places:
- all tld files in any bank referenced by your Bundle-ClassPath manifest entry
- all tld files in the WEB-INF directory or the WEB-INF subdirectory in your package
Please note that your imported packages will not be found (perhaps this support will be added later)
I had this problem on a Struts-based system where I use the OSGi-fied Struts package between multiple Webapp packages. Webapps has JSPs that need the ull Struts tag.
A bit hacked (because it copies TLDs all over the place) a workaround is to place the TLDs in your webapp META-INF and create a Webapp package to import the necessary Struts packages (or, if you don't use Struts, so that classes handle tags). This can be automated using Maven as follows:
<plugin> <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> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <configuration> <instructions> <Import-Package>[...],org.apache.struts2.views.jsp</Import-Package> </instructions> </configuration> </plugin>
Hanno fietz
source share