Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to read TLD when accessing a JSP

 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should remove the web.xml entires entirely and let Tomcat auto-discover the TLDs.
 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat will search through the jars in its classpath looking for TLD files that match a given URI.
 
Cindy Jones
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic