Eclipse Error: Java.lang.ClassNotFoundException:Contex

Source: Internet
Author: User

Error after launching Tomcat deployment project in Eclipse:

Shell Code

  1. Severity: Error Configuring Application Listener of Class Org.springframework.web.context.ContextLoaderListener

  2. Java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener

  3. At Org.apache.catalina.loader.WebappClassLoader.loadClass (Webappclassloader.java:1678)

  4. At Org.apache.catalina.loader.WebappClassLoader.loadClass (Webappclassloader.java:1523)

  5. At Org.apache.catalina.core.DefaultInstanceManager.loadClass (Defaultinstancemanager.java:415)

  6. At Org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged (Defaultinstancemanager.java:397 )

  7. At Org.apache.catalina.core.DefaultInstanceManager.newInstance (Defaultinstancemanager.java:118)

  8. At Org.apache.catalina.core.StandardContext.listenerStart (Standardcontext.java:4660)

  9. At org.apache.catalina.core.standardcontext$1. Call (Standardcontext.java:5226)

  10. At org.apache.catalina.core.standardcontext$1. Call (Standardcontext.java:5221)

  11. At Java.util.concurrent.futuretask$sync.innerrun (Futuretask.java:303)

  12. At Java.util.concurrent.FutureTask.run (Futuretask.java:138)

  13. At Java.util.concurrent.threadpoolexecutor$worker.runtask (Threadpoolexecutor.java:886)

  14. At Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:908)

  15. At Java.lang.Thread.run (Thread.java:662)

Issue Background :

Project for MAVEN Engineering, the Contextloaderlistener class is located in the Spring-web-3.1.0.release.jar package. The pom.xml of Maven was checked, and the dependency was introduced properly. In the project Maven dependencies view, it is also possible to see that the Spring-web-3.1.0.release.jar package is introduced in the normal.

Cause of Error:

Tomcat did not release the jar packages added by Maven dependencies at the time of publishing the project

Solution:

1. Right click on the project-select Properties

Select Deployment Assembly, click the Add button on the right, and select Java Build Path Entries in the popup window. As shown in the following:

2. Click Next to select Maven Dependencies

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

After the operation, redeploy the project, no longer error.

Can be viewed, our deployment is as follows:

So finally we released the war package, extracted after the directory as follows:

Explain: 1. Is the wepapp underneath something we can see the original directory under something, posted in/below

2. This is/src/main/java below the Java source code file, the compiled bytecode file placed under Web-inf/classes

3.mavene Dependeny The following Jia package is published under/web-inf/classes.

Eclipse Error: Java.lang.ClassNotFoundException:Contex

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.