文件上传报错,不过又可以传文件到项目里,求解

问题描述

文件上传报错,不过又可以传文件到项目里,求解
一开始用的好好的,然后我用数组添加四张图片的时候就只能添加三张,然后我清除了一下tomcat,之后就出现了问题

这是控制台报的错误:

                10:45:44297 ERROR DispatcherServlet:457 - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'multipartResolver' defined in class path resource [applicationContext-mvc.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'uploadTempDir' threw exception; nested exception is java.io.FileNotFoundException: ServletContext resource [/images/upload/] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1282)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1195)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1085)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5318)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5610)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'uploadTempDir' threw exception; nested exception is java.io.FileNotFoundException: ServletContext resource [/images/upload/] cannot be resolved to URL because it does not exist
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
... 29 more

解决方案

不知道你具体的配置,但是异常已经很清楚了,主要关注以下内容
nested exception is java.io.FileNotFoundException: ServletContext resource [/images/upload/] cannot be resolved to URL because it does not exist

解决方案二:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'multipartResolver' defined in class path resource [applicationContext-mvc.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'uploadTempDir' threw exception; nested exception is java.io.FileNotFoundException: ServletContext resource [/images/upload/] cannot be resolved to URL because it does not exist
你根据这个报的错误去解决啊。
先把错误贴到百度百度一下看这个错误有没有人犯过并解决掉了如果有就试着他的方法解决啊

解决方案三:
servlet有没有部署到web.xml 里边。看看

解决方案四:
报错说是为绑定,建议你看看

时间: 2024-12-21 22:43:10

文件上传报错,不过又可以传文件到项目里,求解的相关文章

android-Android 图片上传报错

问题描述 Android 图片上传报错 解决方案 看一下AsyncHttpRequestjava文件的147行,178行,109行有没有错,调试跟踪下: 解决方案二: 你首先看一下是不是你Android端的问题,还是服务端的问题. 解决方案三: 参考: http://bbs.anzhuo.cn/thread-941870-1-1.html

c++-在codeblocks上成功编译的代码放到VS2010上各种报错急求解决

问题描述 在codeblocks上成功编译的代码放到VS2010上各种报错急求解决 代码在网盘里,求大神解决谢谢了http://pan.baidu.com/s/1hqeUza8 解决方案 哥们你不厚道啊,container.h呢,发全了啊. 解决方案二: 我改好了,文件怎么给你?

接口-在上传图文消息素材时,总报错说是不合法的媒体文件id,不知道什么才是正确的id呢

问题描述 在上传图文消息素材时,总报错说是不合法的媒体文件id,不知道什么才是正确的id呢 package main;import java.util.ArrayList;import java.util.List;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import pojo.AccessToken;import pojo.Article;import pojo.Articles;import util.WeixinUtil

suse linux java ftp上传文件名称导致报错,求大神指导

问题描述 suse linux java ftp上传文件名称导致报错,求大神指导 上传时"school_user.questionext.csv"就因为文件名称多了一个"."导致报错 553 Could not create file.

微信永久视频上传报错41005 媒体文件丢失

问题描述 微信永久视频上传报错41005 媒体文件丢失 @using (Html.BeginForm(""UploadVideo""AddForeverVideo"" FormMethod.Post new { enctype = ""multipart/form-data"" })) { 选择上传媒体文件: }上面是一个input type为file ,name="description&quo

downloadprovider-下载你上传(安卓DownloadProvider下载文件) 运行报错

问题描述 下载你上传(安卓DownloadProvider下载文件) 运行报错 文件地址http://download.csdn.net/detail/wodaoai/7828535运行报错如下希望你能帮助解决下08-27 18:18:29.669: E/ContentValues(1837): Cannot cast value for no_integrity to a Boolean: 108-27 18:18:29.669: E/ContentValues(1837): java.lan

文件传输-java使用SSH方式上传报错:Algorithm negotiation fail

问题描述 java使用SSH方式上传报错:Algorithm negotiation fail java用jsch实现文件传输(SSH形式),但是好像本地和服务器加密方式不一致,一直报错: com.jcraft.jsch.JSchException: Algorithm negotiation fail 解决方案 如果是已form表单中的上传.需要改form的属性enctype( 属性规定在发送到服务器之前应该如何对表单数据进行编码.) 改属性默认值:application/x-www-form

php图片上传报错error=3

问题描述 php图片上传报错error=3 upload: <?php/** Created by PhpStorm. User: rosen Date: 15-11-5 Time: 下午8:43*/print_r($_FILES['file']); ?> 为什么程序运行结果报错Array ( [name] => 2015-10-19 18:47:42屏幕截图.png [type] => [tmp_name] => [error] => 3 [size] => 0

fileupload上传报错Could not find file

问题描述 fileupload上传报错Couldnotfindfile研究了一天啦!都找不到解決辦法在本地時就可以上傳,但是放到服務器上面就報上面的錯了!//stringserverpath=Server.MapPath("~/Upload/")+fileName;//设置附件上传到的服务器路径//stringserverpath=HttpContext.Current.Request.MapPath("~/Upload/")+fileName;又了好幾種設置路徑的