diff --git a/security/src/main/java/org/jboss/as/security/service/SecurityActions.java b/security/src/main/java/org/jboss/as/security/service/SecurityActions.java
index <HASH>..<HASH> 100644
--- a/security/src/main/java/org/jboss/as/security/service/SecurityActions.java
+++ b/security/src/main/java/org/jboss/as/security/service/SecurityActions.java
@@ -43,7 +43,7 @@ class SecurityActions {
         try {
             return AccessController.doPrivileged(new PrivilegedExceptionAction<ModuleClassLoader>() {
                 public ModuleClassLoader run() throws ModuleLoadException {
-                    ModuleLoader loader = Module.getCurrentModuleLoader();
+                    ModuleLoader loader = Module.getCallerModuleLoader();
                     ModuleIdentifier identifier = ModuleIdentifier.fromString(moduleSpec);
                     return loader.loadModule(identifier).getClassLoader();
                 }
Getting rid of deprecated method