Maven Project starts error in eclipse: Java.lang.ClassNotFoundException__eclipse

Source: Internet
Author: User
Tags redis

Problem:

When you create a MAVEN project with Eclipse, the dependent jar associated with pom.xml is imported, and the java.lang.ClassNotFoundException error is reported, prompting you to find the associated jar package, but in Maven The associated jar package can also be found in the dependencies.

Problem Reason:

We go into Tomcat's deployment path: 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 look and do not generate Lib directory, under normal circumstances, will generate Lib directory, the project all the dependencies are deployed here, now there is no, so will be reported Java.lang.ClassNotFoundE Xception error.

Workaround:

Right-key project name->properties->deployment assembly, as shown in the following figure:

In source, there is no maven dependencies, which means that when you start Tomcat, you will not deploy the jar package in the Maven dependencies to the appropriate path. We need to add it up, click Add->java Build Path Entries->next->maven dependencies, as shown below:

After you add it, as follows:

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

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.