Source:
<code>public void loadImplementation(Set<String> errors, ManagedViewType<?> managedView, EntityViewManager entityViewManager) { Class<?> javaType = managedView.getJavaType(); Class<?> entityViewImplementationClass; String implementationClassName = getImplementationClassName(javaType, managedView.getJavaType()); try { <START> entityViewImplementationClass = Thread.currentThread().getContextClassLoader().loadClass(implementationClassName); <END> StaticImplementation annotation = entityViewImplementationClass.getAnnotation(StaticImplementation.class); if (annotation != null) { if (annotation.value() != javaType) { errors.add("The static implementation class '" + entityViewImplementationClass.getName() + "' was expected to be defined for the entity view type '" + javaType.getName() + "' but was defined for: " + annotation.value().getName()); return; } } } catch (ClassNotFoundException e) { LOG.fine("Could not load static implementation class '" + implementationClassName + "'"); return; } try { entityViewImplementationClass.getDeclaredField(SerializableEntityViewManager.EVM_FIELD_NAME).set(null, entityViewManager); for (MethodAttribute<?, ?> attribute : managedView.getAttributes()) { entityViewImplementationClass.getDeclaredField(attribute.getName()); } proxyClasses.put(javaType, entityViewImplementationClass); proxyClassesToViewClasses.put(entityViewImplementationClass, javaType); } catch (Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); errors.add("The initialization of the static metamodel class '" + entityViewImplementationClass.getName() + "' failed: " + sw.toString()); } }</code><technical_language>context class loader null, please pass class loader argument loadImplementation method. class loader resolved once</technical_language>

Target:
public void loadImplementation(Set<String> errors, ManagedViewType<?> managedView, EntityViewManager entityViewManager) { Class<?> javaType = managedView.getJavaType(); Class<?> entityViewImplementationClass; String implementationClassName = getImplementationClassName(javaType, managedView.getJavaType()); try { entityViewImplementationClass = javaType.getClassLoader().loadClass(implementationClassName); StaticImplementation annotation = entityViewImplementationClass.getAnnotation(StaticImplementation.class); if (annotation != null) { if (annotation.value() != javaType) { errors.add("The static implementation class '" + entityViewImplementationClass.getName() + "' was expected to be defined for the entity view type '" + javaType.getName() + "' but was defined for: " + annotation.value().getName()); return; } } } catch (ClassNotFoundException e) { LOG.fine("Could not load static implementation class '" + implementationClassName + "'"); return; } try { entityViewImplementationClass.getDeclaredField(SerializableEntityViewManager.EVM_FIELD_NAME).set(null, entityViewManager); for (MethodAttribute<?, ?> attribute : managedView.getAttributes()) { entityViewImplementationClass.getDeclaredField(attribute.getName()); } proxyClasses.put(javaType, entityViewImplementationClass); proxyClassesToViewClasses.put(entityViewImplementationClass, javaType); } catch (Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); errors.add("The initialization of the static metamodel class '" + entityViewImplementationClass.getName() + "' failed: " + sw.toString()); } }