首页  »   Web开发

KindEditor上传文件出错,HTTP Status 500 - Unable to compile class for JSP:该如何处理

网友分享于:2015-10-13  浏览:0次
KindEditor上传文件出错,HTTP Status 500 - Unable to compile class for JSP:
有没有人在使用KindEditor的上传功能时遇到下面这样的问题。
HTTP Status 500 - Unable to compile class for JSP:

type Exception report

message Unable to compile class for JSP:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 124 in the jsp file: /editor_plugins/jsp/upload_json.jsp
JSONObject cannot be resolved to a type
121: %>
122: <%!
123:  private String getError(String message) {
124:  JSONObject obj = new JSONObject();
125:  obj.put("error", 1);
126:  obj.put("message", message);
127:  return obj.toJSONString();


An error occurred at line: 124 in the jsp file: /editor_plugins/jsp/upload_json.jsp
JSONObject cannot be resolved to a type
121: %>
122: <%!
123:  private String getError(String message) {
124:  JSONObject obj = new JSONObject();
125:  obj.put("error", 1);
126:  obj.put("message", message);
127:  return obj.toJSONString();


An error occurred at line: 39 in the jsp file: /editor_plugins/jsp/upload_json.jsp
ServletFileUpload cannot be resolved
36: 
37:  response.setContentType("text/html; charset=UTF-8");
38: 
39:  if (!ServletFileUpload.isMultipartContent(request)) {
40:  out.println(getError("乱码。。。"));
41:  return;
42:  }


An error occurred at line: 79 in the jsp file: /editor_plugins/jsp/upload_json.jsp
FileItemFactory cannot be resolved to a type
76:  dirFile.mkdirs();
77:  }
78: 
79:  FileItemFactory factory = new DiskFileItemFactory();
80:  ServletFileUpload upload = new ServletFileUpload(factory);
81:  upload.setHeaderEncoding("UTF-8");
82:  List items = upload.parseRequest(request);


An error occurred at line: 79 in the jsp file: /editor_plugins/jsp/upload_json.jsp
DiskFileItemFactory cannot be resolved to a type
76:  dirFile.mkdirs();
77:  }
78: 
79:  FileItemFactory factory = new DiskFileItemFactory();
80:  ServletFileUpload upload = new ServletFileUpload(factory);
81:  upload.setHeaderEncoding("UTF-8");
82:  List items = upload.parseRequest(request);


An error occurred at line: 80 in the jsp file: /editor_plugins/jsp/upload_json.jsp
ServletFileUpload cannot be resolved to a type
77:  }
78: 
79:  FileItemFactory factory = new DiskFileItemFactory();
80:  ServletFileUpload upload = new ServletFileUpload(factory);
81:  upload.setHeaderEncoding("UTF-8");
82:  List items = upload.parseRequest(request);
83:  Iterator itr = items.iterator();


An error occurred at line: 80 in the jsp file: /editor_plugins/jsp/upload_json.jsp
ServletFileUpload cannot be resolved to a type
77:  }
78: 
79:  FileItemFactory factory = new DiskFileItemFactory();
80:  ServletFileUpload upload = new ServletFileUpload(factory);
81:  upload.setHeaderEncoding("UTF-8");
82:  List items = upload.parseRequest(request);
83:  Iterator itr = items.iterator();


An error occurred at line: 85 in the jsp file: /editor_plugins/jsp/upload_json.jsp
FileItem cannot be resolved to a type
82:  List items = upload.parseRequest(request);
83:  Iterator itr = items.iterator();
84:  while (itr.hasNext()) {
85:  FileItem item = (FileItem) itr.next();
86:  String fileName = item.getName();
87:  long fileSize = item.getSize();
88:  if (!item.isFormField()) {


An error occurred at line: 85 in the jsp file: /editor_plugins/jsp/upload_json.jsp
FileItem cannot be resolved to a type
82:  List items = upload.parseRequest(request);
83:  Iterator itr = items.iterator();
84:  while (itr.hasNext()) {
85:  FileItem item = (FileItem) itr.next();
86:  String fileName = item.getName();
87:  long fileSize = item.getSize();
88:  if (!item.isFormField()) {


An error occurred at line: 115 in the jsp file: /editor_plugins/jsp/upload_json.jsp
JSONObject cannot be resolved to a type
112:  return;
113:  }
114: 
115:  JSONObject obj = new JSONObject();
116:  obj.put("error", 0);
117:  obj.put("url", saveUrl + newFileName);
118:  out.println(obj.toJSONString());


An error occurred at line: 115 in the jsp file: /editor_plugins/jsp/upload_json.jsp
JSONObject cannot be resolved to a type
112:  return;
113:  }
114: 
115:  JSONObject obj = new JSONObject();
116:  obj.put("error", 0);
117:  obj.put("url", saveUrl + newFileName);
118:  out.println(obj.toJSONString());


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.

Apache Tomcat/7.0.47

------解决思路----------------------
你没有阅读jsp文件夹下的README.txt文件

使用方法:

1. 解压zip文件,将所有文件复制到Tomcat的webapps/kindeditor目录下。

2. 将kindeditor/jsp/lib目录下的3个jar文件复制到Tomcat的lib目录下,并重新启动Tomcat。
* commons-fileupload-1.2.1.jar
* commons-io-1.4.jar
* json_simple-1.1.jar

3. 打开浏览器,输入http://localhost:[P0RT]/kindeditor/jsp/demo.jsp。

------解决思路----------------------
引用:
你的也是这个问题吗?

看一下jsp文件夹下的README.txt文件,看看对应的jar包有没有导入,还有对应的上传路径有没有设置正确!


请问你具体是怎么操作的?

相关解决方案

最新解决方案