• Post Reply Bookmark Topic Watch Topic
  • New Topic

JasperException: The absolute uri cannot be resolved

 
Christopher Button
Greenhorn
Posts: 14
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dread somewhat having to open a thread for this, as both StockOverflow and Coderanch have had past discussions around this. Having scoured the net for answers and spent about five hours trying to troubleshoot, I'm still stumped. I am using Maven and trying to run a very simple web application containing three text boxes and a submit button which validates the parameters and redirects to a success page if valid.

When attempting to run the relevant JSP on the Tomcat 8 server (having done it successfully many times), I am confronted with this:

HTTP Status 500 - 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

Almost all of the aforementioned discussion threads on this topic have advised adding jstl 1.2 as a dependency to pom.xml. Given the error, that seems to make sense, however I have already done this. Everything is also declared correctly and has compiled successfully in the past.

pom.xml

JSP

Maven project structure



The error

I suspect this will end up being another one of those things that "don't work until they do"; I've probably learned and retained most of what I know so far about JEE thanks to the hours spent debugging!
 
Christopher Button
Greenhorn
Posts: 14
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I realise now this is related to my web.xml; the web app only works if the web.xml contains a DOCTYPE declaration instead of an XML schema. I would love to know why.

My old web.xml:


However, once I change web.xml to the following, I get the JasperException:



Any idea why a current web.xml format, which is made with the latest versions of Eclipse and Maven, would cause the project to go haywire?
 
Christopher Button
Greenhorn
Posts: 14
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UPDATE: SOLUTION FOUND

I finally came upon the solution. By default, for some reason (and I'd like to know why), Maven generates a Dynamic Web Module as version 2.3. DTD was of course the standard for Servlet 2.3 and was probably unable to parse or evaluate my XML-based deployment descriptor.

Solution:

Right-click on your Maven project and select **Properties**

Navigate to Project Facets and untick **Dynamic Web Module**. Apply changes.

From the version drop-down box, select the latest version (as of writing, this is 3.1). Apply changes.

Right-click on your Maven project and select **Maven** -> **Update Project**.

Your project should now be able to correctly interpret a web.xml with an XSD declaration.
 
Paul Clapham
Sheriff
Posts: 21876
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks like it could be useful for some other unfortunate. Thanks so much for posting that and have a cow!
 
Christopher Button
Greenhorn
Posts: 14
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem, not quite worth the gray hairs, but progress is progress!

Thanks for the cow (at first I thought you were telling me to...have a cow)

One other point to note, which should be mentioned: I'm still not 100% clear as to why changing web.xml to XSD caused the JasperException with respect to JSTL, though I think it has something to do with JSTL being integrated with JSP at some point after Servlet 2.3.

For a more in-depth discussion around the JSTL integration with JSP:
http://stackoverflow.com/a/4928309/2879303
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!