aspose file tools*
The moose likes JSP and the fly likes Unable to read TLD when accessing a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to read TLD when accessing a JSP" Watch "Unable to read TLD when accessing a JSP" New topic
Author

Unable to read TLD when accessing a JSP

James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
I have a JSP which is using two of the standard tag libraries.

I have the JSTL files standard.jar and jstl.jar in my web application's /WEB-INF/lib directory. Still it seems that the TLD being sought by Tomcat (META-INF/c.tld) isn't being read correctly, even though it is contained in the /WEB-INF/lib/standard.jar file. Here is the exception message I am getting when I try accessing the page:




Here is my JSP:




I have the following taglib entries in my web.xml:





Can anyone see what I have done wrong, or what else I need to do in order to have the TLD read correctly for the JSTL tags ?

I am using Tomcat 5.5.4.

Thanks in advance for any suggestions.


--James
M. Gagnon
Ranch Hand

Joined: Feb 18, 2004
Posts: 68
Looks like it's your entries in web.xml. They need to point to the tld files, not the .jar files. For example:

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tags/c.tld</taglib-location>
</taglib>

That's if your tld files are in a directory called "tags" under the WEB-INF directory. Some people call this directory "tld". Call it what you want, but the tld files have to exist and that's what you want in your web.xml entries for tag libraries.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

You should remove the web.xml entires entirely and let Tomcat auto-discover the TLDs.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
M. Gagnon
Ranch Hand

Joined: Feb 18, 2004
Posts: 68
Originally posted by Bear Bibeault:
You should remove the web.xml entires entirely and let Tomcat auto-discover the TLDs.


Oo, can I give that a try, too? Didn't know it was possible!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Tomcat will search through the jars in its classpath looking for TLD files that match a given URI.
Cindy Jones
Ranch Hand

Joined: Oct 08, 2002
Posts: 66
Hi,
Just check if ur JAVA_HOME points to jdk1.4 . The problem might have been caused cos u used jdk1.3 (I got the same error when I did that)
Thanks
Dhanya
Bal Mark
Greenhorn

Joined: Sep 27, 2002
Posts: 19
do NOT package javax.servlet.jsp.jar with your webapp, it confuses tomcat :P

We were getting the exact same error, removing javax.servlet.jsp.jar from the WEB-INF/lib sorted it
[ April 10, 2008: Message edited by: Balmark ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Balmark",
Please check your private messages.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to read TLD when accessing a JSP