IllegalStateException:无法自省 Class
IllegalStateException: Failed to introspect Class
我正在尝试在我的 SpringBoot 应用程序上实现扩展功能,其中 @ComponentScan 应该扫描类路径中存在的单独 jar 中的 bean 定义。
@ComponentScan 如下所示
@ComponentScan({"com.myapp.rest","com.mycompany.search.rest"})
包“com.mycompany.search.rest”将出现在外部 jar 中 ESExt.jar
我在我的 WebSphere Liberty Server 的 server.xml
文件中添加了以下配置,以包含用于类路径扫描的外部文件夹
<library id="extention" apiTypeVisibility="+third-party, -api">
<fileset dir="${server.config.dir}/ext" includes="*.jar" scanInterval="5s" />
</library>
<webApplication id="Myapp" location="Myapp.war" type="war" name="Myapp" contextRoot="/resources">
<classloader commonLibraryRef="extention" />
</webApplication>
当我在 WebSphere Liberty Server 中部署我的应用程序时,它抛出以下异常
[28/9/20 13:43:04:878 IST] 0000002a com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'storeResource': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.mycompany.search.rest.StoreResource] from ClassLoader [com.ibm.ws.classloading.internal.AppClassLoader@7a84a757] com.ibm.ws.webcontainer.osgi.DynamicVirtualHost startWebApp" at ffdc_20.09.28_13.43.04.0.log
下面是 jar -tf ESExt.jar
的输出
META-INF/
META-INF/MANIFEST.MF
com/
com/mycompany/
com/mycompany/search/
com/mycompany/search/rest/
com/mycompany/search/rest/StoreResource.class
这个异常 IllegalStateException: Failed to introspect Class
到底是什么意思?我什至在互联网上找不到任何相关信息。
通过如下更改 server.xml
解决了问题
<library id="extension">
<fileset dir="${server.config.dir}/ext" includes="*.jar" scanInterval="5s" />
</library>
<webApplication id="Myapp" location="Myapp.war" type="war" name="Myapp" contextRoot="/resources">
<classloader commonLibraryRef="extension" delegation="parentFirst"/>
</webApplication>
我正在尝试在我的 SpringBoot 应用程序上实现扩展功能,其中 @ComponentScan 应该扫描类路径中存在的单独 jar 中的 bean 定义。
@ComponentScan 如下所示
@ComponentScan({"com.myapp.rest","com.mycompany.search.rest"})
包“com.mycompany.search.rest”将出现在外部 jar 中 ESExt.jar
我在我的 WebSphere Liberty Server 的 server.xml
文件中添加了以下配置,以包含用于类路径扫描的外部文件夹
<library id="extention" apiTypeVisibility="+third-party, -api">
<fileset dir="${server.config.dir}/ext" includes="*.jar" scanInterval="5s" />
</library>
<webApplication id="Myapp" location="Myapp.war" type="war" name="Myapp" contextRoot="/resources">
<classloader commonLibraryRef="extention" />
</webApplication>
当我在 WebSphere Liberty Server 中部署我的应用程序时,它抛出以下异常
[28/9/20 13:43:04:878 IST] 0000002a com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'storeResource': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.mycompany.search.rest.StoreResource] from ClassLoader [com.ibm.ws.classloading.internal.AppClassLoader@7a84a757] com.ibm.ws.webcontainer.osgi.DynamicVirtualHost startWebApp" at ffdc_20.09.28_13.43.04.0.log
下面是 jar -tf ESExt.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/mycompany/
com/mycompany/search/
com/mycompany/search/rest/
com/mycompany/search/rest/StoreResource.class
这个异常 IllegalStateException: Failed to introspect Class
到底是什么意思?我什至在互联网上找不到任何相关信息。
通过如下更改 server.xml
解决了问题
<library id="extension">
<fileset dir="${server.config.dir}/ext" includes="*.jar" scanInterval="5s" />
</library>
<webApplication id="Myapp" location="Myapp.war" type="war" name="Myapp" contextRoot="/resources">
<classloader commonLibraryRef="extension" delegation="parentFirst"/>
</webApplication>