I encountered the
org.apache.jasper.JasperException while running code discussed in Section 5.4.2 in
this textbook. I encounter this exception whenever I insert the following JSP taglib reference/statement in one of the JSPs in a web application, in order to use Spring's Form Tag Library:
The application runs well, until I insert this JSP taglib reference/statement in one of the JSPs in the application. After inserting this JSP taglib reference/statement in one of the JSPs in the application and the application starts, I obtain the
org.apache.jasper.JasperException when I try to access (in a browser) one of the Spring controllers that are implemented in the application. The occurence of this exception is also accompanied by my obtaining an
Internal Server Error, status=500.
The following is the exception notice that is at the top of the stack trace of exceptions notices reported by the compiler:
org.apache.jasper.JasperException: The absolute uri: [https://www.springframework.org/tags/form] cannot be resolved in either web.xml or the jar files deployed with this application.
Since the entire stack trace of exceptions notices is quite long indeed, I have deferred furnishing the entire thread of these exceptions notices until someone feels that this information will assist in placing a finger on the cause of this exception.
My understanding is that this exception is thrown due to one of different possible reasons, namely:
(1.) The JAR file named
spring-webmvc-<version>.jar either (A) Is not in the class path for the application (B) The dependency for the JAR file has not been added in the project's POM file or (C) The JAR file is not in the WEB-INF/lib directory of the web application.
(2.) There is a mismatch between the Servlet version in the Tomcat servlet engine and the version of JSTL used in the application.
As per the first possible cause of this problem, be advised that I have the
spring-webmvc-5.2.6.RELEASE.jar in the external libraries folder of my project and it appears like Maven has also added this dependency to the application while building the application.
As per the second possible cause of this problem, be advised that the project, which I am working on, is a Maven archetype project that uses an embedded Tomcat version 9.0.35 as well as uses JSTL version 1.2 dependency in the project's POM file.
In any case, the exception notice suggests that the
https://www.springframework.org/tags/form URI cannot be resolved in the jar files deployed with my application, even though the
spring-form.tld file in the
spring-webmvc-5.2.6.RELEASE.jar file specifies that this is the correct URI to use.
Another suggestion that I have received for the occurence of this exception is that the TLD files are not in the classpath. However, kindly be advised that (1) The files
spring.tld and
spring-form.tld are both in the
spring-webmvc-5.2.6.RELEASE.jar archive file and (2) I have this
spring-webmvc-5.2.6.RELEASE.jar archive file in the external libraries folder of my project (I can provide screenshots, if this will help).
My understanding is that a JAR file does not need to be placed in the classpath when a project build tool (like Maven) does either or even both of the following with the JAR file: (1) The project build tool adds the JAR file to the external libraries folder of a project and/or (2) The project build tool adds the JAR file as a dependency to the application while building the application (my understanding is that Maven accomplishes both of these steps by the programmer adding the appropriate dependency element in the project's POM file).
I am looking forward to obtaining assistance with resolving this problem issue.