티스토리 뷰

jsp 파일중에 65535 byte가 넘는 큰 파일들이 있다. 이 파일들을 읽으려고 할때 설정이 없으면 오류가 발생한다. 

org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [100] in the generated java file: [big_jsp.java]
The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

대략 이런 오류이다.

소스의 길이가 엄청 길다는 말이다. 

 

이것을 본적으로 해결하려면 하나의 큰 jsp 파일을 include를 통해서 여러개로 쪼개야 한다

 

하지만 상황이 여의치 않다면 큰 jsp 파일을 그대로 유지한 채 설정값을 변경하여 해결할 수 있다. 

 

springboot를 사용중이라면 application.yml 파일에 다음과 같이 mappedfile 설정을 추가해주자. 

server:
servlet:
jsp:
init-parameters:
mappedfile: false

 

springboot가 아닌 그냥 tomcat을 사용하고 있다면 tomcat의 web.xml 에서 mappedfile 설정을 추가해주자. 

tomcat의 web.xml

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>mappedfile</param-name>
<param-value>false</param-value>
</init-param>
</servlet>

 

끝!

댓글
최근에 올라온 글
최근에 달린 댓글
«   2025/04   »
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