When ever I try to run my jsp page on a tomcat 5.5 server I get the following exception
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getResourcePaths(Ljava/lang/String;)Ljava/util/Set;
at org.apache.jasper.compiler.TldLocationsCache.processTldsInFileSystem(TldLocationsCache.java:424)
at org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:250)
at org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:224)
at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:526)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:422)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
at org.apache.jasper.compiler.Parser.parse(Parser.java:126)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)

I have pinpointed the cause of the exception
Its due a <%@ taglib prefix="..." uri="..."%> declaration I have used in my page.
If I use this declaration the jsp compilation fails.
I suppose the xhtml tree of the page doesnot get parsed somehow and throws this exception.

Please advice

9 Years
Discussion Span
Last Post by chandan_mishra

Have you made the entry for your custom tag classes in the taglib.tld file? If yes, paste the JSP file along with the taglib.tld file.


1. Yep, the declaration of the tag is proper in the tld file.

2. Shouldnt the tld file be ideally kept in the WEB-INF folder? I have kept it there in a folder called tlds. I am directly referencing the tld file from my jsp page as uri ="/WEB-INF/tlds/....tld". (hence mapping in the web.xml is not required)

3. I will ofcourse try and put the jsp and tld together as you say and let you know the outcome.

Thanx for the reply, appreciate it. :)


> I will ofcourse try and put the jsp and tld together as you say and let you know the outcome.
I meant post the contents of those files here. :)


he he sorry for dat. New to forums mate I hope you you took no offence.
Anyways here goes

the jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@ taglib uri="/WEB-INF/tlds/customTags.tld" prefix="ctl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<ctl:Greet />

the tld:

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" 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">




This is just code has nothing in it really, but this gives me the exception.

Anyways please do advice.

The container I use is tomcat 5.5 and the common/lib has the jsp-api.jar


The URI you specify in your TLD file should be distinct and non empty. The URI used by your JSP file has got nothing to do with the absolute path of your TLD file. Just provide a arbitrary URI string like "http://yourname.com" in the taglib file and use the same in the JSP file.

If you are still getting errors paste the XML file.


The uri is not a required field in the tld right, and we can actually refer to the tld in the taglib directive (in the jsp page) by its relative path or from the context root '/' . I just have another thing to report to you on this, the problem I have is not reproducible. I went into work the day after, and created a custom tag. that works fine. I suppose this is out and out a verison issue or I am missing some jars in my classpath. What do you think . Please can you check the exception and tell me if there is something that we have missed out on, coz I could get nothing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.