Hello,
During our load tests, via the Dynatrace monitoring tool, we noted the presence of many exceptions of type: “org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [*]”
Technos: SpringBoot version: 1.5.16.RELEASE, Hibernate version: 5.0.12.Final, WebLogic Server version: 12.2.1.3.0
These exceptions do not block the processes because the requests work correctly, they are invisible in console (we have never seen their presence outside of dynatrace or debug) but are expensive in terms of performance.
We were able to reproduce locally (on Tomcat) by adding a breakpoint in the ClassLoaderServiceImpl class on this part of the code:
public Class classForName (String className) {
try {
return Class.forName (className, true, this.getAggregatedClassLoader ());
} catch (Exception var3) {
throw new ClassLoadingException (“Unable to load class [” + className + “]”, var3);
} catch (LinkageError var4) {
throw new ClassLoadingException (“Unable to load class [” + className + “]”, var4);
}
}
After several tests, it seems that the exceptions appear when the application is started (specifically when loading JPQL queries) and when these queries are executed:
Example:
@Query (“SELECT foyer FROM FoyerEntity foyer”
- “LEFT JOIN FETCH foyer.compoFoyerEntityList compoFoyer”
- “LEFT JOIN FETCH compoFoyer.personneEntity person”
- “LEFT JOIN FETCH personne.situationProfessionnelleEntityList situationPro”
- “LEFT JOIN FETCH foyer.situationFamilialeEntityList situationFam”
- “LEFT JOIN FETCH foyer.maintienDroitEntity maintenanceDroit”
- “LEFT JOIN FETCH foyer.rattachementLogementEntityList logementList”
- “LEFT JOIN FETCH housingList.logementEntity housing”
- “WHERE foyer.idFoyer =: idFoyer”)
FoyerEntity findFoyerByIdFoyer (@Param (“idFoyer”) Long idFoyer);
On this request we have 12 ClassLoaderException exceptions:
Org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [**. ****. ***. *********. Entity.foyer]
Org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [foyer]
Org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [compoFoyer]
Org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [person]
Org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [foyer]
Org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [logementList]
…
We don’t know why this specifically targets JPQL queries and we don’t know what to do to resolve them.
Thanks for your help