org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jboss.resteasy.plug
之前做的项目是resteasy的上传,代码没有问题,断点都不进来呢。
我以为可以直接移植到SpringMVC,但是SpringMVC不支持MultipartFormDataInput ,
用MultipartFile就可以了。老的无法兼容新的。正确代码如下
@RequestMapping(value = "/importExcelForEduQuestion",produces = "application/json; charset=utf-8")
@ResponseBody
//@RequiresPermissions("eduQuestionBank:importExcelForEduQuestion")
public Map<String,Object> importExcelForEduQuestion(HttpServletRequest request, @RequestParam("excelPath") MultipartFile file){
//如果文件不为空,写入上传路径
if(!file.isEmpty()) {
//上传文件路径
//上传文件名
String filename = file.getOriginalFilename();
File filepath = new File(UPLOADED_FILE_PATH,filename);
//判断路径是否存在,如果不存在就创建一个
if (!filepath.getParentFile().exists()) {
filepath.getParentFile().mkdirs();
}
//将上传文件保存到一个目标文件当中
try {
file.transferTo(new File(UPLOADED_FILE_PATH + File.separator + filename));
} catch (IOException e) {
e.printStackTrace();
}
return ResultUtil.createSuccessResult();
} else {
return ResultUtil.createFailResult("上传失败");
}
}
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jboss.resteasy.plug的更多相关文章
- Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed
在使用SpringMVC绑定基本类型(如String,Integer等)参数时,应通过@RequestParam注解指定具体的参数名称,否则,当源代码在非debug模式下编译后,运行时会引发Handl ...
- org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: Unknown column 'viewpoint' in 'field list'
问题描述:当我在model中添加了一下代码以后数据库报错: 添加的代码为: private Viewpoint viewpoint; public Viewpoint getViewpoint() { ...
- 部署项目到linux中报Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed
@RequestMapping(value = "/security/login", method = RequestMethod.POST) public ModelAndVie ...
- error:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
问题:调用的方法在一个接口类中,但我并没有注入那个被调用的类 解决:在UserEntity前加上@Autowired @Controller public class MainController { ...
- org.springframework.web.util.NestedServletException : Handler processing failed; nested exception is java.lang.StackOverflowError
1 ,错误原因,循环冗余检查 result.setNearUsers(userList); Page page = new Page(); pag ...
- Tomcat服务org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: Java heap space
一个运行了很久的项目,最近忽然报错:OOM( java.lang.OutOfMemoryError: Java heap space),异常如下 org.springframework.web.uti ...
- 【java异常】org.springframework.web.util.NestedServletException: Handler processing failed;Can't connect to X11 window server using 'localhost:10.0' as the value of th
tomcat工程中创建二维码失败.抛出异常Can't connect to X11 window server using 'localhost:10.0' as the value of th 因为 ...
- org.springframework.web.util.NestedServletException Handler processing failed; n
因为谷歌的lists不支持或使用, 所有要改成java的list工具 谷歌list使用: import com.google.common.collect.Lists; .... Lists.newA ...
- HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram
HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram ...
随机推荐
- DEV 之 有些控件不允许拖动。
DEV 之 有些控件不允许拖动. 设置一个参数即可解决问题
- 网站运维之 使用IIS日志分析器1.03.exe进行IIS服务器日志分析
引言 对于网站运维是一个比较要细心有耐心的工作,当一个网站从开发到上线后,后期的维护也很关键,特别是对于引流的网站来说更是至关重要. 对于网站运维的内容大致可以分为: SEO流量监控方面:风险防控:访 ...
- MongoDB集群方案介绍
MongoDB集群方案介绍 一.什么是mongodb集群? 是指由多台mongodb服务器组成的服务器集群,称之为mongodb集群. 二.mongodb集群搭建的方式: 1.Replica Set ...
- 算法 UVA 11729
例2:假设当前小光有n个部下,每个部下需要完成一项任务.第i个部下需要小光花Bi分钟交代任务,然后他会立刻独立地.无间断地执行Ji分钟后完成任务.小光需要选择交代任务的顺序,使得所有任务尽早执行完毕 ...
- Delphi32位程序拷贝system32目录中文件解决方法!
源码下载:http://download.csdn.net/detail/sunylat/9740352 unit Unit1; interface uses Winapi.Windows, Wina ...
- DatagridView 控件列顺序与设置的不一样
解决方案如下 : 1. dataGridView1.AutoGenerateColumns = false; 2. 绑定的dataSource 中所有的列都要写进去(列一定是绑定的模型中属性) 先在界 ...
- 原生态js展开高度自适应100%
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 如何提高scrapy的爬取效率
提高scrapy的爬取效率 增加并发: 默认scrapy开启的并发线程为32个,可以适当进行增加.在settings配置文件中修改CONCURRENT_REQUESTS = 100值为100,并发设置 ...
- Event(补交作业)
三种方法可以创建Eventhandler 1.
- Python脚本模板
1.Python脚本规范基础模板 #coding:utf8 import time, re, os, sys, time,urllib2,shutil,string import json,datet ...