Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext

 The relevant spring framework package has been imported, and the error shows that the Spring Framework-related class library is wrong or cannot be found. The code still runs and reports an error, as shown in the figure below,

Problem : Click on the project, Alt + Enter to enter, as shown in the figure below, the jar package imported by the required jar package has not been added to the Classpath , but only added to the Modulpath.

 Solution: Click Classpath, click Add External JARs on the right to add the required package, save and apply, re-run the code, and the exception is resolved.

 Other error conditions:

1. Confirm whether the jar package itself is added, not the folder or compressed package where it is located.

2. In many cases, after copying the jar package to the specified directory, you need to add the full path of the jar package to the CLASSPATH, otherwise problems such as ClassNotFoundException may occur.

3. The version of dependencies is incompatible, and the version used at compile time is different from the version used at runtime.

4. So please check whether your CLASSPATH contains the full path of the jar package.


Other extensions:

The difference between Modelpath and ClassPath in eclipse - Programmer Sought

Why do you need to add to build path after importing the jar package? ? ? _chenzeyang's Blog Blog - CSDN Blog

The difference between classpath and moduelepath when importing jar packages in eclipse, where should jia packages be placed_eclipe modulepath and classpath_Tao_Yuanqiang's Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/weixin_58707437/article/details/130201431