服务器 Jboss 6 重启后丢失上传文件
我的上传脚本工作正常(JSF 2 和 Primefaces)。我可以上传、在网络上显示、将文件名插入数据库,但是当我重新启动服务器时,文件就消失了!
我注意到部署的项目存储在Jboss临时目录中,因此当您重新启动服务器时,旧的部署项目将被删除。
所以,请给我一个解决方案,即使我重新启动服务器,我也可以保留所有上传的文件,
谢谢!
My Upload script works fine (JSF 2 and Primefaces). I can upload, show in the web, insert filename to database but when I reboot the server, the files are gone !
I noticed that the deployed project store in the Jboss Temporary directory, so when you restart the server, the old deployed project will be deleted.
So, please give me the solution that I could keep all the file uploaded even I reboot the server
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如其名称所示,Jboss 中的临时文件夹由服务器在内部使用来解压缩不同的项目文件(如 .jar、.war、.ear...)并直接使用其中的文件。您绝对不应该使用临时文件夹来存储上传的文件。相反,设计机器的另一个文件夹来存储它们并配置您的应用程序以将文件上传到那里,以便它们始终可用
As their name indicates, the temp folder in Jboss is used internally by the server to uncompress the different project files (like .jar, .war, .ear...) and work directly with the files inside. You should never use the temp folder to store your uploaded files. Instead design another folder of the machine to store them and configure your application to upload the files there, so they will always be available
我找到了解决方案,非常简单,只需提取 .war 或 .ear 文件夹并将其放入 Jboss 的部署文件夹中
例如我的项目结构如下:
现在只需使用 Winrar 提取 2 个文件夹 MySweetHome.ear 和 MySweetHome_Client.war,我们就有
并与JBoss一起部署,现在上传的图像在重新启动后不会被服务器擦除!
I've found the solution, very easy, just extract the .war or .ear folder and put it in the Jboss's deploy folder
For Example I have the project structure like this:
Now just extract 2 folders MySweetHome.ear and MySweetHome_Client.war by using Winrar and we have
And deploy with JBoss, now the uploaded images won't be wiped out by the server after rebooting !