【问题标题】:Writing files to a user directory temporary folder using Java in Websphere 9在 Websphere 9 中使用 Java 将文件写入用户目录临时文件夹
【发布时间】:2017-11-16 19:21:32
【问题描述】:

我有一个包含多部分文件附件模块的应用程序。在此,我创建了一个逻辑,将文件写入本地应用程序服务器(在我的情况下为 Tomcat)临时文件夹,并在上传后被删除。

我使用这个逻辑来创建文件,

File tmpFile = new File(System.getProperty("user.install.root") + File.separator + file.getOriginalFilename());
        file.transferTo(tmpFile);

这在 Tomcat 中按预期工作,但在 Websphere 9 环境中部署相同,会引发以下异常,

[11/13/17 20:20:45:946 IST] 000000f2 SystemErr R 原因: java.io.FileNotFoundException: C:\Program Files\IBM\WebSphere\AppServer_1\profiles\AppSrv01\temp\WIN7VSNode04\server1\project name\project name.war\null\tmpfiles\uploaded file.extension (系统找不到指定的路径。)

这可能是什么问题?

提前致谢。

【问题讨论】:

    标签: java-8 websphere tomcat8


    【解决方案1】:

    连接路径时变量为空:

    ...\project name.war\null\tmpfiles\...
                         ^^^^
    

    修复它,它应该可以工作。

    【讨论】:

    • 否,“null\tmpfiles”路径存在于 websphere 目录下但不在上述路径下,路径为“C:\Program Files\IBM\WebSphere\AppServer_1\profiles\AppSrv01\null\tmpfiles "
    猜你喜欢
    • 2013-12-06
    • 2010-11-10
    • 1970-01-01
    • 2010-10-11
    • 1970-01-01
    • 2017-06-19
    • 2011-02-07
    • 2023-02-15
    相关资源
    最近更新 更多