aspose file tools
The moose likes JSP and the fly likes Package Custom Tag Library In Jar File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Package Custom Tag Library In Jar File" Watch "Package Custom Tag Library In Jar File" New topic

Package Custom Tag Library In Jar File

Rob E Green

Joined: Jun 08, 2012
Posts: 1
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

Joined: Feb 26, 2001
Posts: 5897

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!"

Junilu - [How to Ask Questions] [How to Answer Questions]
Consider Paul's rocket mass heater.
subject: Package Custom Tag Library In Jar File