SpringCloud项目启动失败 not found config file[log.properties]
not found config file[log.properties] 2022-03-31 09:15:08.010 ERROR [com.xxx.xxxx.common.config.file.FileConfig] not found config file[log.properties] Exception in thread "main" java.lang.ExceptionInInitializerError at com.xxx.xxxx.common.config.ApplicationConfig.initApplicationContext(ApplicationConfig.java:35) at com.xxx.xxxx.common.config.ApplicationConfig.<init>(ApplicationConfig.java:23) at com.xxx.xxxx.common.config.ApplicationConfig.<clinit>(ApplicationConfig.java:16) at com.xxx.job.executor.config.InitConfig.<clinit>(InitConfig.java:43) at com.xxx.job.executor.Application.main(Application.java:24) Caused by: java.lang.NullPointerException at java.io.FileInputStream.<init>(FileInputStream.java:130) at java.io.FileInputStream.<init>(FileInputStream.java:93) at com.xxx.xxxx.common.config.file.FileConfig$BaseConfig.getProperties(FileConfig.java:105) at com.xxx.xxxx.common.config.file.FileConfig$BaseConfig.configToContext(FileConfig.java:114) at com.xxx.xxxx.common.config.file.FileConfig.initApplicationContext(FileConfig.java:88) at com.xxx.xxxx.common.config.file.FileConfig.<init>(FileConfig.java:43) at com.xxx.xxxx.common.config.file.FileConfig.<clinit>(FileConfig.java:36) ... 5 more
运行环境不对,Run Configuration ,在 Application 中选择 Modify Run Configuration
在打开的窗口中,Working Directory 最右边的图标(Insert Macros...)
选择 $MODULE_WORKING_DIR$
OK 即可