diff --git a/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorClassLoaderServiceImpl.java b/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorClassLoaderServiceImpl.java index c3a527b1da3..843503e041d 100644 --- a/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorClassLoaderServiceImpl.java +++ b/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorClassLoaderServiceImpl.java @@ -137,8 +137,7 @@ public DelegatingClassLoader run() { } return currentValue; }; - if (DeploymentUtils.useWarLibraries(Globals.getDefaultHabitat().getService(Deployment.class) - .getCurrentDeploymentContext())) { + if (DeploymentUtils.useWarLibraries(DeploymentUtils.getCurrentDeploymentContext())) { return globalConnectorWithWarLibCL.updateAndGet(updateOperator); } else { return globalConnectorCL.updateAndGet(updateOperator); diff --git a/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorsClassLoaderUtil.java b/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorsClassLoaderUtil.java index aacd7a4a5de..16368f267cf 100644 --- a/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorsClassLoaderUtil.java +++ b/appserver/connectors/connectors-internal-api/src/main/java/com/sun/appserv/connectors/internal/api/ConnectorsClassLoaderUtil.java @@ -228,8 +228,7 @@ public Collection getSystemRARClassLoaders() throws Connec } public ClassLoader getCommonClassLoader() { - if (DeploymentUtils.useWarLibraries(Globals.getDefaultHabitat().getService(Deployment.class) - .getCurrentDeploymentContext())) { + if (DeploymentUtils.useWarLibraries(DeploymentUtils.getCurrentDeploymentContext())) { return warLibClassLoader.updateAndGet(currentValue -> { if (currentValue == null) { var newValue = new CurrentBeforeParentClassLoader(InstalledLibrariesResolver.getWarLibraries() diff --git a/nucleus/deployment/common/src/main/java/org/glassfish/deployment/common/DeploymentUtils.java b/nucleus/deployment/common/src/main/java/org/glassfish/deployment/common/DeploymentUtils.java index f5fab52f7e1..9ea44d5fefb 100644 --- a/nucleus/deployment/common/src/main/java/org/glassfish/deployment/common/DeploymentUtils.java +++ b/nucleus/deployment/common/src/main/java/org/glassfish/deployment/common/DeploymentUtils.java @@ -57,7 +57,6 @@ import org.glassfish.hk2.classmodel.reflect.Type; import org.glassfish.internal.api.Globals; import org.glassfish.internal.deployment.Deployment; -import org.glassfish.internal.deployment.ExtendedDeploymentContext; import org.glassfish.loader.util.ASClassLoaderUtil; @@ -463,14 +462,18 @@ public static List getExternalLibraries(ReadableArchive archive) { } catch (Exception e) { Logger.getAnonymousLogger().log(Level.WARNING, e.getMessage(), e); } - ExtendedDeploymentContext context = null; - try { - context = Globals.getDefaultHabitat().getService(Deployment.class).getCurrentDeploymentContext(); - } catch (Exception e) { } - externalLibURIs.addAll(getWarLibraryURIs(context)); + externalLibURIs.addAll(getWarLibraryURIs(getCurrentDeploymentContext())); return externalLibURIs; } + public static DeploymentContext getCurrentDeploymentContext() { + try { + return Globals.getDefaultHabitat().getService(Deployment.class).getCurrentDeploymentContext(); + } catch (Exception e) { + return null; + } + } + public static List getWarLibraryURIs(DeploymentContext context) { if(useWarLibraries(context)) { return InstalledLibrariesResolver.getWarLibraries().stream()