spring-bootwebsphere-libertyibm-jdk

IllegalStateException: Failed to introspect Class


In my Spring Boot application where the @ComponentScan is, this is supposed to scan for bean definitions in a separate jar present in the classpath. This is where package "com.mycompany.search.rest" will be present in an external JAR ESExt.jar.

@ComponentScan({"com.myapp.rest","com.mycompany.search.rest"})

I added below configuration in the server.xml file of my WebSphere Liberty Server to include an external folder for classpath scanning

<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>

When I deploy my application in a WebSphere Liberty Server, this throws below exception

[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

Below is the output for 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

What does this exception IllegalStateException: Failed to introspect Class even mean?


Solution

  • Solved it by changing the 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>