异常解决:java.lang.IllegalStateException: Failed to introspect Class

异常详情

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name xxxxx

Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [classA] from ClassLoader [sun.misc.Launcher$AppClassLoader@14dad5dc]

原因

此异常原因是因为classA中使用了项目没有导入的类,从而导致类加载失败。一般来说如果使用了没有依赖的类应该会报ClassNotFindException的错误
通常此错误见与使用maven框架配置了第三方类的scope是provided的情况下。

注意: 启动的子模块中一定要引入该jar包

(有时候项目中依赖了该jar包, 但是在启动模块中排除或者其他原因导致没有引入)

解决办法

检查classA类中可能存在的没有依赖的类或者包,将之导入(或者加入maven依赖、或调整依赖的包中的依赖的scope),总之使其类加载器能够在当期classPath找到此类即可。

原文地址:
https://blog.csdn.net/huitoukest/article/details/88013763
https://blog.csdn.net/huitoukest/article/details/88013763
 
原文地址:https://www.cnblogs.com/daixianjun/p/IllegalStateException.html