最近把spring框架也学的差不多了 最近就打算整合下SSH框架之后做一个项目
## bug描述:在写spring代码时 启动tomcat报错 ## bug信息: ## bug解决 : 这个bug有点恶心,恶心到idea的报错信息就一句话 ***One or more listeners failed to start. Full details will be found in the appropriate cont***只是说要你去看那个日志 之后去idea日志文件里面去看 然后发现是空的 都是些老旧的日志 ### (1)找到错误日志 百度之后 发现要是idea下面没有日志记录的话 得去c盘下的.IntelliJIdea2019.2 的system/tomcat目录下的 找到本工程的名字 进入log目录 就可以看到对应的错误日志了 我自己是到localhost.2019-11-01.log中找到错误原因的 错误信息如下
01-Nov
-2019 15:30:54.418 信息
[RMI TCP
Connection(3)-127.0.0.1] org
.apache
.catalina
.core
.ApplicationContext
.log No Spring WebApplicationInitializer types detected on classpath
01-Nov
-2019 15:30:54.584 信息
[RMI TCP
Connection(3)-127.0.0.1] org
.apache
.catalina
.core
.ApplicationContext
.log Initializing Spring root WebApplicationContext
01-Nov
-2019 15:30:54.996 严重
[RMI TCP
Connection(3)-127.0.0.1] org
.apache
.catalina
.core
.StandardContext
.listenerStart Exception sending context initialized event to listener instance of
class [org
.springframework
.web
.context
.ContextLoaderListener
]
org
.springframework
.beans
.factory
.BeanInitializationException
: Could not load properties
; nested exception is java
.io
.FileNotFoundException
: Could not open ServletContext resource
[/jdbc
.properties
]
at org
.springframework
.beans
.factory
.config
.PropertyResourceConfigurer
.postProcessBeanFactory(PropertyResourceConfigurer
.java
:89)
解决问题
原因是在载入properties配置文件路径不对 但因为我是把它放在resource目录下面了的 导致文件无法加载 最后直接将其重构之后放到src目录下才能访问并加载到