diff --git a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ApplicationLifecycle.java b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ApplicationLifecycle.java index 0ec9bec3a6a..0250a955b31 100644 --- a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ApplicationLifecycle.java +++ b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ApplicationLifecycle.java @@ -46,6 +46,7 @@ import com.sun.enterprise.config.serverbeans.*; import com.sun.enterprise.deploy.shared.ArchiveFactory; import com.sun.enterprise.deploy.shared.FileArchive; +import com.sun.enterprise.loader.CachingReflectionUtil; import com.sun.enterprise.util.LocalStringManagerImpl; import com.sun.enterprise.util.io.FileUtils; import fish.payara.enterprise.config.serverbeans.DeploymentGroup; @@ -393,10 +394,16 @@ public void actOn(Logger logger) { return null; } + span.start(DeploymentTracing.AppStage.PREPARE, "ClassLoaderHierarchy"); + ClassLoaderHierarchy clh = habitat.getService(ClassLoaderHierarchy.class); + span.start(DeploymentTracing.AppStage.CLASS_SCANNING); Types types = null; if (handler.requiresAnnotationScanning(context.getSource())) { + // web container needs to be loaded before deployable classes can be determined correctly + habitat.getService(CachingReflectionUtil + .getClass("com.sun.enterprise.web.WebContainer", clh.getCommonClassLoader())); types = getDeployableTypes(context); } @@ -417,10 +424,6 @@ public void actOn(Logger logger) { final Collection selectedSniffers = sniffers; appState.ifPresent(s -> s.setSniffers(selectedSniffers)); - span.start(DeploymentTracing.AppStage.PREPARE, "ClassLoaderHierarchy"); - - ClassLoaderHierarchy clh = habitat.getService(ClassLoaderHierarchy.class); - span.start(DeploymentTracing.AppStage.PREPARE, "ClassLoader"); context.createDeploymentClassLoader(clh, handler);