【maven】java.lang.ClassNotFoundException

项目背景:

使用maven创建的java web项目,yongmaven管理依赖。

异常描述:

SEVERE: 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:1702)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
	at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
	at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
	at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4876)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5455)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:634)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:671)
	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1840)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)



异常分析:

class没有找到导致的异常,没有相关的jar

异常解决:

部署项目到tomcat中后,到部署目录下查看了下,果然lib目录都不存在,maven管理的依赖包为什么没有加入到项目中去呢?解决方法,右击项目属性,在Deployment Assembly里加入Maven lib就OK了。

这样问题就解决了。



你可能感兴趣的:(java,exception)