We currently generate our proxies with the ClassLoader of the Class which is to be proxies.
But in case of e.g. a producer method for EntityManager.class provided in a shared lib of the container we must not use the shared ClassLoader of the whole container but only the Application ClassLoader - e.g. the EAR ClassLoader or the WAR ClassLoader. Otoh if we proxy a Class from within a WEB-INF/lib jar of a WAR inside an EAR, we shall really use the same ClassLoader than the original Class.