No exception of type BeansException can be thrown; an exception type must be a sunclass of Throwable

This error occurred when I was reviewing spring today.

The literal meaning is that BeansException is not an exception class and cannot be thrown. Only subclasses of Throwable are exceptions.

I searched for some information on the Internet, but the same article was circulated around. The probably explanation is that the jar package is missing or the wrong version of the jar package is used.

Then I checked and found that the jar package in the project was complete and the version was OK.

Then I guessed: Maybe the BeansException class in the spring-beans-4.3.9RELEASE.jar package in the project does not inherit the Throwable class. This means that although the spring-beans-4.3.9RELEASE.jar package exists, this package is Wrong or incomplete.

The reason why the package is incomplete is that there is a problem with the source of the package. The source of my jar package is: eclipse integrates maven. After configuring the dependencies in pom.xml, download the required jar package.

As we all know, the download of eclipse is very slow. It is very likely that there is a problem with the download of eclipse.

So I closed eclipse, entered the maven repository and deleted the org/springframework directory. Then I entered the project path with a command prompt and executed mvn clean compile. I used the command prompt to download the jar package. After the download was completed, I opened eclipse. I was done and the problem was solved.

Guess you like

Origin blog.csdn.net/a805727141/article/details/75137348