0

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

  • The answers of this question may help you: https://stackoverflow.com/questions/43578991/caused-by-org-hibernate-boot-registry-classloading-spi-classloadingexception-u – rmunge Jun 07 '20 at 16:25
  • Thank you for the response. In my case, we do not use any file 'hibernate.cfg.xml' but only spring boot annotations. I also specified that this does not generate a compilation error nor error on request but only silent exceptions (wich have impact on performance). It seems to happen a lot when we use EntityGraph – Mehdi stark Jun 08 '20 at 01:41
  • Do you have a stacktrace or do you know where the call of ClassLoaderServiceImpl#forName is initialted? And how to do actually execute the query? – rmunge Jun 20 '20 at 22:49
  • Hello @munge, thank you for your response, actually the stacktrace is only what i wrote at the end of the post, it really happen when i start the application when the requests are loaded, and when i the request is being processed. Instead of looking for the Entity path, it is looking for not real object like 'person" (name present on the request) – Mehdi stark Jul 23 '20 at 09:04

0 Answers0