티스토리 뷰

Spring Security tag를 사용하다 보면 이런 오류가 발생하는것을 볼 수 있다. 

[ERROR][o.a.c.c.C.[.[.[.[dispatcherServlet].log:line175] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/jsp/common/layout.jsp'.] with root cause
org.apache.jasper.JasperException: /WEB-INF/jsp/common/layout.jsp (line: [6], column: [0]) The absolute uri: [http://www.springframework.org/security/tags] cannot be resolved in either web.xml or the jar files deployed with this application
	at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:292)
	

 

위에서 오류가 발생한 layout.jsp 에는 어떤 내용이 들어있는지 보자. 

<%@taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

위에서 문제로 지적하는 security/tags 가 정상적으로 작동하지 않는것이다. 작동하지 않는 이유는 여러가지가 있겠지만 가장 빈번한건 역시 dependency를 빼먹은것이다. 

 

다음과 같이 spring-security-taglibs dependency를 pom.xml에 추가해주자. 

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-taglibs</artifactId>
    <version>${springsecurity.version}</version>
</dependency>

물론 springsecurity.version 에 해당하는 부분은 본인의 spring security version에 맞게 입력하도록 하자. 

 

끝!

댓글
최근에 올라온 글
최근에 달린 댓글
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31