之前做的项目是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的更多相关文章

  1. Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed

    在使用SpringMVC绑定基本类型(如String,Integer等)参数时,应通过@RequestParam注解指定具体的参数名称,否则,当源代码在非debug模式下编译后,运行时会引发Handl ...

  2. 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() { ...

  3. 部署项目到linux中报Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed

    @RequestMapping(value = "/security/login", method = RequestMethod.POST) public ModelAndVie ...

  4. error:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException

    问题:调用的方法在一个接口类中,但我并没有注入那个被调用的类 解决:在UserEntity前加上@Autowired @Controller public class MainController { ...

  5. org.springframework.web.util.NestedServletException : Handler processing failed; nested exception is java.lang.StackOverflowError

    1 ,错误原因,循环冗余检查      result.setNearUsers(userList);            Page page = new Page();            pag ...

  6. 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 ...

  7. 【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 因为 ...

  8. org.springframework.web.util.NestedServletException Handler processing failed; n

    因为谷歌的lists不支持或使用, 所有要改成java的list工具 谷歌list使用: import com.google.common.collect.Lists; .... Lists.newA ...

  9. 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 ...

随机推荐

  1. Spring Boot - 杂项

    可以使用devtools功能来实现热部署(Hot Swapping),需要加入依赖(如maven):spring-boot-devtools 可以实现修改代码并保存后的自动编译.重启 依赖于Eclip ...

  2. Swagger简单实例

    随着技术的不断发展,网站框架也开始向:前后端分离的形态发展,而且前端技术和后端技术在各自的道路上越走越远.而web api 接口成了前后端唯一的联系.所以web api会变得越来越重要. 那么什么是W ...

  3. Flex + Bison: Scanning from memory buffer

    Found from StackOverflow: ========================================================================== ...

  4. [Flex] 组件Tree系列 —— 支持CheckBox组件

    主程序mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:支持CheckBox--&g ...

  5. [ActionScript 3.0] AS利用ByteArray向PHP发送二进制数据生成图片

    flash as3向php发送二进制数据,通过php保存成图片. AS端: package { import com.JPEGEncoder.JPGEncoder; import flash.disp ...

  6. ArchLinux 下 virtualbox 报错 libQtCore.so.4: cannot open shared object file

    VirtualBox: supR3HardenedMainGetTrustedMain: dlopen("/usr/lib/virtualbox/VirtualBox.so",) ...

  7. iBatis --> MyBatis

    从 Clinton Begin 到 Google(从 iBatis 到 MyBatis,从 Apache Software Foundation 到 Google Code),Apache 开源代码项 ...

  8. iOS 开发中类似上下滚动弹幕实现原理

    #mark ---滚动弹幕 列表中留有7条记录  大于7条时删除并指引表视图向上滑动 - (void)addRowActionWithContent:(NSString *)str { if (sel ...

  9. Cache缓存设计

    缓存的适用场景: 缓存的目的是提高访问速度,减少不必要的开销,提高性能.那什么样的场景适用于缓存呢.试想一个多项式的计算是一个CPU bound的操作,如果频繁调用同一个多项式的结果.显然缓存结果是一 ...

  10. 《软件工程综合实践专题》第三次作业——原型工具Axure RP8 的介绍

    一.为什么使用Axure Axure RP是一个专业的快速原型设计工具. Axure RP已被一些大公司采用.Axure RP的使用者主要包括商业分析师.信息架构师.可用性专家.产品经理.IT咨询师. ...