RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1744 | Replies: 6
Reply
Join Date: Jul 2007
Posts: 4
Reputation: chandan_mishra is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chandan_mishra chandan_mishra is offline Offline
Newbie Poster

problem encountered while running a jsp on tomcat 5.5

  #1  
Jul 21st, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,054
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 372
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: problem encountered while running a jsp on tomcat 5.5

  #2  
Jul 22nd, 2007
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.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Jul 2007
Posts: 4
Reputation: chandan_mishra is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chandan_mishra chandan_mishra is offline Offline
Newbie Poster

Re: problem encountered while running a jsp on tomcat 5.5

  #3  
Jul 23rd, 2007
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.
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,054
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 372
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: problem encountered while running a jsp on tomcat 5.5

  #4  
Jul 23rd, 2007
> 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 don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Jul 2007
Posts: 4
Reputation: chandan_mishra is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chandan_mishra chandan_mishra is offline Offline
Newbie Poster

Re: problem encountered while running a jsp on tomcat 5.5

  #5  
Jul 23rd, 2007
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
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,054
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 372
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: problem encountered while running a jsp on tomcat 5.5

  #6  
Jul 23rd, 2007
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.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Jul 2007
Posts: 4
Reputation: chandan_mishra is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chandan_mishra chandan_mishra is offline Offline
Newbie Poster

Re: problem encountered while running a jsp on tomcat 5.5

  #7  
Jul 26th, 2007
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:11 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC