class path resource [quartz.properties] cannot be opened because it does not exist

网友投稿 714 2022-12-02

class path resource [quartz.properties] cannot be opened because it does not exist

class path resource [quartz.properties] cannot be opened because it does not exist

从公司 SVN上更新了代码之后,运行一个spring boot项目,死活不能成功。以前可以。错误很多很吓人,但干货是这一句:

class path resource [quartz.properties] cannot be opened because it does not exist

从错误提示来看,很明显,说找不到配置文件“quartz.properties”,但明明就是有的啊。

// 指定quartz.properties,可在配置文件中配置相关属性 @Bean public Properties quartzProperties() throws IOException { PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); propertiesFactoryBean.setLocation(new ClassPathResource("/config/quartz.properties")); propertiesFactoryBean.afterPropertiesSet(); return propertiesFactoryBean.getObject(); }

我目前为止,还是个JAVA白痴,于是又开始了寻寻觅觅的瞎琢磨过程。最后发现,代码没有问题,原因是编译结果里,没有将这个配置文件带过去。也就是,存放编译结果所在的文件夹target里,不知道为什么没有将这个配置文件拷贝过去。原来,提示找不到文件,不是看你代码里有没有,真正要看的,是编译结果啊。

解决办法:

将项目rebuild一次,再运行,就正常了。原因我估计是不知道为什么,这个文件可能被占用了,之前的运行过程中,一直拷贝失败。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:项目的质量把控与人员使用
下一篇:传染病模型系统动力学VENSIM模拟
相关文章

 发表评论

暂时没有评论,来抢沙发吧~