Monday, July 2, 2012

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved

While running a test jsp, getting following exception.

Jul 2, 2012 4:41:41 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:149)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:450)


Following is the JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<c:out value="Hello World"></c:out>
</body>
</html>



2 comments:

  1. Found the Resolution for this:

    Add the uri in the webapp tag in web.xml as follows:

    <web-app
    ...
    xmlns:c="http://java.sun.com/jstl/core"
    ..
    version="2.5" >

    Please note servlet version 2.5, it is compatible with jstl1.2 jar. We need to add this jar in WEB-INF/lib directory.

    I downloaded the jstl1.2. jar from the following site.
    http://repo1.maven.org/maven2/javax/servlet/jstl/1.2/jstl-1.2.jar

    Build the application and hit the page again. The Test page works fine this time.

    ReplyDelete
  2. Another variant of this Exception generally encountered is as follows. It has the same resolution as mentioned above, just the taglib uri is different.

    Jul 2, 2012 4:41:41 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    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
    at

    ReplyDelete