最近将项目的代码从eclipse迁移到了IDEA 中 但是在eclipse中正常启动的项目, IDEA 中居然一直报错 ,向大家分享下这次找bug的经历哈。
- 最初启动的时候只显示
one or more listeners failed to start。没有详细信息,找bug 根本无从下手哈,在项目的classpath目录下加入logging.properties,来显示详细的报错信息。这样,我们再启动tomcat时,就会在logs目录下生成一个更详细的日志error-debug。
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ../logs
org.apache.juli.FileHandler.prefix = error-debug.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
详细的报错信息
严重: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener
java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter: class path resource [dev/log4j.properties] cannot be resolved to URL because it does not exist检查发现配置文件是存在的,那么问题是在哪呢。。。

eclipse下出现这种情况可以通过如下来配置。

于是开始搜索idea 下怎么设置Enable project specific setting,无果。
发现idea 没有识别出maven 项目的resource 等文件夹。
IDEA 直接导入maven 项目 ,发现项目运行正常。
本次问题主要由于IDEA直接打开了eclipse 的项目,在IDEA下 resource文件不能识别,直接采用 导入maven项目或者导入git 项目就可以了。
IDEA迁移项目报错解决
本文记录了一次从Eclipse迁移到IDEA过程中遇到的问题及解决方案。主要介绍了如何通过调整配置解决IDEA无法识别资源文件导致的启动错误。
2万+

被折叠的 条评论
为什么被折叠?



