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>

重啓服務器問題解決。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章