Properties file not found in classpath: config.properties

我朋友开发的项目,为什么到我这里就会报这个错误,并且我看网上的解决方法都解决不了,用maven配置的


java.lang.IllegalArgumentException: Properties file not found in classpath: config.properties

at com.jfinal.kit.Prop.<init>(Prop.java:60)

at com.jfinal.kit.PropKit.use(PropKit.java:64)

at com.jfinal.kit.PropKit.use(PropKit.java:38)

at com.sys.JFConfig.configConstant(JFConfig.java:23)

at com.jfinal.core.Config.configJFinal(Config.java:51)

at com.jfinal.core.JFinal.init(JFinal.java:63)

at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)

at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4659)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)


评论区

HingLo

2018-05-21 16:00

需要将properties文件放在resources下

lhhhhh

2018-05-21 16:06

@HingLo 是放在resources下的

JFinal

2018-05-21 17:37

去 class path 里头看一下现场,看 config.properties 这个文件到底存在不存在

不要看 /src/main/resources 下面,要看被编译后的那个 class path 里头,PropKit 是从 class path 去找文件

lhhhhh

2018-05-21 17:52

@JFinal 被编译过的classpath里没有

JFinal

2018-05-21 17:55

@lhhhhh @lhhhhh 就是这个原因了, 让这个 class path 中有就可以了

lhhhhh

2018-05-22 17:43

@JFinal 谢谢解答

热门反馈

扫码入社