954,224 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem encountered while running a jsp on tomcat 5.5

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

chandan_mishra
Newbie Poster
4 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733
 

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. :)

chandan_mishra
Newbie Poster
4 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

> 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. :)

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733
 
chandan_mishra
Newbie Poster
4 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733
 

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.

chandan_mishra
Newbie Poster
4 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You