In web development, it is common to build a Web server in Eclipse and deploy the Web project in development to a Web server for debugging, where I chose the Tomcat server. Before deploying the Web project to Tomcat for start-up debugging is normal, the sudden failure to start the situation today, the startup process reported the following error:
Java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener at Org.apache.catalina.loader.WebappClassLoader.loadClass (Webappclassloader.java:1714) at Org.apache.catalina.loader.WebappClassLoader.loadClass (Webappclassloader.java:1559) 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:133) at Org.apache.catalina.core.StandardContext.listenerStart (Standardcontext.java:4727) at Org.apache.catalina.core.StandardContext.startInternal (Standardcontext.java:5285) at Org.apache.catalina.util.LifecycleBase.start (Lifecyclebase.java:150) at Org.apache.catalina.core.containerbase$startchild.call (Containerbase.java:1559) at Org.apache.catalina.core.containerbase$startchild.call (Containerbase.java:1549) 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:1110) at Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:603) at Java.lang.Thread.run (Thread.java:722)
Class cannot be found, The class relies on Spring-web-xxxx.jar, looked at the Maven dependency library, the dependency is there, what is going on, and then look at the WebApps in the Tomcat directory deployed projects, the project has been deployed successfully, the corresponding class files and static files have, but carefully look at the web-in F The Lib folder is missing, only to understand why the Org.springframework.web.context.ContextLoaderListener class is not found. Why didn't you copy lib when you started Tomcat in Eclipse, think about the project deployment Setup before you came across it. The solution is as follows:
Right-click on the project->properties-> find deployment Assembly, the right is compiled packaging configuration, see if there is a lack of Lib library dependencies, my is, click Add, add Maven dependency library. The final list is as follows
Restart Tomcat again to start success!!
Eclipse-maven Project released to Tomcat with no Lib copy attached