2022. 11. 15. 17:27ㆍERROR
톰캣 서버를 띄우고 jsp 페이지와 매핑된 url을 입력하니 아래와 같은 에러가 발생했다.
절대 URI인 [http://java.sun.com/jsp/jstl/core]을(를), web.xml 또는 이 애플리케이션과 함께 배치된 JAR 파일 내에서 찾을 수 없습니다.
작성한 jsp 페이지에서는 최상단에 jstl의 태그를 등록한 상태다.
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>KDT Spring App</h1>
<p>the time on the server is <%= request.getAttribute("serverTime")%></p>
</body>
</html>
이 jstl(태그 라이브러리)를 사용하기 위해서는 jstl.jar, taglibs.jar 두개의 라이브러리가 필요하다.
따라서 pom.xml에 두개의 dependency를 등록하였는데
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
동일한 500에러가 발생한다.
이럴 경우 위의 라이브러리를 /WEB-INF/lib 디렉토리에 추가해야 한다고 하길래(디렉토리가 없어서 생성했다)
냉큼 따라했더니 다행히 해결되었다.
라이브러리는 아래 링크에서 받았다.
https://tomcat.apache.org/download-taglibs.cgi
Apache Tomcat® - Apache Taglibs Downloads
Welcome to the Apache Taglibs download page. This page provides download links for obtaining the latest version of the Apache Standard Taglib, as well as links to the archives of older releases. You must verify the integrity of the downloaded files. We pro
tomcat.apache.org
참고한 링크
묻고 답하기 | 표준프레임워크 포털 eGovFrame
처리중입니다. 잠시만 기다려주십시오.
www.egovframe.go.kr
추가한 두 개의 라이브러리에는 jstl 중 core의 태그들을 포함하고 있지 않다는 것을 확인했다.
c:forEach에서 Looptag가 없다는 에러가 발생했기 때문이다.
https://stackoverflow.com/questions/12693969/jstl-error-javax-servlet-jsp-jstl-core-looptag-error-when-using-cforeach-tomcat
JSTL error javax/servlet/jsp/jstl/core/LoopTag error when using c:forEach tomcat ver7.0
Hi using eclipse juno, dynamic web project apache Tomcat v7.0 (which has its own jstl-1.2.1.jar) I get this error javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/js...
stackoverflow.com
따라서 jstl-1.2.jar를 추가로 다운로드 한 뒤 같은 디렉토리인 WEB-INF의 lib에 추가해주어서 해결했다.
jar 다운로드 링크
https://mvnrepository.com/artifact/javax.servlet/jstl/1.2
'ERROR' 카테고리의 다른 글
RestDocs - ClassCastException (0) | 2022.12.16 |
---|---|
RestDocs - include file not found (0) | 2022.12.16 |
Error injecting constructor, java.lang.NoSuchMethodError와 spring-boot-maven-plugin not found (0) | 2022.10.31 |
MySQL WorkBench: could not acquire management access for administration (0) | 2022.07.13 |
JPA 에러: save the transient instance before flushing (0) | 2022.06.07 |