{"record":{"id":"d5c61ae4fc2ed727","repo":"jeecgboot/JeecgBoot","slug":"error-d5c61a","errorCode":null,"errorMessage":"上传文件失败! ","messagePattern":"上传文件失败! ","errorType":"exception","errorClass":"JeecgBootException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/oss/service/impl/OssFileServiceImpl.java","lineNumber":31,"sourceCode":"\nimport java.io.IOException;\n\n/**\n * @Description: OSS云存储实现类\n * @author: jeecg-boot\n */\n@Service(\"ossFileService\")\npublic class OssFileServiceImpl extends ServiceImpl<OssFileMapper, OssFile> implements IOssFileService {\n\n\t@Override\n\tpublic void upload(MultipartFile multipartFile) throws Exception {\n\t\tString fileName = multipartFile.getOriginalFilename();\n\t\tfileName = CommonUtils.getFileName(fileName);\n\t\tOssFile ossFile = new OssFile();\n\t\tossFile.setFileName(fileName);\n\t\tString url = OssBootUtil.upload(multipartFile,\"upload/test\");\n\t\tif(oConvertUtils.isEmpty(url)){\n\t\t\tthrow new JeecgBootException(\"上传文件失败! \");\n\t\t}\n\t\t// 返回阿里云原生域名前缀URL\n\t\tossFile.setUrl(OssBootUtil.getOriginalUrl(url));\n\t\tthis.save(ossFile);\n\t}\n\n\t@Override\n\tpublic boolean delete(OssFile ossFile) {\n\t\ttry {\n\t\t\tthis.removeById(ossFile.getId());\n\t\t\tOssBootUtil.deleteUrl(ossFile.getUrl());\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\tlog.error(ex.getMessage(),ex);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/oss/service/impl/OssFileServiceImpl.java#L13-L49","documentation":"Thrown by OssFileServiceImpl.upload when OssBootUtil.upload returns null/empty for the given MultipartFile. The upload helper returns empty on any internal failure (missing OSS config, SDK exception, IO error), and this wrapper converts that silent failure into an explicit JeecgBootException so the caller sees the upload did not succeed.","triggerScenarios":"OSS provider credentials/endpoint/bucket not configured (jeecg.oss.* properties); MinIO/OSS endpoint unreachable; bucket does not exist; file stream closed/empty; the configured jeecg.uploadType does not match an available provider.","commonSituations":"Fresh deployment that forgot to set OSS credentials; network/firewall blocking the storage endpoint; expired STS token; switched jeecg.uploadType (local/minio/aliyun/qiniu) without providing the matching config.","solutions":["Verify the jeecg.uploadType and the corresponding jeecg.oss / minio / aliyun / qiniu config block in application.yml are complete and correct.","Check network reachability and credentials for the storage endpoint (bucket exists, key has write permission).","Inspect the OssBootUtil logs (it logs the underlying SDK exception before returning null) for the real cause.","Confirm the MultipartFile is non-empty and its stream is readable."],"exampleFix":"// before: jeecg.uploadType: minio  but no minio endpoint configured -> upload() returns null\n// after:  jeecg:\n//           uploadType: minio\n//           minio:\n//             endpoint: http://minio:9000\n//             accessKey: ${MINIO_AK}\n//             secretKey: ${MINIO_SK}\n//             bucketName: jeecg","handlingStrategy":"try-catch","validationCode":"// Verify OSS config completeness at startup\nboolean configured = StringUtils.hasText(env.getProperty(\"jeecg.uploadType\"))\n    && (\"local\".equals(env.getProperty(\"jeecg.uploadType\"))\n        || StringUtils.hasText(env.getProperty(\"jeecg.oss.endpoint\"))\n        || StringUtils.hasText(env.getProperty(\"jeecg.minio.endpoint\")));\nif (!configured) { /* fail fast / warn at boot */ }","typeGuard":null,"tryCatchPattern":"try {\n    ossFileService.upload(file);\n} catch (JeecgBootException e) {\n    if (e.getMessage().contains(\"上传文件失败\")) {\n        // log OssBootUtil root cause; do not retry until config/network fixed\n    }\n}","preventionTips":["Set jeecg.uploadType and the matching provider config block before going live.","Health-check the storage endpoint and credentials in the readiness probe.","Surface OssBootUtil's underlying exception in logs so the silent null is debuggable."],"tags":["oss","file-upload","storage","configuration"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}