HTTP Status 500 – Internal Server Error
Type Exception Report
Message An exception occurred processing [/se2/sample/photo_uploader/file_uploader.jsp] at line [26]
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: An exception occurred processing [/se2/sample/photo_uploader/file_uploader.jsp] at line [26]
23: if (ServletFileUpload.isMultipartContent(request)){
24: ServletFileUpload uploadHandler = new ServletFileUpload(new DiskFileItemFactory());
25: uploadHandler.setHeaderEncoding("UTF-8");
26: List<FileItem> items = uploadHandler.parseRequest(request);
27:
28: out.println("request :::" + items.size());
29:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:613)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:495)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Root Cause
javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: org/apache/commons/io/output/DeferredFileOutputStream : Unsupported major.minor version 52.0 (unable to load class org.apache.commons.io.output.DeferredFileOutputStream)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845)
org.apache.jsp.se2.sample.photo_005fuploader.file_005fuploader_jsp._jspService(file_005fuploader_jsp.java:237)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:472)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Root Cause
java.lang.UnsupportedClassVersionError: org/apache/commons/io/output/DeferredFileOutputStream : Unsupported major.minor version 52.0 (unable to load class org.apache.commons.io.output.DeferredFileOutputStream)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3255)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1420)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1924)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1798)
org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:179)
org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
org.apache.jsp.se2.sample.photo_005fuploader.file_005fuploader_jsp._jspService(file_005fuploader_jsp.java:118)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:472)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/7.0.96
java 1.6을 기반으로 한 프로젝트를 리뉴얼하고 있습니다.
에러 부분은 SmartEditor2를 이용한 사진업로드에서 에러가 발생하고 있는 부분입니다.
문제 : 자바 버전이 맞지 않으면서 JSP의 System.out.print 조차 콘솔에 찍히지 않는 상황.
원인 : 사진업로드는 common-io.jar의 버전이 맞지 않은게 원인.
해결 : common-io.jar 를 프로젝트 컴파일 버전을 맞춰서 library에 넣어줘야함.
나는 common-io.2.5.jar로 넣어줬더니 해결됨.
(여기서 다운받으면 됨, https://archive.apache.org/dist/commons/io/binaries/ )
참고로 major.minor version 52.0 에러는 자바 1.8 컴파일에 대한 에러이다.
ps.
1차는 common-io.jar이 없었으며, 2차로는 프로젝트가 자바 1.6으로 셋팅된 프로젝트인데 계속 common-io-2.8.jar(자바1.8용)을 넣고 컴파일하려고 하니깐 버전이 안맞는다고 뜨는것이었음.
자바 환경설정때문에 문제인 줄 알았는데, 그냥 라이브러리가 안맞는거였음...
스트럿츠를 기반으로 하다보니 라이브러리를 하나하나 다 넣어줘야하기때문에 이런 그지같은 곳에서 시간낭비를 해버렸다...
하아..................쉬부럴....
자바 1.6............쉬...쉬....쉬..펄..............................개싫다...