Eclipse Error: Java.lang.ClassNotFoundException:ContextLoaderListener

Source: Internet
Author: User

The Tomcat deployment project in eclipse starts with an error:
Shell Code Collection Code
Serious: 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:1678)
At Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1523)
At Org.apache.catalina.core.DefaultInstanceManager.loadClass (defaultinstancemanager.java:415)
At Org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged (defaultinstancemanager.java:397)
At Org.apache.catalina.core.DefaultInstanceManager.newInstance (defaultinstancemanager.java:118)
At Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4660)
At Org.apache.catalina.core.StandardContext 1.call (standardcontext.java:5226) Atorg.apache.catalina.core.StandardContext 1.call (standardcontext.java:5226) at Org.apache.catalina.core.StandardContext1.call (standardcontext.java:5221)
At Java.util.concurrent.FutureTask Sync.innerrun (futuretask.java:303) Atjava.util.concurrent.FutureTask.run ( futuretask.java:138) Atjava.util.concurrent.ThreadPoolExecutor Sync.innerrun (futuretask.java:303) at Java.util.concurrent.FutureTask.run (futuretask.java:138) at Java.util.concurrent.ThreadPoolExecutorWorker.runTask (threadpoolexecutor.java:886)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:908)
At Java.lang.Thread.run (thread.java:662)
Problem background:
The project is a MAVEN project and the Contextloaderlistener class is located in the Spring-web-3.1.0.release.jar package. Check the pom.xml of Maven and rely on the introduction of normal. In the project Maven dependencies view you can also see the Spring-web-3.1.0.release.jar package being introduced in the normal.

Error Reason:
Enter the deployment path to Tomcat. Metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\, check it out. After discovering that the project was deployed, no Lib directory was generated under the Web-inf folder and, normally, a Lib directory was generated and all of the project's dependent jar packages were deployed to that directory.

Solution:
1. Right click on item – Select Properties
Select Deployment Assembly, click the Add button on the right, and select Java build Path Entries in the pop-up window. As shown in the following illustration:

2. Click Next to select Maven dependencies

3. Click Finish, and then you can see that the MAVEN dependencies has been added to the Web application structure

After the operation, redeploy the project, no longer the error. Then we went to the. Metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ directory, found the project Web-inf directory automatically generated Lib directory, And all the dependent jar packages are already deployed. The problem is solved accordingly.

Original: http://chenzhou123520.iteye.com/blog/1836987

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.