There may be many reasons for this problem, but the final cause is that there is no such package in the deployed project file.
So where's the wrong point? Exclude each!
1. The appropriate jar package is not added to the project file first, and can be seen in the Maven Dependencis folder. If not, add a dependency configuration in the Pom file, or if so, the problem goes to the second step
2. Find the corresponding jar package file in Maven's local repository, double-click try to open it, if there is an error saying that the file is damaged or incomplete (I guess it may be that the previous Maven download was interrupted because of the network, no download completed,
The next time the Pom in the Maven warehouse to introduce the local jar package will not be downloaded from the official website, directly take the last torn file, so it will be wrong, the solution is to remove the jar package file, re-update the pom file, let maven re-download the jar to the local repository.
If you find that the jar package for the local repository does not get an error, then go to the third step.
3. The final reason is that the MAVEN project's jar package is not published to the deployed project file. Enter the deployment path to Tomcat. Metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ under the check, hair
Now that the project is deployed, the Lib directory is not generated under the Web-inf folder, and under normal circumstances, the Lib directory is generated and all dependent jar packages for the project are deployed to that directory.
Solution:
1). Right click on 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. Then we go to the. Metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ directory, found in the project Web-inf directory automatically generated Lib directory, And all the dependent jar packages have been deployed. The problem is therefore resolved.
Solutions for Java.lang.ClassNotFoundException