944,198 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 2959
  • JSP RSS
Jul 21st, 2007
0

problem encountered while running a jsp on tomcat 5.5

Expand Post »
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/StringLjava/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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chandan_mishra is offline Offline
4 posts
since Jul 2007
Jul 22nd, 2007
0

Re: problem encountered while running a jsp on tomcat 5.5

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.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Jul 23rd, 2007
0

Re: problem encountered while running a jsp on tomcat 5.5

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chandan_mishra is offline Offline
4 posts
since Jul 2007
Jul 23rd, 2007
0

Re: problem encountered while running a jsp on tomcat 5.5

> 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.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Jul 23rd, 2007
0

Re: problem encountered while running a jsp on tomcat 5.5

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chandan_mishra is offline Offline
4 posts
since Jul 2007
Jul 23rd, 2007
0

Re: problem encountered while running a jsp on tomcat 5.5

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.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Jul 26th, 2007
0

Re: problem encountered while running a jsp on tomcat 5.5

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chandan_mishra is offline Offline
4 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: How to run iReport jrxml from a jsp page
Next Thread in JSP Forum Timeline: date comparison





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC