Azure BlobClient.beginCopy(..) 组 main 中的 Scheduler worker 错误因未捕获的异常而失败
Azure BlobClient.beginCopy(..) error in Scheduler worker in group main failed with an uncaught exception
以下是我的代码:
try (CSVReader reader = new CSVReader(new FileReader(csvFile.getAbsolutePath()))) {
//List<String[]> r = reader.readAll();
String[] lineInArray;
int count = 0;
while ((lineInArray = reader.readNext()) != null) {
String interId = lineInArray[0];
String fileId = null;
String mp3Name = null;
List<Map<String, Object>> filesList = ccrDao.retrieveCallIdAndPaths(interId);
for (Iterator iterator = filesList.iterator(); iterator.hasNext();) {
Map<String, Object> map = (Map<String, Object>) iterator.next();
fileId = map.get("C_CALL_ID")!=null?map.get("C_CALL_ID").toString():"";
mp3Name = map.get("C_FILENAME")!=null?map.get("C_FILENAME").toString():"";
if(!fileId.equals("") && !mp3Name.equals("")) {
String blobName = fileId+"/"+mp3Name;
context.getLogger().info("blobName: "+blobName);
BlobClient sourceBlobClient = srcContainer.getBlobClient(blobName);
context.getLogger().info("source blob client");
BlobClient destBlobClient = dstnContainer.getBlobClient(blobName);
context.getLogger().info("destination blob client");
if(!destBlobClient.exists()) {
context.getLogger().info("blobName doesnt exist :"+blobName);
BlobServiceSasSignatureValues sas = new BlobServiceSasSignatureValues(OffsetDateTime.now().plusHours(1), BlobContainerSasPermission.parse("r"));
String sasToken = sourceBlobClient.generateSas(sas);
context.getLogger().info("generated sas token :"+sasToken);
destBlobClient.beginCopy(sourceBlobClient.getBlobUrl()+"?"+ sasToken,null);
//destBlobClient.copyFromUrl(sourceBlobClient.getBlobUrl());
context.getLogger().info(interId+"copied successfully");
}else {
context.getLogger().info("blob already exists");
}
}else {
context.getLogger().info("No file is present");
}
}
count++;
context.getLogger().fine("Recourd Count "+count);
}
} catch (Exception e ) { //IOException | CsvException
context.getLogger().severe("Error occured while copying the data :"+e.getMessage());
e.printStackTrace();
}
在线报错
"destBlobClient.beginCopy(sourceBlobClient.getBlobUrl()+"?"+ sasToken,null);"
正文{字体系列:宋体;左边距:40px; }img { border:0 none; }#content { 左边距:自动; margin-right: auto }#message h2 { 字体大小:20px;字体粗细:正常;颜色:#000000;边距:34px 0px 0px 0px }#message p { font-size: 13px;颜色:#000000;边距:7px 0px 0px0px}#errorref { 字体大小:11px;颜色:#737373; margin-top: 41px }服务不可用我们的服务现在不可用
我们正在努力尽快恢复所有服务。请稍后再回来查看。
0XjmzYAAAAAC2Ast2oBmIS47phNpxTuFBQk9NMDFFREdFMDIxOQA3ZGIwYWMxYy1iNzZkLTRiYTQtYTE3NS01NTgxNTUxMTEzZDU=main 组中的调度程序工作程序错误因未捕获的异常而失败。
正如所怀疑的那样,这些问题与层级或任何缩放问题无关。执行我的函数时没有显示完整的日志,我的代码也无法捕获异常,所以我按照以下步骤操作。
- 通过 Kudu -Debug 控制台检查了“主机”日志。
- 能够在 beginCopy() 步骤中找到实际错误,如下所述
2021-05-31T14:37:48.513 [信息] 2021-05-31 14:37:48.494 错误 5820 --- [parallel-1] reactor.core.scheduler.Schedulers : Scheduler worker在 group main 中因未捕获的异常而失败
2021-05-31T14:37:48.513 [信息] java.lang.NoSuchMethodError: okhttp3.RequestBody.create(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/RequestBody;
- 对上述错误进行分析后,通过添加以下依赖项
覆盖我 pom.xml 中的 okhttp 版本
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
- 清理包并将所有库替换为现有库。不要只替换函数应用程序中的一个库,因为它的依赖库如 okio jar 也必须更新
以下是我的代码:
try (CSVReader reader = new CSVReader(new FileReader(csvFile.getAbsolutePath()))) {
//List<String[]> r = reader.readAll();
String[] lineInArray;
int count = 0;
while ((lineInArray = reader.readNext()) != null) {
String interId = lineInArray[0];
String fileId = null;
String mp3Name = null;
List<Map<String, Object>> filesList = ccrDao.retrieveCallIdAndPaths(interId);
for (Iterator iterator = filesList.iterator(); iterator.hasNext();) {
Map<String, Object> map = (Map<String, Object>) iterator.next();
fileId = map.get("C_CALL_ID")!=null?map.get("C_CALL_ID").toString():"";
mp3Name = map.get("C_FILENAME")!=null?map.get("C_FILENAME").toString():"";
if(!fileId.equals("") && !mp3Name.equals("")) {
String blobName = fileId+"/"+mp3Name;
context.getLogger().info("blobName: "+blobName);
BlobClient sourceBlobClient = srcContainer.getBlobClient(blobName);
context.getLogger().info("source blob client");
BlobClient destBlobClient = dstnContainer.getBlobClient(blobName);
context.getLogger().info("destination blob client");
if(!destBlobClient.exists()) {
context.getLogger().info("blobName doesnt exist :"+blobName);
BlobServiceSasSignatureValues sas = new BlobServiceSasSignatureValues(OffsetDateTime.now().plusHours(1), BlobContainerSasPermission.parse("r"));
String sasToken = sourceBlobClient.generateSas(sas);
context.getLogger().info("generated sas token :"+sasToken);
destBlobClient.beginCopy(sourceBlobClient.getBlobUrl()+"?"+ sasToken,null);
//destBlobClient.copyFromUrl(sourceBlobClient.getBlobUrl());
context.getLogger().info(interId+"copied successfully");
}else {
context.getLogger().info("blob already exists");
}
}else {
context.getLogger().info("No file is present");
}
}
count++;
context.getLogger().fine("Recourd Count "+count);
}
} catch (Exception e ) { //IOException | CsvException
context.getLogger().severe("Error occured while copying the data :"+e.getMessage());
e.printStackTrace();
}
在线报错
"destBlobClient.beginCopy(sourceBlobClient.getBlobUrl()+"?"+ sasToken,null);"
正文{字体系列:宋体;左边距:40px; }img { border:0 none; }#content { 左边距:自动; margin-right: auto }#message h2 { 字体大小:20px;字体粗细:正常;颜色:#000000;边距:34px 0px 0px 0px }#message p { font-size: 13px;颜色:#000000;边距:7px 0px 0px0px}#errorref { 字体大小:11px;颜色:#737373; margin-top: 41px }服务不可用我们的服务现在不可用
我们正在努力尽快恢复所有服务。请稍后再回来查看。
0XjmzYAAAAAC2Ast2oBmIS47phNpxTuFBQk9NMDFFREdFMDIxOQA3ZGIwYWMxYy1iNzZkLTRiYTQtYTE3NS01NTgxNTUxMTEzZDU=main 组中的调度程序工作程序错误因未捕获的异常而失败。正如所怀疑的那样,这些问题与层级或任何缩放问题无关。执行我的函数时没有显示完整的日志,我的代码也无法捕获异常,所以我按照以下步骤操作。
- 通过 Kudu -Debug 控制台检查了“主机”日志。
- 能够在 beginCopy() 步骤中找到实际错误,如下所述
2021-05-31T14:37:48.513 [信息] 2021-05-31 14:37:48.494 错误 5820 --- [parallel-1] reactor.core.scheduler.Schedulers : Scheduler worker在 group main 中因未捕获的异常而失败 2021-05-31T14:37:48.513 [信息] java.lang.NoSuchMethodError: okhttp3.RequestBody.create(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/RequestBody;
- 对上述错误进行分析后,通过添加以下依赖项 覆盖我 pom.xml 中的 okhttp 版本
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
- 清理包并将所有库替换为现有库。不要只替换函数应用程序中的一个库,因为它的依赖库如 okio jar 也必须更新