Using the standard getClassLoader()
may not return the right class loader in a JEE context. Instead, go through the
currentThread
.
Noncompliant code example
ClassLoader cl = this.getClass().getClassLoader(); // Noncompliant
Compliant solution
ClassLoader cl = Thread.currentThread().getContextClassLoader();