上传到 其他云厂商的 接口 报错了
300M的没问题,3GB的就不行了
2021-11-04 18:44:45.089 WARN 8724 --- [nio-8081-exec-4] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space]
代码也是切片上传的
public static byte[] readFile3(File file){
InputStream is = null;
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] b = new byte[1024];
int n;
try {
is = new FileInputStream(file);// pathStr 文件路径
while ((n = is.read(b)) != -1) {
out.write(b, 0, n);
}
} catch (Exception e) {
e.printStackTrace();
}finally{
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return out.toByteArray();
}
try {
System.out.println("到333");
byte[] bytes = readFile3(f);
System.out.println("到444");
B2UploadFileRequest request = B2UploadFileRequest.builder(bucket, B2Utils.generateFolderPath(patharr) + f.getName(), "", B2ByteArrayContentSource.build(bytes)).build();
System.out.println("到555");
client.uploadSmallFile(request);
} catch (B2Exception e) {
e.printStackTrace();
}
idea 里面也设置了 启动参数 -Xmx2907m -Xms2907m -XX:NewRatio=4
这是哪里出了问题