IllegalStateException: Failed to introspect Class

16.5k views Asked by At

I am trying to implement extension capability on my SpringBoot application where the @ComponentScan is supposed to scan for bean definitions in a separate jar present in the classpath.

The @ComponentScan looks like below

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

Where package "com.mycompany.search.rest" will be present in an external jar ESExt.jar

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, it 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? I cannot even find anything about it in the internet.

1

There are 1 answers

0
user1144004 On BEST ANSWER

Solved it by changing the server.xml as below

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