项目场景:
在虚拟机中的centos8中安装了FastDFS用于存放项目的图片,但是测试上传文件时报错问题描述:
报错信息:
com.github.tobato.fastdfs.exception.FdfsServerException: 错误码:2,错误信息:找不到节点或文件
测试代码
@RunWith(SpringRunner.class)
@SpringBootTest(classes = UploadApplication.class)
public class FdfsTest {
@Autowired
private FastFileStorageClient storageClient;
@Autowired
private ThumbImageConfig thumbImageConfig;
@Test
public void testUpload() throws FileNotFoundException {
File file = new File("D:\\test\\1.jpg");
// 上传并且生成缩略图
StorePath storePath = this.storageClient.uploadFile(new FileInputStream(file), file.length(), "jpg", null);
}
}
原因分析:
搜索了很多答案都是说yml文件中的tracker-list的地址和端口问题