Maven project starts in Eclipse error: java.lang.ClassNotFoundException

Source: Internet
Author: User

Problem:

When creating a Maven project with Eclipse, the associated dependency jar in Pom.xml has been imported, and the java.lang.ClassNotFoundException error is reported, indicating that the associated jar package could not be found, but the Maven The associated jar package can also be found in dependencies.

Cause of the problem:

We enter the deployment path to Tomcat: E:\workplace4.6\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ Springmvc.redis\web-inf, of which e:\ workplace4.6 for your project space, Springmvc.redis for your project name, go in to see and did not generate the Lib directory, normally, will generate a Lib directory, the project all the dependencies are deployed here, not now, so it will be reported Java.lang.ClassNotFoundE Xception error.

Workaround:

Right-click the project name->properties->deployment assembly, such as:

In source, there is no Maven Dependencies, stating that when you start Tomcat, the jar packages in Maven Dependencies are not deployed to the appropriate path. We need to add it up and click on Add->java build Path Entries->next->maven Dependencies, such as:

When you are finished adding the following, as follows:

This way, when you start Tomcat, you deploy all of the jar packages under Maven dependencies to Web-inf/lib, start Tomcat, and then go to E:\workplace4.6\.metadata\.plugins\ Org.eclipse.wst.server.core\tmp0\wtpwebapps\springmvc.redis\web-inf directory, we found that the Lib directory has been generated.

Maven project starts in Eclipse error: java.lang.ClassNotFoundException

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.