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.