【问题标题】:IllegalStateException: Failed to introspect ClassIllegalStateException:无法自省类
【发布时间】:2020-09-28 08:39:22
【问题描述】:

我正在尝试在我的 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 甚至意味着什么?我什至在互联网上都找不到任何关于它的信息。

【问题讨论】:

    标签: spring-boot websphere-liberty ibm-jdk


    【解决方案1】:

    通过如下更改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>
    

    【讨论】:

      猜你喜欢
      • 2019-05-11
      • 2019-04-16
      • 2022-10-25
      • 2017-11-22
      • 2023-02-14
      • 2023-01-13
      • 2019-07-27
      • 2021-01-04
      • 1970-01-01
      相关资源
      最近更新 更多