![]() |
![]() |
||||
This page shows errors where an org.apache.jasper.JasperException exception is thrown and how to fix them.
Table of Contents
exception org.apache.jasper.JasperException: The absolute uri: http://someURI cannot be resolved in either web.xml or the jar files deployed with this application at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114) at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316) at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:147) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552) at org.apache.jasper.compiler.Parser.parse(Parser.java:126) ...
A taglib line in a JSP file referenced the URI specified in the error above, but no TLD file has this <uri> defined.
The <uri> in the TLD file is the main reference for matching JSP declarations with the correct TLD. When automatically finding TLD files, the container matches the uri attribute in your JSP taglib declaration with the <uri> tag in the TLD file. Ensure this is always unique to avoid clashes.
Example:
This declaration in your JSP file ... <%@ taglib prefix="mytags" uri="http://metawerx.net/taglibs/mytags" %> Will match this element in your TLD file ... <uri>http://metawerx.net/taglibs/mytags</uri>
org.apache.jasper.JasperException: File "/WEB-INF/jsp/test.tld" not found at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114) at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:159) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552) at org.apache.jasper.compiler.Parser.parse(Parser.java:126) ...
This happens when the TLD file has been moved or renamed, and the application hasn't been restarted.
The container found the TLD file the first time it was used, and has remembered the location of it. Each time the tag is declared in a JSP file that hasn't already been compiled, Tomcat (or the JSP 2.0 container) checks for an update to the TLD file. However, now the TLD file is missing.
The container is looking for it in a specific location, noted in the above exception.
If you have renamed or moved the TLD file, restart the application to force the container to refresh it's TLD location cache.
org.apache.jasper.JasperException: /file.jsp(15,0) No tag "someTagName" defined in tag library imported with prefix "somePrefix" at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:196) at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1317) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1573) at org.apache.jasper.compiler.Parser.parse(Parser.java:126) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100) ...
This happens if the tag you are trying to use is not defined in the TLD file. Check the spelling of the tag name in both locations.
This can also happen if multiple tag libraries have been defined with the same URI. Tomcat will use the first one it finds, and the other TLD file will be ignored. Surprisingly, no error is thrown when two TLD files define the same URI (in Tomcat 5.5.17 anyway).
Fix the problem, then restart the application.
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/someFile.tld at org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:253) at org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:224) at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:526) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:422) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552) at org.apache.jasper.compiler.Parser.parse(Parser.java:126) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211) ...
This error occurs when an old xerce.jar, xerces.jar or xercesImpl.jar file is in your WEB-INF/lib folder, in Tomcat 5.5 and above. These are causing a clash with the versions in Tomcat's own libraries folder.
Remove these jar files, then restart the application.
See Also: JAR files you should never include in your webapp
If the error also lists a line and column (line X, col Y), then see the "XML parsing error on file /WEB-INF/someFile.tld: (line X, col Y)" solution below.
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/someFile.tld: (line X, col Y) at org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:253) at org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:224) at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:526) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:422) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552) at org.apache.jasper.compiler.Parser.parse(Parser.java:126) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211) ...
This error occurs when a TLD file has a mismatched opening and closing tag. Check the specified TLD file, at the specified line and column. This error is the same as the one below which just says XML parsing error (instead of saying "Unable to initialize TldLocationsCache" before it), except it happens when the application is first starting.
Fix the problem, then restart the application.
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/someFile.tld: (line X, col Y) at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:453) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ...
This error occurs when a TLD file has a mismatched opening and closing tag. Check the specified TLD file, at the specified line and column. This error is the same as the one above which includes the text "Unable to initialize TldLocationsCache", except it usually indicates the TLD file has been modified since the application was first started (because the TLD is apparenly already cached).
Fix the problem, then restart the application.
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.struts.taglib.html.HtmlTag org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) ...
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/tld/c.tld: (line 5, col 117): General Schema Error: Can't get back Schema document's root element :http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd.
I am getting this exception can someone please help me solve this issue?
--AnonymousCoward, 07-Feb-2008
college essays