Error configuring application listener of class org.springframework.web.context.ContextLoaderListene

这个错误看上去是找不到jar包引起的,但是检查完jar包的引用之后,发现spring-web的jar包是已经引用了的,如果是这种情况的话,解决方法就是将所引用的所有jar包拷贝一份到发布路径的WEB-INF/lib文件夹下。

Error configuring application listener of class org.springframework.web.context.ContextLoaderListene

注意

需要注意的是,eclipse配置完tomcat之后,如果我们不做修改的话,tomcat默认是发布到.metadata\plugins\目录下的wtpwebapps。这个目录在我们的项目目录下。如果想要更改到tomcat的发布目录下的话,我们可以重新添加一个server,选择tomcat,但是不要add任何项目,然后双击tomcat,在这个界面上进行修改:

Error configuring application listener of class org.springframework.web.context.ContextLoaderListene

总结

jar包找不到有可能是因为发布的时候tomcat没有自动将jar包拷贝过去,此时就需要我们手动拷贝一下。

PS:新方法

最近发现了解决这个问题的新方法,在项目上右击-》properties->Deployment Assembly,接下来如图:

Error configuring application listener of class org.springframework.web.context.ContextLoaderListene 
 
然后下一步下一步直到finish,这样,就可以将maven下的jar包发布到发布文件夹下了。