惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
WordPress大学
WordPress大学
Help Net Security
Help Net Security
Jina AI
Jina AI
Security Latest
Security Latest
Y
Y Combinator Blog
Project Zero
Project Zero
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
Know Your Adversary
Know Your Adversary
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
NISL@THU
NISL@THU
Cisco Talos Blog
Cisco Talos Blog
博客园 - 司徒正美
MyScale Blog
MyScale Blog
Cyberwarzone
Cyberwarzone
D
Docker
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
C
CERT Recently Published Vulnerability Notes
B
Blog
L
LangChain Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
SecWiki News
SecWiki News
The Hacker News
The Hacker News
C
Check Point Blog
L
Lohrmann on Cybersecurity
V2EX - 技术
V2EX - 技术
S
Securelist
T
Threat Research - Cisco Blogs
Stack Overflow Blog
Stack Overflow Blog
TaoSecurity Blog
TaoSecurity Blog
云风的 BLOG
云风的 BLOG
Latest news
Latest news
人人都是产品经理
人人都是产品经理
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Register - Security
The Register - Security
Webroot Blog
Webroot Blog
Simon Willison's Weblog
Simon Willison's Weblog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
AWS News Blog
AWS News Blog
C
Cybersecurity and Infrastructure Security Agency CISA
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
小众软件
小众软件
T
Tailwind CSS Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
宝玉的分享
宝玉的分享
O
OpenAI News

博客园 - Mark Jiao

调试Java程序持续占cpu问题 Freemarker notes | Freemarker学习笔记 MySQL 性能调优之查询优化 Tomcat性能调优 | Tomcat Performance Tuning Tomcat配置、管理和问题解决 | Tomcat Configuration, Manangement and Trouble Shooting SWT Browser & XULRunner Windows应用安装制作工具调查报告 CentOS Configuration | CentOS配置 命令行加载IE ActiveX插件 Java那些事儿 互联网技术要考虑的事情 Parameterized Testing | 参数化测试 Git usage | Git 使用 Introduce products I worked on | 介绍一下我做过的产品 PHPUnit manual note | PHPUnit手册笔记 PHP manual notes | PHP手册笔记 Globalization, Localization, Internationalization and Translation HTTP 超文本传输协议 Design Patter
Spring Struts Hibernate trouble shooting | 一些问题的记载
Mark Jiao · 2017-04-13 · via 博客园 - Mark Jiao

Struts 2

Struts 2上传文件报错

[13 16:09:13,321 catalina-exec-5] CommonsLogger.warn(56) | Could not find create multipart save directory '/attachment'.
[13 16:09:13,323 catalina-exec-5] CommonsLogger.warn(60) | Unable to parse request
org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. attachment/upload__58686996_15b664f6902__8000_00000005.tmp (没有那个文件或目录)

...

Caused by: java.io.FileNotFoundException: attachment/upload__58686996_15b664f6902__8000_00000005.tmp (没有那个文件或目录)
    at java.io.FileOutputStream.open(Native Method)

...

Root cause:

struts-main.xml指定上传文件的保存位置:

<constant name="struts.multipart.saveDir" value="attachment" />

那么attachment文件夹会创建在user.dir位置下,user.dir为tomcat startup.sh执行时启动的工作目录,一般为tomcat/bin目录;

但如果/xxx/tomcat/bin/startup.sh启动时的当前目录为根目录/,而tomcat启动用户并没有在/目录创建目录的权限,上传文件就会失败,并报错如上。

Solution:

1. 切换tomcat启动时的工作目录

2. 在tomcat启动的任何目录确保可以创建attachment目录

Reference:

关于struts.multipart.saveDir不设置或设置的说明:http://mossad.iteye.com/blog/1522905