Spring:BeanInitializationException: Could not load properties

柔情只为你懂 2021-09-22 17:20 322阅读 0赞

错误信息:

  1. 严重: Context initialization failed
  2. org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [dbconn.properties] cannot be opened because it does not exist
  3. at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:151)
  4. at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
  5. at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:162)
  6. at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609)
  7. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
  8. at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
  9. at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
  10. at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
  11. at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
  12. at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
  13. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
  14. at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
  15. at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
  16. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  17. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  18. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  19. at java.lang.Thread.run(Thread.java:748)
  20. 1
  21. 2
  22. 3
  23. 4
  24. 5
  25. 6
  26. 7
  27. 8
  28. 9
  29. 10
  30. 11
  31. 12
  32. 13
  33. 14
  34. 15
  35. 16
  36. 17
  37. 18
  38. 19

这里查看配置的属性文件如下:
<context:property-placeholder location="classpath:jdbc.properties" />

实际上应该是找不到文件,之前放在Web主目录(WebContent)下,下载放在src目录下能够解决问题或者是配置文件classpath:jdbc.properties写的不对,请仔细检查

发表评论

表情:
评论列表 (有 0 条评论,322人围观)

还没有评论,来说两句吧...

相关阅读