java.lang.IllegalStateException: Failed to introspect Class

异常内容

 [org.springframework.web.context.support.XmlWebApplicationContext]
                [Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminServiceImpl': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.atguigu.crowd.service.impl.AdminServiceImpl] from ClassLoader [ParallelWebappClassLoader
  context: atcrowdfunding02_admin_webuis_war_exploded
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@10e31a9a
]]

错误原因

此异常原因是因为classA中使用了项目没有导入的类,从而导致类加载失败。一般来说如果使用了没有依赖的类应该会报ClassNotFindException的错误,但是如果只是导入却没有使用的使用可能就会报此错误。
通常此错误见与使用maven框架配置了第三方类的scope是provided的情况下。
笔者在使用springSecurity时由于在maven中导入了2个不同版本的jjar包,但是并没有使用,导致此错误。


版权声明:本文为w13346019869原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。