Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.dromara.x.file.storage.core.FileStorageService.of(Ljava/lang/Object;)Lorg/dromara/x/file/storage/core/UploadPretreatment #233

Closed
1343228975 opened this issue Mar 19, 2024 · 2 comments

Comments

@1343228975
Copy link

1343228975 commented Mar 19, 2024

上传图片报错
Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.dromara.x.file.storage.core.FileStorageService.of(Ljava/lang/Object;)Lorg/dromara/x/file/storage/core/UploadPretreatment
代码:
public FileInfo uploadImage(MultipartFile file,String imgPath,String type) {
FileStorage fileStorage = fileStorageService.getFileStorage();
String path = StringUtils.isEmpty(imgPath)? "image/": imgPath+"/"+ DateUtils.datePath() + "/";
FileInfo fileInfo = fileStorageService.of(file)
.setAcl(Constant.ACL.PRIVATE)
.setOriginalFilename("a.jpg")
.setObjectId("0")
//关联对象类型,为了方便管理,不需要可以不写
.setObjectType(ImgTypeEnum.YHY_AI_COVER.name())
//保存一些属性,可以在切面、保存上传记录、自定义存储平台等地方获取使用,不需要可以不写
.putAttr("role", "admin")
//使用指定的存储平台
.setPlatform("amazon-s3-1")
.upload();
fileStorageService.setFileAcl(fileInfo, Constant.ACL.PUBLIC_READ);
fileStorageService.setThFileAcl(fileInfo, Constant.ACL.PUBLIC_READ);
return fileInfo;
}
版本:2.1.0

@1171736840
Copy link
Collaborator

提示 NoSuchMethodError ,可能是第三方依赖冲突导致的,例如 AmazonS3 依赖的 okhttp 版本与已有的不兼容,你重新引入一个试试

@1343228975
Copy link
Author

降到2.0.0就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants