gpt4 book ai didi

java - 由 : java. io.IOException : File/tmp/lp/LP. 2015.4.28.10.29.40.zip 不是文件或不存在引起

转载 作者:太空宇宙 更新时间:2023-11-04 13:54:51 24 4
gpt4 key购买 nike

这就是我的代码的样子

protected Response uploadFile(final File file) throws HttpUploadException {
System.out.println("Uploader uploading " + file.getAbsolutePath());
System.out.println("Uploader file exists " + file.exists());
final String endPoint = endPoint.getAppURL() + "/" + uri;
final Response response;
try {
response =
remoteResource.uploadFileAndGetResponse(endPoint, file.getAbsoluteFile(), "application/octet-stream",
Collections.<String, String>emptyMap());

} catch (final Exception e) {
throw new HttpUploadException("Failed to upload data to " + endPoint, e);
}
}

当我运行此代码时,我看到

Uploader uploading /tmp/lp/LP.2015.4.28.10.29.40.zip
Uploader file exists true

然后我看到异常为

com.pro.logs.client.HttpUploadException: Failed to upload data to https://mystat.pro.net:443/importer
at com.shn.logs.common.Uploader.uploadFile(Uploader.java:54)
at com.pro.logs.controller.report.LPDiagnosticReportUploader.upload(LPDiagnosticReportUploader.java:12)
at com.pro.logs.controller.report.ReportSender$ReportSenderRunnable.executeTasks(ReportSender.java:109)
at com.pro.logs.controller.report.ReportSender$ReportSenderRunnable.run(ReportSender.java:92)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: File /tmp/lp/LP.2015.4.28.10.29.40.zip is not a file or doesn't exist
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.construct(NettyAsyncHttpProvider.java:891)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.buildRequest(NettyAsyncHttpProvider.java:657)
at com.ning.http.client.providers.netty.NettyConnectListener$Builder.build(NettyConnectListener.java:145)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1071)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:940)
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:499)
at com.ning.http.client.AsyncHttpClient$BoundRequestBuilder.execute(AsyncHttpClient.java:229)
at com.shn.util.RemoteResourceManager.uploadFileAndGetResponse(RemoteResourceManager.java:137)
at com.pro.logs.common.Uploader.uploadFile(Uploader.java:50)
... 6 more

当文件已经存在时,问题是什么?

最佳答案

我认为这是因为 ZIP 文件不是 File

System.out.println("Uploader file isFile? " + file.isFile());

我明白了

Uploader file isFile? false

我现在有一个不同的问题

关于java - 由 : java. io.IOException : File/tmp/lp/LP. 2015.4.28.10.29.40.zip 不是文件或不存在引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29926320/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com