• Post Reply Bookmark Topic Watch Topic
  • New Topic

standard JSP taglib directive causes traceback

 
Jim J Anderson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I was learning JSP about a year ago and had to put it on hold for my job. I was using the Java Server Pages, 3rd edition book examples. During that time, my old laptop crashed and I have installed topcat6 and the book jsp code on to the new laptop. Just about everything is running except one glitch. When I enter the following URL in my browser:

http://localhost:8080/ora/ch5/easy.jsl

I get a stack (abbreviated by me) trace:

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)

The offending line is a JSP directive:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

I looked at the .../ora/WEB-INF/lib directory and found the following jar files:

dom.jar jdbc2_0-stdext.jar jstl.jar orataglib_3_0.jar standard.jar xalan.jar
jaxp-api.jar jdom.jar oraclasses_3_0.jar sax.jar struts.jar xercesImpl.jar

I unzip the jar files and found a tdl file with the uri "http://java.sun.com/jsp/jstl/core" defined in it. It seems like the jsp should
be read without an error.

Are there any ideas on the cause of the problem?

Jim Anderson
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which container? Some seem to have difficulty following the specification.
 
Jim J Anderson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For tomcat6, the container servlet is Catalina.

Jim
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never known Tomcat to not correctly find a TLD. Are you sure that the WEB-INF/lib you are looking at is the one for the web app in question?

P.S. If you are using Tomcat 6, why are you not using JSTL 1.2? (the jar files you have appear to be for 1.1).
 
Jim J Anderson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The application jar files in ora/WEB-INF/lib are taken from the book I'm using which I guess is getting out of date.
I will look into updating the files. However, I would expect the current version of the container to be backward
compatible.

Am I positive that the WEB-INF/lib is correct for the application. I'm a newbie, but I'm as sure as I can be.
Using hard paths to illustrate, my application is in /var/lib/tomcat6/webapps/ora. So my context path for the
application should be 'ora'. When I am in the browser, I enter the URL 'http://localhost:8080/ora/ch5/easy.jsp,
so it should be picking up the file at /var/lib/tomcat6/webapps/ora/ch5/easy.jsp. I know it does, because when
I remove the JSP tablib directive from the file, the JSP runs as expected.

JIm
 
Jim J Anderson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I rechecked the information that I had looked at yesterday. Here are the details that I found.

In the /var/lib/tomcat6/webapps/ora/lib directory there is a jar file, standard.jar, that contains a c.tld. If I unzip the standard.jar file, there is a META-INF directory that contains the c.tld file.
Inside the c.tld file, is a uri tag that is set to "http://java.sun.com/jsp/jstl/core". which is the same uri that is identified in the failing jsp taglib directive statement.

So, it looks to me that uri in the JSP statement correctly refers to the correct uri in the TLD and the prefix, i.e. 'c' is correct.

Jim
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So yes, placing the jars in ora/WEB-INF/lib is all that you should need to do.

Is your web.xml correctly declaring the web app as a Servlets 2.5 web application?
 
Jim J Anderson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked the web.xml file and no, the servlets version is 2.4. Here are the lines:

<web-app 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
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">


I can see that version should be version="2.5". Do I also change "http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
to "http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"?

I looked for some documentation on the web.xml file on the internet, but I did not find much that helped me with regard
to the servlet version. Do you have an reading references that might be appropriate?


Jim
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either 2.4 or 2.5 should work -- the problem comes when defining the web app as 2.3.

Hmmm.... I'm rather out of ideas. I've never heard of such issues with Tomcat 5 and beyond.

Grasping at straws...

You could try standing up another skeleton web app that does nothing but one JSP page with JSTL to see if that works. If it does it's clearly an app config issue.

You haven't mucked around with Tomcat itself, have you? (removing system jar files or such, diddling with server.xml, etc...)
 
Jim J Anderson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

No, I have not mucked with tomcat at all! - I wouldn't dare do that yet.

I had similar thoughts to you. I want to reduce the case to the simplest case possible. Along the way
I may be able to get the 'simple application' running. If not, I may submit a bug report.

Thank you much for all the suggestions. If I find out what the problem is, I will post here.

Jim
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do. It's vexing that something that should be so easy is giving you such fits.
 
Jim J Anderson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I submitted thisproblem to the Jasper support group. They looked at my test case and it ran ok for them. I then
decided to uninstall tomcat, which had been downloaded and installed by adept, the package manager.
I reinstalled by downloading and installing from a tarball. Everything ran ok. Something was wrong
with my installation.

Thank you again for all the help.

Jim
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whew! Just glad that you got it straightened out! Thanks for reporting back.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!