项目运行报java.lang.NoClassDefFoundError: org/springframework/web/context/ContextLoaderListen

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xianglingchuan/article/details/79731216

运行从Git上面拉下来的项目运行报java.lang.NoClassDefFoundError: org/springframework/web/context/ContextLoaderListener

严重: Error configuring application listener of class com.snaillove.web.cloudmusic.common.modules.listener.WebContextListener
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextLoaderListener
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3205)
  at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
  at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
  at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
  at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:495)
  at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:477)
  at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5034)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
  at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
  at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
  ... 19 more

经过git对比发现是项目下的.classpath跟拉下来原始的内容有所改变导致,还原以后运行正常。

大体是同下部分有所改动导致:

  <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
      <attribute name="maven.pomderived" value="true"/>
      <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>
  </classpathentry>
  <classpathentry kind="src" output="target/test-classes" path="src/test/java">
    <attributes>
      <attribute name="optional" value="true"/>
      <attribute name="maven.pomderived" value="true"/>
    </attributes>
  </classpathentry>
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页