【异常】Error configuring application listener of class xxx.xxx.xxx
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
??? at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1363)
??? at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
??? at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3712)
??? at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
??? at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
??? at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
??? at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
??? at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
??? at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
??? at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
??? at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
??? at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
??? at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
??? at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
??? at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
??? at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
??? at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
??? at org.apache.catalina.core.StandardService.start(StandardService.java:448)
??? at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
??? at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
??? at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
??? at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
??? at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
??? at java.lang.reflect.Method.invoke(Method.java:597)
??? at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
??? at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
?
经常碰到有人在部署Web工程的时候会报如上错误,搞了半天还不知道是什么原因。:(
其实原因很简单:
?? 首先,看看你的工程WEB-INF/lib目录下是否添加了spring.jar包?如果没有,添加spring.jar到lib目录下。
?? 其次,到web server的应用部署目录(如果是tomcat就是webapps,如果是jboss那么是server/{服务器名(默认default)}/)下查看刚刚部署的war包,到里面找WEB-INF/lib目录,往下还是找spring.jar包,有些时候eclipse自动部署会有问题,WEB-INF/lib目录在部署的时候打不到war包里去。
归根结底,就是你的工程构建或者应用部署两个环节中的某一个出了问题。至于后一个原因,最好的解决办法还是手动生成war包,然后把它拷贝到相应的应用部署目录下。
?
?