Failed to introspect Class[xxx.CommonsMultipartResolver]from ClassLoader[ParallelWebappClassLoader

异常描述

启动项目正常当访问接口的时页面抛出了以下异常:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'multipartResolver': 
Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class 
[org.springframework.web.multipart.commons.CommonsMultipartResolver] from ClassLoader [ParallelWebappClassLoader

在这里插入图片描述
于是定位到错误日志最开始的地方也就是:
org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)然后我们重启服务器将断点加在 ReflectionUtils.java 第481行的位置。
在这里插入图片描述
然后我们重启一下服务器然后当断点走到这一步时候我们发现了一个异常如下所示:
在这里插入图片描述
而这个缺失的类是 Apache Commons FileUpload 组件所以我们导入其相关的依赖就好。

<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.4</version>
</dependency>

重启服务器问题解决。

猜你喜欢

转载自blog.csdn.net/javaee_gao/article/details/106121786