Eclipse Error: Java.lang.ClassNotFoundException:ContextLoaderListener

Source: Internet
Author: User

Reprint from: http://chenzhou123520.iteye.com/blog/1836987

Error in eclipse when Tomcat deployment project starts: Shell code    severity:  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)        at org.apache.catalina.core.standardcontext$1.call ( standardcontext.java:5221)        at java.util.concurrent.futuretask$ Sync.innerrun (futuretask.java:303)        at  Java.util.concurrent.FutureTask.run (futuretask.java:138)        at  Java.util.concurrent.threadpoolexecutor$worker.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 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.

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.