The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this app

20,506

Solution 1

You need to add the jstl tag library to the WEB-INF/lib folder. if you don't have one you make the lib folder.

More on jstl here

Also add it to your maven dependencies

Solution 2

You need to add the jstl tag library to the WEB-INF/lib folder. if you don't have one you make the lib folder. Download JAR from https://mvnrepository.com/artifact/javax.servlet/jstl/1.2

Adding Maven Dependency Does Not Work.

Share:
20,506
Admin
Author by

Admin

Updated on October 14, 2020

Comments

  • Admin
    Admin over 3 years

    I have problem with this error in spring mvc

    I saw similar issues, but a wonderful thing is that i have not any lib folder under WEB-INF !

    I am using jdk 1.7 and netbeans7 and maven.

    Here is my project structure:

    enter image description here

    This is pom.xml :

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>com.sajjad</groupId>
        <artifactId>OnlineBookStore2</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>war</packaging>
    
        <name>OnlineBookStore2</name>
    
        <properties>
            <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>org-apache-commons-logging</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>cglib-2.2</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-aop-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-aspects-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-beans-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-build-src-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-context-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-context-support-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-core-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-expression-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-framework-bom-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-instrument-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-instrument-tomcat-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-jdbc-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-jms-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-messaging-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-orm-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-oxm-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-test-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-tx-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-web-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-webmvc-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-webmvc-portlet-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>spring-websocket-4.0.1.RELEASE</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>4.3.1.Final</version>
            </dependency>
            <dependency>
                <groupId>unknown.binary</groupId>
                <artifactId>hibernate-jpa-2.1-api-1.0.0.Final</artifactId>
                <version>SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-web-api</artifactId>
                <version>6.0</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                        <compilerArguments>
                            <endorseddirs>${endorsed.dir}</endorseddirs>
                        </compilerArguments>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.1</version>
                    <executions>
                        <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>copy</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${endorsed.dir}</outputDirectory>
                                <silent>true</silent>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>javax</groupId>
                                        <artifactId>javaee-endorsed-api</artifactId>
                                        <version>6.0</version>
                                        <type>jar</type>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
        <repositories>
            <repository>
                <id>unknown-jars-temp-repo</id>
                <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
                <url>file:${project.basedir}/lib</url>
            </repository>
        </repositories>
    </project>
    

    And this is my web.xml :

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/applicationContext.xml</param-value>
        </context-param>
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <servlet>
            <servlet-name>dispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>2</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>dispatcher</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    </web-app>
    

    And this is my dispatcher-servlet.xml:

    <?xml version='1.0' encoding='UTF-8' ?>
    <beans xsi:schemaLocation="http://www.springframework.org/schema/beans
                              http://www.springframework.org/schema/beans/spring-beans.xsd
                              http://www.springframework.org/schema/context
                              http://www.springframework.org/schema/context/spring-context.xsd
                              http://www.springframework.org/schema/mvc
                              http://www.springframework.org/schema/mvc/spring-mvc.xsd"
           xmlns:mvc="http://www.springframework.org/schema/mvc"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns="http://www.springframework.org/schema/beans"> 
    
        <context:component-scan base-package="sajjad.htlo"/> 
        <mvc:annotation-driven/>
    
        <mvc:resources mapping="/resources/**" location="/resources/pics/" />
        <mvc:default-servlet-handler/>
    
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="viewResolver">
            <property name="prefix"> 
                <value>/WEB-INF/jsp/</value> 
            </property> 
            <property name="suffix"> 
                <value>.jsp</value> 
            </property> 
        </bean>
    </beans>
    

    My controller class:

    @Controller
    public class IndexController {
        @RequestMapping(value = "/index.html")
        public ModelAndView indexPage() {
            return new ModelAndView("index");
        }
    }
    

    My view jsp file:

    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Welcome</title>
        </head>
        <body>
            this is index page
            <img src="resources/pics/t3.jpg" />
        </body>
    </html>
    

    When i try : http://localhost:8080/OnlineBookStore2/index.html This error happens:

    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
    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:56)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
    ...
    

    I am going to access image from jsp file.

    UPDATE

    I created lib folder under WEB-INF and put jstl-1.2.jar on it, as you can see in the picture:

    enter image description here

    But i have the same problem yet.