在SpringMVC项目的controller层中编写接口pictureUpload(@RequestParam("file") MultipartFile srcFile)
public WxResultEntity pictureUpload(@RequestParam("file") MultipartFile srcFile){
String fileName = srcFile.getOriginalFilename();
StringBuffer buffer = new StringBuffer("imageCloud/");
buffer.append(fileName);
String upLoadName = buffer.toString();
WxResultEntity wre = new WxResultEntity();
if(srcFile.isEmpty()){
return null;
}
try{
byte[] bytes = srcFile.getBytes();
boolean flag = OBSFileUtils.uploadForBytes(bytes,upLoadName);
if(flag) {
wre.setStatus(200);
wre.setResultInfo(upLoadName;
}
return wre;
}catch (Exception e){
e.printStackTrace();
return wre;
}
}
调用接口后flag为false并且抛出如下异常
com.obs.services.exception.ObsException: OBS servcie Error Message. Request Error: java.lang.NoSuchMethodError: okhttp3.internal.http.RealInterceptorChain.transmitter()Lokhttp3/internal/connection/Transmitter;
Caused by: java.lang.NoSuchMethodError: okhttp3.internal.http.RealInterceptorChain.transmitter()Lokhttp3/internal/connection/Transmitter;
排查为com\obs\services\internal\service\AbstractRequestConvertor.class 类中以下代码块
if (apiVersion == null) {
try {
this.segmentLock.lock(bucketName);
apiVersion = this.apiVersionCache.getApiVersionInCache(bucketName);
if (apiVersion == null) {
apiVersion = this.parseAuthTypeInResponse(bucketName);
this.apiVersionCache.addApiVersion(bucketName, apiVersion);
}
}
apiVersion = this.parseAuthTypeInResponse(bucketName);
this.apiVersionCache.addApiVersion(bucketName, apiVersion);
出现问题使得apiVersion出现赋值错误。
okhttp-4.9.0.jar
jdk版本为1.8
有知道的朋友看到的话能不能回复一下解决方案啊