•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,913 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,721 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1435 | Replies: 6
![]() |
•
•
Join Date: Jul 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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
Thanks
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
Thanks
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.
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
•
•
Join Date: Jul 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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.
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.
I meant post the contents of those files here.
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
•
•
Join Date: Jul 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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"
pageEncoding="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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<ctl:Greet />
</body>
</html>
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">
<tlib-version>1.0</tlib-version>
<short-name>ctl</short-name>
<uri></uri>
<tag>
<name>Greet</name>
<tag-class>demo.tags.Greeter</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>
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
Anyways here goes
the jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<ctl:Greet />
</body>
</html>
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">
<tlib-version>1.0</tlib-version>
<short-name>ctl</short-name>
<uri></uri>
<tag>
<name>Greet</name>
<tag-class>demo.tags.Greeter</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>
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.
If you are still getting errors paste the XML file.
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
•
•
Join Date: Jul 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
- how to use jsp and tomcat (JSP)
- execute jsp in tomcat (JSP)
Other Threads in the JSP Forum
- Previous Thread: How to run iReport jrxml from a jsp page
- Next Thread: date comparison



Linear Mode