问题提示:
Found multiple occurrences of org.json.JSONObject on the class path: jar:file:/D:/document/maven/repository/org/json/json/20170516/json-20170516.jar!/org/json/JSONObject.class jar:file:/D:/document/maven/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class You may wish to exclude one of them to ensure predictable runtime behavior
环境配置:
<dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alicloud-oss</artifactId> </dependency>
相关代码:
@Autowired OSSClient ossClient; @Test public void testUpload() throws FileNotFoundException { InputStream inputStream = new FileInputStream("E:\\13.jpg"); // 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。 ossClient.putObject("market-gulimall", "13.jpg", inputStream); // 关闭OSSClient。 ossClient.shutdown(); System.out.println("上传成功");
}
解决办法:
将OSSClient 注入修改成OSS