aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) 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 » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Unable to load tag handler class!!!" Watch "Unable to load tag handler class!!!" New topic
Author

Unable to load tag handler class!!!

Prabhat Gupta
Ranch Hand

Joined: Jan 22, 2008
Posts: 135
Hi,
i have a simpleTag1.jsp file with following declarations:

<%@ taglib prefix="myTags" uri="simpleTags" %>
<html><body>
in jsp<br>
<myTags:simple1>
Hi in tag-body
</myTags:simple1>
</body></html>

and a simple tag handler class SimpleTagTest1 within package foo inside WEB-INF/classes directory.

Also i have placed simple1.tld file inside the WEB-INF directory with following contents:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">

<tlib-version>0.9</tlib-version>
<uri>simpleTags</uri>
<tag>
<name>simple1</name>
<tag-class>foo.SimpleTagTest1</tag-class>
<body-content>scriptless</body-content>
</tag>

</taglib>

But the problem is when i execute the simpleTag1.jsp,an exception saying Unable to load tag handler class "foo.SimpleTagTest1" for tag "myTags:simple1".

Would you suggest how to rectify this problem?

With thanks in advance
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

and a simple tag handler class SimpleTagTest1 within package foo inside WEB-INF/classes directory.

I'd be curious to see your tag handler as well. Is it a public class ?


[My Blog]
All roads lead to JavaRanch
Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 390
Christophe is right.
The class must be public with a public default constructor
Prabhat Gupta
Ranch Hand

Joined: Jan 22, 2008
Posts: 135
tag handler class : SimpleTagTest1
--------------------------------------

package foo;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;

public class SimpleTagTest1 extends SimpleTagSupport{
String name;
public void setName(String name){
this.name=name;
}

public void doTag() throws JspException,IOException{
getJspContext().getOut().print("in the doTag ");

}
}
----------------------------------------------------------
Prabhat Gupta
Ranch Hand

Joined: Jan 22, 2008
Posts: 135
Hey Ranchers,
me eagerly waiting for your kind suggestions.Come up with idea
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you put SimpleTagTest1.class under WEB-INF/foo ?
Prabhat Gupta
Ranch Hand

Joined: Jan 22, 2008
Posts: 135
Hey Christophe!

I have placed SimpleTagTest1.class under WEB-INF/classes/foo directory .Is it wrong ?
also my .tld file simple1.tld is under WEB-INF directory. moreover problem remained same when i placed the SimpleTagTeat1.class under WEB-INF/foo directory.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Oops, sorry, my bad. I meant WEB-INF/classes/foo, like you did at first. Ok, so everything looks fine from here. Where do you get the error ? Can you copy/paste the exact message ? And also check your container's log. By the way, did you reboot the container ?
Prabhat Gupta
Ranch Hand

Joined: Jan 22, 2008
Posts: 135
Yeah i have rebooted it (more than 5 times )
and in log file i got a very long bad message saying



2008-04-23 11:54:39 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /simpleTag1.jsp(4,0) Unable to load tag handler class "foo.SimpleTagTest1" for tag "myTags:simple1"
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:200)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1318)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1560)
at org.apache.jasper.compiler.Parser.parse(Parser.java:126)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)



would you like to decipher this message ?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Are you using some kind of editor, trying to run the application from the editor ?
[ April 23, 2008: Message edited by: Christophe Verre ]
Prabhat Gupta
Ranch Hand

Joined: Jan 22, 2008
Posts: 135
I am not getting by means of editor. Are you talking about eclipse or Jboss etc? I am not using these things.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I am not using these things.

Mmmmhh.. I don't know. Just in case, I tried to copy/paste what you have posted above, and it worked.
It looks like the container does not find the SimpleTagTest1.class under WEB-INF/classes/foo, although you are saying that you have it there.

I don't think that it will solve it, but try to clear the container's cache. (In Tomcat, it's under \work\Catalina\localhost\[yourapp]\.)
Sandeep Sirsekar
Greenhorn

Joined: Apr 09, 2008
Posts: 16
if you have satisfied two requirements
1) class must have package declaration package foo;
2) class must be under /WEB-INF/classes/foo which is default path for all classes

other than this i dont find any problem in this case.
Frank Bommeli
Greenhorn

Joined: Jul 09, 2009
Posts: 1
Hi
I hat the same problem.

I solved it by stopping Tomcat, cleaning its cache as well as restarting the browser.

Hope this will help the next one
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to load tag handler class!!!