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