ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
DeploymentAspectManager dam = new DeploymentAspectManagerImpl();
dam.setDeploymentAspects(aspects);
dam.undeploy(deployment);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader);
}
}