提示系统找不到指定路径

提示系统找不到指定路径

filename=7.jpg

二月 12, 2020 11:12:29 下午 org.apache.catalina.core.StandardWrapperValve invoke

严重: 在路径为[/shop]的上下文中,servlet[com.imooc.web.action.ProductServlet]的Servlet.service()引发异常

java.io.FileNotFoundException: J:\apache-tomcat-8.5.50\webapps\shop\upload\080b6a13808b46f78a19769dcba678fc.jpg (系统找不到指定的路径。)

at java.io.FileOutputStream.open0(Native Method)

at java.io.FileOutputStream.open(FileOutputStream.java:270)

at java.io.FileOutputStream.<init>(FileOutputStream.java:213)

at java.io.FileOutputStream.<init>(FileOutputStream.java:101)

at com.imooc.utils.UploadUtils.uploadFile(UploadUtils.java:73)

at com.imooc.web.action.ProductServlet.save(ProductServlet.java:42)

at com.imooc.web.action.ProductServlet.doGet(ProductServlet.java:37)

at com.imooc.web.action.ProductServlet.doPost(ProductServlet.java:83)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at com.imooc.web.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:37)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:609)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1623)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)


正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,根据报错信息,没有找到上传图片的路径,建议同学检查一下WebContent文件下是否创建了upload文件夹,具体如下:

http://img1.sycdn.imooc.com//climg/5e44e83e091f76f502380199.jpg

同学在upload文件夹下放张图片,重启项目再试试。如果是空的文件夹,可能不会发布,造成找不到路径报错。

如果我的回答解决了你的疑惑,请采纳!祝学习愉快!

  • 敏捷丶 提问者 #1
    解决了,文件夹命名错了
    2020-02-13 14:24:47
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师