Can't figure out what this error means for a TLD file

I am new to Java and I am getting the following error. I a tld file in a tlds folder under the Web-inf folder. I am running tomcat 5.5.17. I also put the file in the Web.xml. What else do I need to do?

javax.servlet.ServletException: javax.servlet.jsp.tagext.TagInfo.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/jsp/tagext/TagLibraryInfo;Ljavax/servlet/jsp/tagext/TagExtraInfo;[Ljavax/servlet/jsp/tagext/TagAttributeInfo;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljavax/servlet/jsp/tagext/TagVariableInfo;Z)V

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

root cause

java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagInfo.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/jsp/tagext/TagLibraryInfo;Ljavax/servlet/jsp/tagext/TagExtraInfo;[Ljavax/servlet/jsp/tagext/TagAttributeInfo;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljavax/servlet/jsp/tagext/TagVariableInfo;Z)V

org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:435)

org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:248)

org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:162)

org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)

org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)

org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)

org.apache.jasper.compiler.Parser.parse(Parser.java:126)

org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)

org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)

org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

[2527 byte] By [jkurywchaka] at [2007-10-2 21:32:56]
# 1
What version of Java are you running with Tomcat? Needs Java 5.0 minimum (or Java1.4 + compatibility)Can you post your tld file?Do you have a TagExtraInfo class defined?
evnafetsa at 2007-7-14 0:46:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Using Java 1.5. This code is from a book example, and I tried emailing the company, but haven't heard anything.

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE taglib

PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"

"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

<taglib>

<tlibversion>1.0</tlibversion>

<jspversion>1.2</jspversion>

<shortname></shortname>

<info>The tag library for the murach applications</info>

<tag>

<name>today</name>

<tagclass>tags.SimpleDateTag</tagclass>

<info>Returns the current date</info>

</tag>

<tag>

<name>time</name>

<tagclass>tags.CurrentTimeTag</tagclass>

</tag>

<tag>

<name>checkfield</name>

<tagclass>tags.AttributeRequiredTag</tagclass>

<bodycontent>empty</bodycontent>

<attribute>

<name>color</name>

<required>false</required>

</attribute>

<attribute>

<name>field</name>

<required>true</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

<tag>

<name>weekday</name>

<tagclass>tags.BodyWeekdayTag</tagclass>

<bodycontent>JSP</bodycontent>

</tag>

<tag>

<name>products</name>

<tagclass>tags.ProductsTag</tagclass>

<teiclass>tags.ProductsTEI</teiclass>

<bodycontent>JSP</bodycontent>

</tag>

</taglib>

This is the SimpleDateTag class, which is being referenced.

package tags;

import javax.servlet.jsp.*;

import javax.servlet.jsp.tagext.*;

import java.io.*;

import java.util.*;

import java.text.DateFormat;

public class SimpleDateTag extends TagSupport{

public int doStartTag() throws JspException{

Calendar calDate = new GregorianCalendar();

Date now = calDate.getTime();

DateFormat shortDate = DateFormat.getDateInstance(DateFormat.SHORT);

String today = shortDate.format(now);

try {

JspWriter out = pageContext.getOut();

out.print("The current date is " + today + ".");

}

catch (IOException ioe){

System.out.println("SimpleDateTag IOException: " + ioe);

}

return SKIP_BODY;

}

}

jkurywchaka at 2007-7-14 0:46:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

hmmmmmmm.

Well I can kindof see what is going on. But I'm not exactly sure WHY.

Take a look at the [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagInfo.html] TagExtraInfo [/url] class in J2EE1.4

Note that the third constructor for this class was added with J2EE1.4 (to be compatible with JSP2.0 format of TLD)

According to your error message, the code is being generated to call this constructor (the signature matches)

The code fails to compile with a "NoSuchMethodError" error.

It seems to be finding a version of the class without this method in it.

The correct version should be in jsp-api.jar in the [TOMCAT]/common/lib/ directory.

Now the tld is using the version 1.1dtd

That seems to be from J2EE1.2 http://java.sun.com/j2ee/dtds/

Reading the TagExtraInfo API literally it intimates that the three constructors are for the three different versions of the DTD. So if you declare the tld as version 1.1, it should call the first constructor not the third one. I'm not sure if that is true or not.

In any case, it is trying to call the third one and not finding it.

I would hazard a guess that you have an old version of servlet-api.jar and/or jsp-api.jar sitting somewhere it shouldn't be - in your WEB-INF/lib directory perhaps? Maybe j2ee.jar? If so delete them, restart and try again.

Hope this helps,

let us know how it goes.

Cheers,

evnafets

evnafetsa at 2007-7-14 0:46:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I am using the most current jsp-api.jar in the folder you suggest. I also tried to use a more updated DTD (1.2) and that didn't work.I don't have any other j2ee.jar files being used. I am also at a lost.Thanks for your help.
jkurywchaka at 2007-7-14 0:46:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Did you resolve this issue?I have the same error with Apache Tomcat/5.5.17
sundev06a at 2007-7-14 0:46:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...