File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Unable to load tag handler class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to load tag handler class" Watch "Unable to load tag handler class" New topic

Unable to load tag handler class

omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Hello friends,

I am learning Custom Tags. I was trying an example using both the methods:-

1) Simple Tags method
2) Classic Tags method

The program's intention is as follows. In the jsp, i use my custom tag to greet the user depending upon the time of the day. For example when the jsp page is requested before 2.00 pm ...the user will be greeted as "Good morning sir" and the time is shown.

I am able to achieve this using the Simple tag approach, but not using the classic tag approach.

After my Simple tag approach, was working, i went on copy pasting spree changing where ever it was required for Classic Tag approach...but i am getting an exception as follows :-

/view/ClassicCustomGreetTagFile.jsp(16,16) Unable to load tag handler class "org.omkar.swa.components.tagHandlers.GreetClassicNoBodyTagHandler" for tag "swa:classicGreet"...

Here are the details of the classic tag approach :-

The Tag handler class:-


The TLD File


The jsp page:-
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@taglib prefix="swa" uri="customGreetClassicTagWithNoBody"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SWA - An example of custom tag that will greet user as per time of the day...SIMPLE TAGS</title>
An example of custom tag that will greet user as per time of the day... but using SIMPLE TAGS

hello and ..... <swa:classicGreet/>
this is also valid.... <swa:classicGreet></swa:classicGreet>

I haven't made any configuration in web.xml for the tag, since it worked for SIMPLE Tag approach, i guess it should have also worked for CLASSIC Tag approach.
I am using Tomcat5.5, jdk 1.6, JSP 2.0

Please some one tell me what could be the problem?...initially i did not write the "doEndTag()" method in the tag handler class....but even after writing this method i am getting the same exception. Please some one help me. I am referring the Head First Servlet JSP book.

Por Favor Help me!!!

Thanks and Regards
Omkar Patkar (SCJP 1.4)[url][/url] | [url][/url]
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Guys, please help me out !
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 598

please carefully check the tld file if you did any spelling mistake.
Match carefully your Tag class and what name your have entered in
tag-class element.

I am used to this exception I solve it by checking correct class entry
and spelling.

best regards,
[ August 18, 2008: Message edited by: omi sharma ]

Most of the programming problems can't be solved because you don't know what the exact problem is.
Defining your problem correctly leads you to the right solution.
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Thanks omi....i was able to resolve the issue! There was no problem in the TLD or the class file or jsp....nowhere !

Firstly, I copy pasted the code from my CLassic tag handler into Simple tag handler(...since Simple tag handler was working), and to my surprise was working, so i realized, just as you said, there must be some problem with typing (...rather copy pasting ... he he ) ...but i checked it again and again....but everything was perfect!!!...the TLD, jsp, java file....all the three were perfectly correct !

i was getting at my nerves end!

... after sometime the apple fell on my head ....and i got this idea to check the classes directory under WEB-INF....and it happened to be that, Eclipse did not generate the class file for the custom tag handler....i restarted the eclipse first(...which DID not work) and then the its working absolutely if nothing happened!

phew !...finally !....both SIMPLE and CUSTOM tags work

thank you all !
I agree. Here's the link:
subject: Unable to load tag handler class
It's not a secret anymore!