Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Package Custom Tag Library In Jar File  RSS feed

Rob E Green
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update: Ive resolved this. Had the tld in wrong place. Should be META-INF not WEB-INF. Working on both Tomcat 6.0 & Glassfish 3.1


Im trying to package my custom tag library into a jar file and need a bit of help please.

Im using Eclipse and have built a tag class. This works fine in a dynamic web project if I include the .tld file in the WEB-INF folder, and the tag class in src and add taglib entries to the web.xml.

However now I would like to package this up into a jar file to make it easily available to other developers and their projects.

I have tried exporting the class to a jar file and have selected the .tld and web.xml file when exporting - (I assume this bundles all the files into the jar).
But when I add the jar to the build path of another project and copy it into the WEB-INF/lib folder I get the following error:

'PWC6188: The absolute uri: cannot be resolved in either web.xml or the jar files deployed with this application'

Please could someone point me in the right direction. Thankyou.

Update - Ive found that if I add the tld and the tag lib entries into the project I can import the jar file and all works ok.
Its just not working when I try to use the tld within the jar file. This is both under glassfish 3.1 and tomcat 6.0

Here is the start of my tld....

<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns=""
<description>SW2 Tag Forms Library</description>
<display-name>SW2 Tag Forms</display-name>

Here is my web.xml.......

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">

Here is the name of my tag handler class....

public class SW2Tag_Forms extends BodyTagSupport {

Here is how I call it in a jsp.......

<%@ taglib uri="" prefix="sw2Tags"%>
Junilu Lacar
Posts: 11144
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

Thanks for updating your post to say that you had already solved it. We really appreciate seeing that kind of initiative and good etiquette around here, especially from a greenhorn, so I tip my hat to you and bid you a warm "Welcome to the Ranch!"

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!