Merge pull request #23893 from dmatej/sync-to-6.x

Sync from master to 6.x
diff --git a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java
index 3789d09..5456775 100644
--- a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java
+++ b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java
@@ -378,13 +378,10 @@
 
         prepareURLStreamHandling();
 
-        //This is required for us to enable interrupt jaxws service
-        //creation calls
-        System.setProperty("jakarta.xml.ws.spi.Provider",
-                           "com.sun.enterprise.webservice.spi.ProviderImpl");
+        //This is required for us to enable interrupt jaxws service creation calls
+        System.setProperty("jakarta.xml.ws.spi.Provider", "com.sun.xml.ws.spi.ProviderImpl");
         //InjectionManager's injectClass will be called from getMainMethod
 
-
         // Load any managed beans
         ManagedBeanManager managedBeanManager = habitat.getService(ManagedBeanManager.class);
         managedBeanManager.loadManagedBeans(desc.getApplication());
diff --git a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ProviderContainerContractInfoImpl.java b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ProviderContainerContractInfoImpl.java
index fb2300a..b35a6dc 100644
--- a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ProviderContainerContractInfoImpl.java
+++ b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ProviderContainerContractInfoImpl.java
@@ -67,10 +67,12 @@
         this.applicationLocation = applicationLocation;
     }
 
+    @Override
     public ClassLoader getClassLoader() {
         return classLoader;
     }
 
+    @Override
     public ClassLoader getTempClassloader() {
         return AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
 
@@ -82,6 +84,7 @@
             });
     }
 
+    @Override
     public void addTransformer(ClassTransformer transformer) {
         final TransformerWrapper tw = new TransformerWrapper(transformer, classLoader);
         if (inst != null) {
@@ -91,29 +94,35 @@
         }
     }
 
+    @Override
     public String getApplicationLocation() {
         return applicationLocation;
     }
 
+    @Override
     public ValidatorFactory getValidatorFactory() {
         // TODO: Need to implement this correctly.
         return null;
     }
 
     // TODO: remove after persistence is refactored.
+    @Override
     public DeploymentContext getDeploymentContext() {
         return null;
     }
 
+    @Override
     public boolean isJava2DBRequired() {
         // Returns whether Java2DB is required or not. For an AppClient it is always false
         return false;
     }
 
+    @Override
     public void registerEMF(String unitName, String persistenceRootUri, RootDeploymentDescriptor containingBundle, EntityManagerFactory emf) {
         emfs.add(emf);
     }
 
+    @Override
     public String getJTADataSourceOverride() {
         // Returns whether JTA datasource is overridden. For an appclient it is never the case.
         return null;
@@ -139,6 +148,7 @@
             this.classLoader = classLoader;
         }
 
+        @Override
         public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
             /*
              * Do not even bother running the transformer unless the loader
diff --git a/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/callback/BaseContainerCallbackHandler.java b/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/callback/BaseContainerCallbackHandler.java
index e0dd7a9..8366c1e 100644
--- a/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/callback/BaseContainerCallbackHandler.java
+++ b/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/jmac/callback/BaseContainerCallbackHandler.java
@@ -1,6 +1,6 @@
 /*
+ * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -307,6 +307,19 @@
         final Subject fs = cpCallback.getSubject();
         Principal principal = cpCallback.getPrincipal();
 
+        // See if we need to wrap back the principal. This looks weird, but is needed for the
+        // check to re-use that is done below to work.
+        if (principal != null && !(principal instanceof WebPrincipal)) {
+            Principal sessionPrincipal = SecurityContext.getCurrent().getSessionPrincipal();
+            if (sessionPrincipal instanceof WebPrincipal) {
+                WebPrincipal webPrincipalFromSession = (WebPrincipal) sessionPrincipal;
+
+                if (webPrincipalFromSession.getCustomPrincipal() == principal) {
+                    principal = webPrincipalFromSession;
+                }
+            }
+        }
+
         if (principal instanceof WebPrincipal) {
             WebPrincipal wp = (WebPrincipal) principal;
             /**
diff --git a/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/web/integration/WebPrincipal.java b/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/web/integration/WebPrincipal.java
index 5c794a9..c3536ae 100644
--- a/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/web/integration/WebPrincipal.java
+++ b/appserver/security/core-ee/src/main/java/com/sun/enterprise/security/web/integration/WebPrincipal.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -84,6 +85,10 @@
         return securityContext;
     }
 
+    public Principal getCustomPrincipal() {
+        return customPrincipal;
+    }
+
     @Override
     public String getName() {
         if (customPrincipal == null) {
diff --git a/appserver/security/webintegration/src/main/java/com/sun/web/security/RealmAdapter.java b/appserver/security/webintegration/src/main/java/com/sun/web/security/RealmAdapter.java
index a56dc13..aa035a2 100644
--- a/appserver/security/webintegration/src/main/java/com/sun/web/security/RealmAdapter.java
+++ b/appserver/security/webintegration/src/main/java/com/sun/web/security/RealmAdapter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021 Contributors to the Eclipse Foundation.
+ * Copyright 2021, 2022 Contributors to the Eclipse Foundation.
  * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -80,6 +80,7 @@
 import org.apache.catalina.HttpResponse;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.authenticator.AuthenticatorBase;
+import org.apache.catalina.connector.RequestFacade;
 import org.apache.catalina.deploy.LoginConfig;
 import org.apache.catalina.deploy.SecurityConstraint;
 import org.apache.catalina.realm.Constants;
@@ -479,8 +480,11 @@
             // Jakarta Authentication is enabled for this application
             try {
                 context.fireContainerEvent(BEFORE_AUTHENTICATION, null);
+                RequestFacade requestFacade = (RequestFacade) request.getRequest();
+                SecurityContext.getCurrent().setSessionPrincipal(requestFacade.getRequestPrincipal());
                 return validate(request, response, config, authenticator, calledFromAuthenticate);
             } finally {
+                SecurityContext.getCurrent().setSessionPrincipal(null);
                 context.fireContainerEvent(AFTER_AUTHENTICATION, null);
             }
         }
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/ClusterITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/ClusterITest.java
index 9794619..aaaa56c 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/ClusterITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/ClusterITest.java
@@ -90,8 +90,8 @@
     @Test
     @Order(3)
     public void startInstancesTest() {
-        assertThat(ASADMIN.exec(30_000, false, "start-local-instance", INSTANCE_NAME_1), asadminOK());
-        assertThat(ASADMIN.exec(30_000, false, "start-local-instance", INSTANCE_NAME_2), asadminOK());
+        assertThat(ASADMIN.exec(30_000, "start-local-instance", INSTANCE_NAME_1), asadminOK());
+        assertThat(ASADMIN.exec(30_000, "start-local-instance", INSTANCE_NAME_2), asadminOK());
     }
 
     @Test
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/DetachAttachITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/DetachAttachITest.java
index 0c7d3e5..58de9a9 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/DetachAttachITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/DetachAttachITest.java
@@ -19,28 +19,26 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.StringTokenizer;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.glassfish.main.admin.test.tool.asadmin.Asadmin;
 import org.glassfish.main.admin.test.tool.asadmin.AsadminResult;
+import org.glassfish.main.admin.test.tool.asadmin.DetachedTerseAsadminResult;
 import org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.hasSize;
 import static org.hamcrest.Matchers.not;
 import static org.hamcrest.Matchers.stringContainsInOrder;
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -51,10 +49,12 @@
 /**
  * @author martinmares
  */
+@ExtendWith(JobTestExtension.class)
 public class DetachAttachITest {
     private static final Logger LOG = Logger.getLogger(DetachAttachITest.class.getName());
     private static final Asadmin ASADMIN = GlassFishTestEnvironment.getAsadmin();
 
+
     @Test
     public void uptimePeriodically() throws Exception {
         Set<String> ids = new HashSet<>();
@@ -62,9 +62,9 @@
             LOG.log(Level.FINE, "detachAndAttachUptimePeriodically(): round " + i);
             final String id;
             {
-                AsadminResult result = ASADMIN.execDetached("--terse", "uptime");
+                DetachedTerseAsadminResult result = ASADMIN.execDetached("uptime");
                 assertThat(result, asadminOK());
-                id = parseJobIdFromEchoTerse(result.getStdOut());
+                id = result.getJobId();
                 assertTrue(ids.add(id));
             }
             Thread.sleep(1000L);
@@ -79,47 +79,36 @@
 
     @Test
     public void commandWithProgressStatus() throws Exception {
-        AsadminResult result = ASADMIN.execDetached("--terse", "progress-custom", "6x1");
-        assertThat(result, asadminOK());
-        String id = parseJobIdFromEchoTerse(result.getStdOut());
+        final DetachedTerseAsadminResult detached = ASADMIN.execDetached("progress-custom", "6x1");
+        assertThat(detached, asadminOK());
         Thread.sleep(2000L);
-        // Now attach running
-        result = ASADMIN.exec("attach", id);
-        assertThat(result, asadminOK());
-        assertThat(result.getStdOut(), stringContainsInOrder("progress-custom"));
-        List<ProgressMessage> prgs = ProgressMessage.grepProgressMessages(result.getStdOut());
+        final AsadminResult attachResult = ASADMIN.exec("attach", detached.getJobId());
+        assertThat(attachResult, asadminOK());
+        assertThat(attachResult.getStdOut(), stringContainsInOrder("progress-custom"));
+        List<ProgressMessage> prgs = ProgressMessage.grepProgressMessages(attachResult.getStdOut());
         assertFalse(prgs.isEmpty());
         assertThat(prgs.get(0).getValue(), greaterThan(0));
         assertEquals(100, prgs.get(prgs.size() - 1).getValue());
         // Now attach finished - must NOT exist - seen progress job is removed
-        assertThat(ASADMIN.exec("attach", id), not(asadminOK()));
+        assertThat(ASADMIN.exec("attach", detached.getJobId()), not(asadminOK()));
     }
 
 
     @Test
     public void detachOnesAttachMulti() throws Exception {
-        ExecutorService pool = Executors.newCachedThreadPool(new ThreadFactory() {
-            @Override
-            public Thread newThread(Runnable r) {
-                Thread result = new Thread(r);
-                result.setDaemon(true);
-                return result;
-            }
+        ExecutorService pool = Executors.newCachedThreadPool(r -> {
+            Thread result = new Thread(r);
+            result.setDaemon(true);
+            return result;
         });
-        AsadminResult result = ASADMIN.execDetached("--terse", "progress-custom", "8x1");
+        final DetachedTerseAsadminResult result = ASADMIN.execDetached("progress-custom", "8x1");
         assertThat(result, asadminOK());
-        final String id = parseJobIdFromEchoTerse(result.getStdOut());
-        assertNotNull(id, "id");
+        assertNotNull(result.getJobId(), "id");
         Thread.sleep(1500L);
         final int attachCount = 3;
         Collection<Callable<AsadminResult>> attaches = new ArrayList<>(attachCount);
         for (int i = 0; i < attachCount; i++) {
-            attaches.add(new Callable<AsadminResult>() {
-                @Override
-                public AsadminResult call() throws Exception {
-                    return ASADMIN.exec("attach", id);
-                }
-            });
+            attaches.add(() -> ASADMIN.exec("attach", result.getJobId()));
         }
         List<Future<AsadminResult>> results = pool.invokeAll(attaches);
         for (Future<AsadminResult> fRes : results) {
@@ -132,10 +121,4 @@
             assertEquals(100, prgs.get(prgs.size() - 1).getValue());
         }
     }
-
-    private String parseJobIdFromEchoTerse(String str) {
-        List<Object> stok = Collections.list(new StringTokenizer(str));
-        assertThat(stok, hasSize(1));
-        return (String) stok.get(0);
-    }
 }
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/JobManagerITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/JobManagerITest.java
index 40ba44a..8e6bfc4 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/JobManagerITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/JobManagerITest.java
@@ -19,19 +19,17 @@
 
 import org.glassfish.main.admin.test.tool.asadmin.Asadmin;
 import org.glassfish.main.admin.test.tool.asadmin.AsadminResult;
-import org.junit.jupiter.api.BeforeEach;
+import org.glassfish.main.admin.test.tool.asadmin.DetachedTerseAsadminResult;
 import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
-
-import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
-import static org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment.deleteJobsFile;
-import static org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment.deleteOsgiDirectory;
-import static org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment.getAsadmin;
-
 import org.junit.jupiter.api.Order;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestMethodOrder;
+import org.junit.jupiter.api.extension.ExtendWith;
 
+import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
+import static org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment.getAsadmin;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.matchesPattern;
 import static org.hamcrest.Matchers.stringContainsInOrder;
 
 /**
@@ -40,19 +38,13 @@
  * @author Bhakti Mehta
  * @author David Matejcek
  */
+@ExtendWith(JobTestExtension.class)
 @TestMethodOrder(OrderAnnotation.class)
 public class JobManagerITest {
 
     private static final String COMMAND_PROGRESS_SIMPLE = "progress-simple";
     private static final Asadmin ASADMIN = getAsadmin();
 
-    @BeforeEach
-    public void setUp() throws Exception {
-        assertThat(ASADMIN.exec("stop-domain"), asadminOK());
-        deleteJobsFile();
-        deleteOsgiDirectory();
-        assertThat(ASADMIN.exec("start-domain"), asadminOK());
-    }
 
     @Test
     @Order(1)
@@ -66,46 +58,37 @@
     @Test
     @Order(2)
     public void jobSurvivesRestart() throws Exception {
-        assertThat(ASADMIN.exec("--terse", "progress-simple"), asadminOK());
-        assertThat(ASADMIN.exec("list-jobs").getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE, "COMPLETED"));
-        assertThat(ASADMIN.exec("list-jobs", "1").getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE, "COMPLETED"));
-
+        assertThat(ASADMIN.exec(COMMAND_PROGRESS_SIMPLE), asadminOK());
         assertThat(ASADMIN.exec("stop-domain"), asadminOK());
         assertThat(ASADMIN.exec("start-domain"), asadminOK());
-        AsadminResult result = ASADMIN.exec("list-jobs", "1");
-        assertThat(result, asadminOK());
-        assertThat(result.getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE, "COMPLETED"));
+        assertThat(ASADMIN.exec("list-jobs").getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE, "COMPLETED"));
     }
 
 
     @Test
     @Order(3)
     public void detachAndAttach() throws Exception {
-        assertThat(ASADMIN.execDetached(COMMAND_PROGRESS_SIMPLE).getStdOut(), stringContainsInOrder("Job ID: "));
-        assertThat(ASADMIN.exec("list-jobs", "1").getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE));
-        assertThat(ASADMIN.exec("attach", "1"), asadminOK());
+        DetachedTerseAsadminResult detached = ASADMIN.execDetached(COMMAND_PROGRESS_SIMPLE);
+        assertThat(detached.getJobId(), matchesPattern("[1-9][0-9]*"));
+        assertThat(ASADMIN.exec("list-jobs", detached.getJobId()).getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE));
+        assertThat(ASADMIN.exec("attach", detached.getJobId()), asadminOK());
 
         // list-jobs and it should be purged since the user
         // starting is the same as the user who attached to it
-        assertThat(ASADMIN.exec("list-jobs").getOutput(), stringContainsInOrder("Nothing to list"));
+        assertThat(ASADMIN.exec("list-jobs", detached.getJobId()).getOutput(), stringContainsInOrder("Nothing to list"));
     }
 
 
     @Test
     @Order(4)
-    public void runConfigureManagedJobsTest() throws Exception {
-        assertThat(ASADMIN.exec("configure-managed-jobs", "--job-retention-period=60s", "--cleanup-initial-delay=1s", "--cleanup-poll-interval=1s"), asadminOK());
+    public void runSynchronously() throws Exception {
         assertThat(ASADMIN.exec(COMMAND_PROGRESS_SIMPLE), asadminOK());
-        assertThat(ASADMIN.exec("list-jobs", "1").getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE));
+        assertThat(ASADMIN.exec("list-jobs").getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE));
 
-        // FIXME: Random race condition on Linux caused by some bug in restart-domain; 4848 port is then blocked for start-domain in setUp();
-        assertThat(ASADMIN.exec("stop-domain"), asadminOK());
-        assertThat(ASADMIN.exec("start-domain"), asadminOK());
-        assertThat(ASADMIN.exec("list-jobs", "1").getStdOut(), stringContainsInOrder(COMMAND_PROGRESS_SIMPLE));
-
-        assertThat(ASADMIN.exec("configure-managed-jobs", "--job-retention-period=1s", "--cleanup-initial-delay=1s", "--cleanup-poll-interval=1s"), asadminOK());
-        Thread.sleep(2100L);
-        assertThat(ASADMIN.exec("list-jobs").getOutput(), stringContainsInOrder("Nothing to list"));
-        assertThat(ASADMIN.exec("configure-managed-jobs", "--job-retention-period=1h", "--cleanup-initial-delay=5m", "--cleanup-poll-interval=20m"), asadminOK());
+        assertThat(ASADMIN.exec("configure-managed-jobs", "--job-retention-period=1s", "--cleanup-initial-delay=1s",
+            "--cleanup-poll-interval=1s"), asadminOK());
+        Thread.sleep(1100L);
+        assertThat("Completed jobs should be removed", ASADMIN.exec("list-jobs").getOutput(),
+            stringContainsInOrder("Nothing to list"));
     }
 }
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/JobTestExtension.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/JobTestExtension.java
new file mode 100644
index 0000000..b052df2
--- /dev/null
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/JobTestExtension.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.main.admin.test.progress;
+
+import org.glassfish.main.admin.test.tool.asadmin.Asadmin;
+import org.glassfish.main.admin.test.tool.asadmin.AsadminResult;
+import org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
+import org.junit.jupiter.api.extension.ExtensionContext.Store;
+
+import static java.util.function.Function.identity;
+import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.stringContainsInOrder;
+import static org.junit.jupiter.api.Assertions.fail;
+
+
+/**
+ * @author David Matejcek
+ */
+public class JobTestExtension implements BeforeAllCallback, AfterAllCallback {
+
+    private static final String ORIG_POLL_INTERVAL = "origPollInterval";
+    private static final String ORIG_INITIAL_DELAY = "origInitialDelay";
+    private static final String ORIG_RETENTION_PERIOD = "origRetentionPeriod";
+
+    private static final Asadmin ASADMIN = GlassFishTestEnvironment.getAsadmin();
+
+    @Override
+    public void beforeAll(ExtensionContext context) throws Exception {
+        Namespace namespaceClass = Namespace.create(context.getRequiredTestClass());
+        Store store = context.getStore(namespaceClass);
+        store.put(ORIG_RETENTION_PERIOD, ASADMIN.getValue("managed-job-config.job-retention-period", identity()).getValue());
+        store.put(ORIG_INITIAL_DELAY, ASADMIN.getValue("managed-job-config.initial-delay", identity()).getValue());
+        store.put(ORIG_POLL_INTERVAL, ASADMIN.getValue("managed-job-config.poll-interval", identity()).getValue());
+    }
+
+    @Override
+    public void afterAll(ExtensionContext context) throws Exception {
+        waitForCompletition();
+
+        // minimal possible values.
+        assertThat(ASADMIN.exec("configure-managed-jobs",
+            "--job-retention-period=1s",
+            "--cleanup-initial-delay=1s",
+            "--cleanup-poll-interval=1s"), asadminOK());
+
+        Thread.sleep(1100L);
+        // cleanup should be finished.
+        AsadminResult result = ASADMIN.exec("list-jobs");
+        assertThat(result.getOutput(), stringContainsInOrder("Nothing to list"));
+
+        Namespace namespaceClass = Namespace.create(context.getRequiredTestClass());
+        Store store = context.getStore(namespaceClass);
+        // reset original configuration
+        assertThat(ASADMIN.exec("configure-managed-jobs",
+            "--job-retention-period=" + store.get(ORIG_RETENTION_PERIOD),
+            "--cleanup-initial-delay=" + store.get(ORIG_INITIAL_DELAY),
+            "--cleanup-poll-interval=" + store.get(ORIG_POLL_INTERVAL)), asadminOK());
+    }
+
+
+    private void waitForCompletition() throws Exception {
+        final long start = System.currentTimeMillis();
+        while (true) {
+            AsadminResult result = ASADMIN.exec("list-jobs");
+            assertThat(result, asadminOK());
+            if (!result.getStdOut().contains("RUNNING")) {
+                return;
+            }
+            if (System.currentTimeMillis() > start + 10000L) {
+                fail("Timed out waiting for completition of all jobs.");
+            }
+            Thread.sleep(500);
+        }
+    }
+
+
+}
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusBasicITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusBasicITest.java
index 6ba8b05..0902128 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusBasicITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusBasicITest.java
@@ -23,6 +23,7 @@
 import org.glassfish.main.admin.test.tool.asadmin.AsadminResult;
 import org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import static org.glassfish.main.admin.test.progress.ProgressMessage.isIncreasing;
 import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
@@ -35,10 +36,12 @@
 /**
  * @author martinmares
  */
+@ExtendWith(JobTestExtension.class)
 public class ProgressStatusBasicITest {
 
     private static final Asadmin ASADMIN = GlassFishTestEnvironment.getAsadmin();
 
+
     @Test
     public void simple() {
         AsadminResult result = ASADMIN.exec("progress-simple");
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusComplexITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusComplexITest.java
index 3b7ae11..ed060e7 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusComplexITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusComplexITest.java
@@ -23,6 +23,7 @@
 import org.glassfish.main.admin.test.tool.asadmin.AsadminResult;
 import org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import static org.glassfish.main.admin.test.progress.ProgressMessage.grepProgressMessages;
 import static org.glassfish.main.admin.test.progress.ProgressMessage.isIncreasing;
@@ -41,13 +42,15 @@
 /**
  * @author martinmares
  */
+@ExtendWith(JobTestExtension.class)
 public class ProgressStatusComplexITest {
 
     private static final Asadmin ASADMIN = GlassFishTestEnvironment.getAsadmin();
 
+
     @Test
     public void executeCommandFromCommand() {
-        AsadminResult result = ASADMIN.exec(30_000, false, "progress-exec-other");
+        AsadminResult result = ASADMIN.exec(30_000, "progress-exec-other");
         assertThat(result, asadminOK());
         assertArrayEquals(new String[] {
             "Starting", "Preparing", "Parsing", "Working on main part",
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusFailITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusFailITest.java
index 0ed4266..b6ad40c 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusFailITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusFailITest.java
@@ -23,6 +23,7 @@
 import org.glassfish.main.admin.test.tool.asadmin.AsadminResult;
 import org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -33,6 +34,7 @@
 /**
  * @author martinmares
  */
+@ExtendWith(JobTestExtension.class)
 public class ProgressStatusFailITest {
 
     private static final Asadmin ASADMIN = GlassFishTestEnvironment.getAsadmin();
@@ -41,14 +43,14 @@
     public void failDuringExecution() {
         AsadminResult result = ASADMIN.exec("progress-fail-in-half");
         assertThat(result, not(asadminOK()));
-        List<ProgressMessage> prgs = ProgressMessage.grepProgressMessages(result.getStdOut());
-        assertFalse(prgs.isEmpty());
-        assertEquals(50, prgs.get(prgs.size() - 1).getValue());
+        List<ProgressMessage> messages = ProgressMessage.grepProgressMessages(result.getStdOut());
+        assertFalse(messages.isEmpty());
+        assertEquals(50, messages.get(messages.size() - 1).getValue());
     }
 
     @Test
     public void timeout() {
-        AsadminResult result = ASADMIN.exec(6_000, false, "progress-custom", "3x1", "1x8", "2x1");
+        AsadminResult result = ASADMIN.exec(6_000, "progress-custom", "3x1", "1x8", "2x1");
         assertThat(result, not(asadminOK()));
         List<ProgressMessage> prgs = ProgressMessage.grepProgressMessages(result.getStdOut());
         assertFalse(prgs.isEmpty());
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusSpecialITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusSpecialITest.java
index e5a8bef..576e949 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusSpecialITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/progress/ProgressStatusSpecialITest.java
@@ -24,6 +24,7 @@
 import org.glassfish.main.admin.test.tool.asadmin.AsadminResult;
 import org.glassfish.main.admin.test.tool.asadmin.GlassFishTestEnvironment;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import static org.glassfish.main.admin.test.progress.ProgressMessage.isIncreasing;
 import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
@@ -36,10 +37,12 @@
 /**
  * @author martinmares
  */
+@ExtendWith(JobTestExtension.class)
 public class ProgressStatusSpecialITest {
 
     private static final Asadmin ASADMIN = GlassFishTestEnvironment.getAsadmin();
 
+
     @Test
     public void stepBackCommand() {
         AsadminResult result = ASADMIN.exec("progress-step-back");
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/rest/JobsResourceITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/rest/JobsResourceITest.java
index b20bb43..cd7c57c 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/rest/JobsResourceITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/rest/JobsResourceITest.java
@@ -80,11 +80,11 @@
         JSONObject json = response.readEntity(JSONObject.class);
         JSONArray resources = json.getJSONArray("resources");
         assertNotNull(resources);
-        assertThat(resources.length(), equalTo(1));
+        assertThat(resources.toString(), resources.length(), equalTo(1));
 
         JSONArray items = json.getJSONArray("items");
         assertNotNull(items);
-        assertThat(items.length(), equalTo(1));
+        assertThat(items.toString(), items.length(), equalTo(1));
 
         // unlike most resources that also return a parent link,
         // the jobs resource only returns child links.
@@ -112,7 +112,7 @@
 
         resources = json.getJSONArray("resources");
         assertNotNull(resources);
-        assertThat(resources.length(), equalTo(1));
+        assertThat(resources.toString(), resources.length(), equalTo(1));
 
         resource = resources.getJSONObject(0);
         assertEquals("parent", resource.getString("rel"));
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/Asadmin.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/Asadmin.java
index e40e999..b18ca6d 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/Asadmin.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/Asadmin.java
@@ -22,11 +22,17 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
+import java.util.function.Function;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.stream.Collectors;
 
 import static java.util.Arrays.asList;
+import static org.glassfish.main.admin.test.tool.AsadminResultMatcher.asadminOK;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
  * Tool for executing asadmin/asadmin.bat commands.
@@ -37,7 +43,14 @@
 public class Asadmin {
     private static final Logger LOG = Logger.getLogger(Asadmin.class.getName());
 
-    private static final int DEFAULT_TIMEOUT_MSEC = 10 * 1000;
+    private static final int DEFAULT_TIMEOUT_MSEC = 30 * 1000;
+    private static final Function<String, KeyAndValue<String>> KEYVAL_SPLITTER = s -> {
+        int equalSignPos = s.indexOf('=');
+        if (equalSignPos <= 0 || equalSignPos == s.length() - 1) {
+            return null;
+        }
+        return new KeyAndValue<>(s.substring(0, equalSignPos), s.substring(equalSignPos + 1, s.length()));
+    };
 
     private final File asadmin;
     private final String adminUser;
@@ -66,6 +79,27 @@
     }
 
 
+    public <T> KeyAndValue<T> getValue(final String key, final Function<String, T> transformer) {
+        List<KeyAndValue<T>> result = get(key, transformer);
+        if (result.isEmpty()) {
+            return null;
+        }
+        if (result.size() > 1) {
+            throw new IllegalArgumentException("The key is not concrete enough to get a single value: " + key);
+        }
+        return result.get(0);
+    }
+
+
+    public <T> List<KeyAndValue<T>> get(final String key, final Function<String, T> transformer) {
+        AsadminResult result = exec("get", key);
+        assertThat(result, asadminOK());
+        return Arrays.stream(result.getStdOut().split(System.lineSeparator())).map(KEYVAL_SPLITTER)
+            .filter(Objects::nonNull).map(kv -> new KeyAndValue<>(kv.getKey(), transformer.apply(kv.getValue())))
+            .collect(Collectors.toList());
+    }
+
+
     /**
      * Executes the command with arguments asynchronously with {@value #DEFAULT_TIMEOUT_MSEC} ms timeout.
      * The command can be attached by the attach command.
@@ -74,8 +108,8 @@
      * @param args
      * @return {@link AsadminResult} never null.
      */
-    public AsadminResult execDetached(final String... args) {
-        return exec(DEFAULT_TIMEOUT_MSEC, true, args);
+    public DetachedTerseAsadminResult execDetached(final String... args) {
+        return (DetachedTerseAsadminResult) exec(DEFAULT_TIMEOUT_MSEC, true, args);
     }
 
     /**
@@ -87,40 +121,51 @@
     public AsadminResult exec(final String... args) {
         return exec(DEFAULT_TIMEOUT_MSEC, false, args);
     }
-
+    /**
+     * Executes the command with arguments synchronously with given timeout in millis.
+     *
+     * @param timeout
+     * @param args
+     * @return {@link AsadminResult} never null.
+     */
+    public AsadminResult exec(final int timeout, final String... args) {
+        return exec(timeout, false, args);
+    }
 
     /**
      * Executes the command with arguments.
      *
      * @param timeout timeout in millis
-     * @param detached - detached command is executed asynchronously, can be attached later by the attach command.
+     * @param detachedAndTerse - detached command is executed asynchronously, can be attached later by the attach command.
      * @param args - command and arguments.
      * @return {@link AsadminResult} never null.
      */
-    public AsadminResult exec(final int timeout, final boolean detached, final String... args) {
+    private AsadminResult exec(final int timeout, final boolean detachedAndTerse, final String... args) {
         final List<String> parameters = asList(args);
-        LOG.log(Level.INFO, "exec(timeout={0}, detached={1}, args={2})", new Object[] {timeout, detached, parameters});
+        LOG.log(Level.INFO, "exec(timeout={0}, detached={1}, args={2})",
+            new Object[] {timeout, detachedAndTerse, parameters});
         final List<String> command = new ArrayList<>();
         command.add(asadmin.getAbsolutePath());
         command.add("--user");
         command.add(adminUser);
         command.add("--passwordfile");
         command.add(adminPasswordFile.getAbsolutePath());
-        if (detached) {
+        if (detachedAndTerse) {
+            command.add("--terse");
             command.add("--detach");
         }
         command.addAll(parameters);
 
-        final ProcessManager pm = new ProcessManager(command);
-        pm.setTimeoutMsec(timeout);
-        pm.setEcho(false);
+        final ProcessManager processManager = new ProcessManager(command);
+        processManager.setTimeoutMsec(timeout);
+        processManager.setEcho(false);
 
         int exitCode;
         String asadminErrorMessage = "";
         try {
-            exitCode = pm.execute();
+            exitCode = processManager.execute();
         } catch (final ProcessManagerTimeoutException e) {
-            asadminErrorMessage = "ProcessManagerTimeoutException: command timed stdOut after " + timeout + " ms.\n";
+            asadminErrorMessage = "ProcessManagerTimeoutException: command timed out after " + timeout + " ms.\n";
             exitCode = 1;
         } catch (final ProcessManagerException e) {
             LOG.log(Level.SEVERE, "The execution failed.", e);
@@ -128,16 +173,14 @@
             exitCode = 1;
         }
 
-        final String stdErr = pm.getStderr() + '\n' + asadminErrorMessage;
-        final AsadminResult ret = new AsadminResult(args[0], exitCode, pm.getStdout(), stdErr);
-        writeToStdOut(ret.getOutput());
-        return ret;
-    }
-
-
-    private static void writeToStdOut(final String text) {
-        if (!text.isEmpty()) {
-            System.out.print(text);
+        final String stdErr = processManager.getStderr() + '\n' + asadminErrorMessage;
+        final AsadminResult result;
+        if (detachedAndTerse) {
+            result = new DetachedTerseAsadminResult(args[0], exitCode, processManager.getStdout(), stdErr);
+        } else {
+            result = new AsadminResult(args[0], exitCode, processManager.getStdout(), stdErr);
         }
+        System.out.print(result.getStdOut());
+        return result;
     }
 }
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/AsadminResult.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/AsadminResult.java
index e11433b..e7e09a0 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/AsadminResult.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/AsadminResult.java
@@ -31,13 +31,13 @@
     /**
      * Creates a value object instance.
      *
-     * @param cmd - command name
+     * @param commandName
      * @param exitCode
      * @param stdOut
      * @param stdErr
      */
-    public AsadminResult(final String cmd, final int exitCode, final String stdOut, final String stdErr) {
-        this.error = exitCode != 0 || containsError(stdOut, String.format("Command %s failed.", cmd));
+    public AsadminResult(final String commandName, final int exitCode, final String stdOut, final String stdErr) {
+        this.error = exitCode != 0 || containsError(stdOut, String.format("Command %s failed.", commandName));
         this.stdOut = stdOut;
         this.stdErr = stdErr;
         this.output = this.stdOut + this.stdErr;
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/DetachedTerseAsadminResult.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/DetachedTerseAsadminResult.java
new file mode 100644
index 0000000..3f3daf1
--- /dev/null
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/DetachedTerseAsadminResult.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.main.admin.test.tool.asadmin;
+
+import java.util.Arrays;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayWithSize;
+
+/**
+ * @author David Matejcek
+ */
+public class DetachedTerseAsadminResult extends AsadminResult {
+
+    private final String jobId;
+
+    public DetachedTerseAsadminResult(String commandName, int exitCode, String stdOut, String stdErr) {
+        super(commandName, exitCode, stdOut, stdErr);
+        this.jobId = parseJobId(stdOut);
+    }
+
+
+    public String getJobId() {
+        return jobId;
+    }
+
+
+    private static String parseJobId(String stdOut) {
+        String[] lines = stdOut.split(System.lineSeparator());
+        assertThat(Arrays.toString(lines), lines, arrayWithSize(1));
+        return Integer.valueOf(lines[0]).toString();
+    }
+}
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/GlassFishTestEnvironment.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/GlassFishTestEnvironment.java
index b41b7b3..33aa6c1 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/GlassFishTestEnvironment.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/GlassFishTestEnvironment.java
@@ -28,7 +28,6 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.logging.Level;
@@ -66,10 +65,10 @@
         LOG.log(Level.INFO, "Expected GlassFish directory: {0}", GF_ROOT);
         changePassword();
         Thread hook = new Thread(() -> {
-            getAsadmin().exec(10_000, false, "stop-domain", "--kill", "--force");
+            getAsadmin().exec(10_000, "stop-domain", "--kill", "--force");
         });
         Runtime.getRuntime().addShutdownHook(hook);
-        assertThat(getAsadmin().exec(30_000, false, "start-domain"), AsadminResultMatcher.asadminOK());
+        assertThat(getAsadmin().exec(30_000, "start-domain"), AsadminResultMatcher.asadminOK());
     }
 
     /**
@@ -130,28 +129,6 @@
 
 
     /**
-     * osgi-cache workaround
-     */
-    public static void deleteOsgiDirectory() {
-        Path osgiCacheDir = GF_ROOT.toPath().resolve(Paths.get("domains", "domain1", "osgi-cache"));
-        try {
-            Files.list(osgiCacheDir).forEach(GlassFishTestEnvironment::deleteSubpaths);
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-
-    public static void deleteSubpaths(final Path path) {
-        try {
-            Files.walk(path).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
-        } catch (Exception e) {
-            throw new IllegalStateException("Cannot delete path recursively: " + path, e);
-        }
-    }
-
-
-    /**
      * Useful for a heuristic inside Eclipse and other environments.
      *
      * @return Absolute path to the glassfish directory.
@@ -203,7 +180,7 @@
 
     private static void changePassword() {
         final Asadmin asadmin = new Asadmin(ASADMIN, ADMIN_USER, PASSWORD_FILE_FOR_UPDATE);
-        final AsadminResult result = asadmin.exec(5_000, false, "change-admin-password");
+        final AsadminResult result = asadmin.exec(5_000, "change-admin-password");
         if (result.isError()) {
             // probably changed by previous execution without maven clean
             System.out.println("Admin password NOT changed.");
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/KeyAndValue.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/KeyAndValue.java
new file mode 100644
index 0000000..a5ee39c
--- /dev/null
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/tool/asadmin/KeyAndValue.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.main.admin.test.tool.asadmin;
+
+import java.util.Comparator;
+import java.util.Objects;
+
+import static java.util.Comparator.comparing;
+
+/**
+ * @param <T> value type
+ *
+ * @author David Matejcek
+ */
+public class KeyAndValue<T> implements Comparable<KeyAndValue<?>> {
+
+
+    // note: toString should be fast.
+    private static final Comparator<Object> NULL_SAFE_COMPARATOR = comparing(o -> o == null ? "" : o.toString(),
+        String::compareTo);
+
+    private final String key;
+    private final T value;
+
+    public KeyAndValue(final String key, final T value) {
+        this.key = key;
+        this.value = value;
+    }
+
+
+    public String getKey() {
+        return key;
+    }
+
+
+    public T getValue() {
+        return value;
+    }
+
+
+    @Override
+    public String toString() {
+        return getKey() + '=' + getValue();
+    }
+
+
+    @Override
+    public boolean equals(Object object) {
+        if (object instanceof KeyAndValue<?>) {
+            KeyAndValue<?> another = (KeyAndValue<?>) object;
+            return Objects.equals(key, another.key) && Objects.equals(value, another.value);
+        }
+        return false;
+    }
+
+
+    @Override
+    public int hashCode() {
+        return key.hashCode();
+    }
+
+
+    @Override
+    public int compareTo(KeyAndValue<?> o) {
+        int keysComparisonResult = key.compareTo(o.key);
+        if (keysComparisonResult != 0) {
+            return keysComparisonResult;
+        }
+        return Objects.compare(value, o.value, NULL_SAFE_COMPARATOR);
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/deployment/ejb30/ear/security/web/MyFilter.java b/appserver/tests/appserv-tests/devtests/deployment/ejb30/ear/security/web/MyFilter.java
index 38c4db5..cf4e2ce 100644
--- a/appserver/tests/appserv-tests/devtests/deployment/ejb30/ear/security/web/MyFilter.java
+++ b/appserver/tests/appserv-tests/devtests/deployment/ejb30/ear/security/web/MyFilter.java
@@ -64,9 +64,7 @@
         HttpServletRequest httpRequest = (HttpServletRequest)request;
         HttpSession httpSession = httpRequest.getSession(true);
         if (httpRequest.isUserInRole("j2ee")) {
-            httpSession.putValue("deployment.ejb30.ear.security",
-                "filterMessage=hello world: " + loginTimeout);
-
+            httpSession.setAttribute("deployment.ejb30.ear.security", "filterMessage=hello world: " + loginTimeout);
         }
         chain.doFilter(request, response);
     }
diff --git a/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/jsp/web/MyFilter.java b/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/jsp/web/MyFilter.java
index a625be7..c7d262b 100644
--- a/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/jsp/web/MyFilter.java
+++ b/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/jsp/web/MyFilter.java
@@ -75,8 +75,7 @@
         }
         HttpServletRequest httpRequest = (HttpServletRequest)request;
         HttpSession httpSession = httpRequest.getSession(true);
-        httpSession.putValue("deployment.ejb30.web.jsp", "Hello World: " +
-            loginTimeout);
+        httpSession.setAttribute("deployment.ejb30.web.jsp", "Hello World: " + loginTimeout);
         chain.doFilter(request, response);
     }
 
diff --git a/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/servlet/web/MyFilter.java b/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/servlet/web/MyFilter.java
index 1aa3295..04021b9 100644
--- a/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/servlet/web/MyFilter.java
+++ b/appserver/tests/appserv-tests/devtests/deployment/ejb30/war/servlet/web/MyFilter.java
@@ -63,8 +63,7 @@
         }
         HttpServletRequest httpRequest = (HttpServletRequest)request;
         HttpSession httpSession = httpRequest.getSession(true);
-        httpSession.putValue("deployment.ejb30.war.servlet",
-            "Filter: Hello World: " + loginTimeout);
+        httpSession.setAttribute("deployment.ejb30.war.servlet", "Filter: Hello World: " + loginTimeout);
         chain.doFilter(request, response);
     }
 
diff --git a/appserver/tests/appserv-tests/devtests/security/jaccApi/src/DummyPolicyConfigurationFactory.java b/appserver/tests/appserv-tests/devtests/security/jaccApi/src/DummyPolicyConfigurationFactory.java
index b77039e..6c9f0b3 100644
--- a/appserver/tests/appserv-tests/devtests/security/jaccApi/src/DummyPolicyConfigurationFactory.java
+++ b/appserver/tests/appserv-tests/devtests/security/jaccApi/src/DummyPolicyConfigurationFactory.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -21,14 +22,24 @@
 import jakarta.security.jacc.PolicyContextException;
 
 public class DummyPolicyConfigurationFactory extends PolicyConfigurationFactory {
-    public PolicyConfiguration
-            getPolicyConfiguration(String contextID, boolean remove)
-                throws jakarta.security.jacc.PolicyContextException {
+
+    public PolicyConfiguration getPolicyConfiguration() {
         return null;
     }
 
-    public boolean inService(String contextID)
-            throws jakarta.security.jacc.PolicyContextException {
+
+    public PolicyConfiguration getPolicyConfiguration(String contextID) {
+        return null;
+    }
+
+
+    public PolicyConfiguration getPolicyConfiguration(String contextID, boolean remove)
+        throws jakarta.security.jacc.PolicyContextException {
+        return null;
+    }
+
+
+    public boolean inService(String contextID) throws jakarta.security.jacc.PolicyContextException {
         return false;
     }
 }
diff --git a/appserver/tests/appserv-tests/devtests/security/jmac/httpServletChallenge/src/HttpServletChallengeTestAuthModule.java b/appserver/tests/appserv-tests/devtests/security/jmac/httpServletChallenge/src/HttpServletChallengeTestAuthModule.java
index f347a91..12aa06e 100644
--- a/appserver/tests/appserv-tests/devtests/security/jmac/httpServletChallenge/src/HttpServletChallengeTestAuthModule.java
+++ b/appserver/tests/appserv-tests/devtests/security/jmac/httpServletChallenge/src/HttpServletChallengeTestAuthModule.java
@@ -86,8 +86,7 @@
             }
 
             HttpSession session = request.getSession(false);
-            boolean secondPhase = (session != null &&
-                    session.getValue("FIRST_DONE") != null);
+            boolean secondPhase = (session != null && session.getAttribute("FIRST_DONE") != null);
             String loginName = ((secondPhase)? username + "_2" : username);
             char[] pwd = new char[password.length()];
             password.getChars(0, password.length(), pwd, 0);
@@ -117,7 +116,7 @@
                     response.setHeader("WWW-Authenticate", "Basic realm=\"default\"");
                     if (session == null) {
                         session = request.getSession(true);
-                        session.putValue("FIRST_DONE", Boolean.TRUE);
+                        session.setAttribute("FIRST_DONE", Boolean.TRUE);
                     }
                     response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
                     return AuthStatus.SEND_SUCCESS;
diff --git a/appserver/tests/appserv-tests/devtests/security/jmac/httpServletForm/src/HttpServletFormTestAuthModule.java b/appserver/tests/appserv-tests/devtests/security/jmac/httpServletForm/src/HttpServletFormTestAuthModule.java
index b09ea53..0615858 100644
--- a/appserver/tests/appserv-tests/devtests/security/jmac/httpServletForm/src/HttpServletFormTestAuthModule.java
+++ b/appserver/tests/appserv-tests/devtests/security/jmac/httpServletForm/src/HttpServletFormTestAuthModule.java
@@ -75,8 +75,7 @@
         try {
             HttpSession session = request.getSession(false);
             if (session != null) {
-                Subject savedClientSubject =
-                        (Subject)session.getValue(SAVED_SUBJECT);
+                Subject savedClientSubject = (Subject) session.getAttribute(SAVED_SUBJECT);
                 if (savedClientSubject != null) {
                     System.out.println("already has saved subject");
                     // just copy principals for testing
@@ -96,7 +95,7 @@
                 if (session == null) {
                     session = request.getSession(true);
                 }
-                session.putValue(SAVED_REQUEST, new SavedRequest(request));
+                session.setAttribute(SAVED_REQUEST, new SavedRequest(request));
                 RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
                 rd.forward(request, response);
                 System.out.println("Form: SEND_CONTINUE");
@@ -117,9 +116,9 @@
                 System.out.println("login success: " + username + ", " + password);
                 SavedRequest sreq = null;
                 if (session != null) {
-                    sreq = (SavedRequest)session.getValue(SAVED_REQUEST);
+                    sreq = (SavedRequest) session.getAttribute(SAVED_REQUEST);
                     // for testing only as Subject is not Serializable
-                    session.putValue(SAVED_SUBJECT, clientSubject);
+                    session.setAttribute(SAVED_SUBJECT, clientSubject);
                 }
                 if (sreq != null) {
                     StringBuffer sb = new StringBuffer(sreq.getRequestURI());
diff --git a/appserver/tests/appserv-tests/devtests/security/run_test.sh b/appserver/tests/appserv-tests/devtests/security/run_test.sh
index 888f28a..fee8adc 100755
--- a/appserver/tests/appserv-tests/devtests/security/run_test.sh
+++ b/appserver/tests/appserv-tests/devtests/security/run_test.sh
@@ -17,10 +17,10 @@
 
 test_run(){
 
-    #cp -f ${APS_HOME}/devtests/security/ldap/opends/X500Signer.jar ${OPENDS_HOME}/lib
+    export OPENDJ_JAVA_ARGS="-Xmx1g -Xss512k --add-exports=java.base/sun.security.tools.keytool=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED"
 
     # Configure and start OpenDS using the default ports
-    ${OPENDS_HOME}/setup \
+    "${OPENDS_HOME}/setup" \
         -i \
         -v \
         -n \
@@ -32,22 +32,24 @@
         -Z 1636 \
         --useJavaKeystore ${S1AS_HOME}/domains/domain1/config/keystore.jks \
         -W changeit \
-        -N s1as
+        -N s1as \
+        --doNotStart
 
-    ${S1AS_HOME}/bin/asadmin start-database
-    ${S1AS_HOME}/bin/asadmin start-domain
-    cd ${APS_HOME}/devtests/security
+    "${OPENDS_HOME}/bin/start-ds"
+    "${S1AS_HOME}/bin/asadmin" start-database
+    "${S1AS_HOME}/bin/asadmin" start-domain
+    cd "${APS_HOME}/devtests/security"
 
-    ant ${TARGET} | tee ${TEST_RUN_LOG}
+    ant "${TARGET}" | tee "${TEST_RUN_LOG}"
 
-    ${S1AS_HOME}/bin/asadmin stop-domain
-    ${S1AS_HOME}/bin/asadmin stop-database
-        ${OPENDS_HOME}/bin/stop-ds \
+    "${S1AS_HOME}/bin/asadmin" stop-domain
+    "${S1AS_HOME}/bin/asadmin" stop-database
+    "${OPENDS_HOME}/bin/stop-ds" \
         -p 4444 \
         -D "cn=Directory Manager" \
         -w dmanager \
-        -P ${OPENDS_HOME}/config/admin-truststore \
-        -U ${OPENDS_HOME}/config/admin-keystore.pin
+        -P "${OPENDS_HOME}/config/admin-truststore" \
+        -U "${OPENDS_HOME}/config/admin-keystore.pin"
 
     #egrep 'FAILED= *0' ${TEST_RUN_LOG}
     #egrep 'DID NOT RUN= *0' ${TEST_RUN_LOG}
@@ -63,8 +65,8 @@
 }
 
 merge_result_files(){
-        cat ${APS_HOME}/test_resultsValid.xml ${APS_HOME}/security-gtest-results.xml > ${APS_HOME}/temp.xml
-        mv ${APS_HOME}/temp.xml ${APS_HOME}/test_resultsValid.xml
+        cat "${APS_HOME}/test_resultsValid.xml" "${APS_HOME}/security-gtest-results.xml" > "${APS_HOME}/temp.xml"
+        mv "${APS_HOME}/temp.xml" "${APS_HOME}/test_resultsValid.xml"
 }
 
 run_test_id(){
@@ -74,10 +76,11 @@
   if [ ! -f "${OPENDJ_ZIP}" ]; then
     curl -L -k https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/4.4.11/opendj-4.4.11.zip > "${OPENDJ_ZIP}"
   fi
-  unzip -o ${OPENDJ_ZIP}
-  export OPENDS_HOME=${PWD}/opendj
+  export OPENDS_HOME="${WORKSPACE}/opendj"
+  rm -rf -d "${OPENDS_HOME}"
+  unzip -o "${OPENDJ_ZIP}" -d "${WORKSPACE}"
 
-  unzip_test_resources ${WORKSPACE}/bundles/glassfish.zip
+  unzip_test_resources "${WORKSPACE}/bundles/glassfish.zip"
   cd `dirname ${0}`
   test_init
   get_test_target ${1}
diff --git a/appserver/tests/appserv-tests/devtests/web/jsessionIdParameter/docroot/test.jsp b/appserver/tests/appserv-tests/devtests/web/jsessionIdParameter/docroot/test.jsp
index b8474cf..20afe7b 100644
--- a/appserver/tests/appserv-tests/devtests/web/jsessionIdParameter/docroot/test.jsp
+++ b/appserver/tests/appserv-tests/devtests/web/jsessionIdParameter/docroot/test.jsp
@@ -19,7 +19,7 @@
 id=<%=session.getId()%>
 <% String a = request.getParameter("a");
    if (a != null) {
-       session.putValue("a", a);
+       session.setAttribute("a", a);
    }
-   out.println("a=" + session.getValue("a"));
+   out.println("a=" + session.getAttribute("a"));
 %>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/jaxwstools.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/jaxwstools.xml
index df1d91a..d15cb6d 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/jaxwstools.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/jaxwstools.xml
@@ -42,7 +42,7 @@
     <echo message="wsimporting http://${http.host}:${http.port}/${test-wsdl-uri}"/>
     <antcall target="wsimport">
         <param name="wsimport.args"
-               value="-keep  -Xendorsed  -d ${build.classes.dir}/client http://${http.host}:${http.port}/${test-wsdl-uri}"/>
+               value="-keep    -d ${build.classes.dir}/client http://${http.host}:${http.port}/${test-wsdl-uri}"/>
     </antcall>
     <javac srcdir="." destdir="${build.classes.dir}/client"
             includes="${client-src}/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/mappedname/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/mappedname/build.xml
index 2b8daf5..832d562 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/mappedname/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/mappedname/build.xml
@@ -144,7 +144,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/mappedname/HelloService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/mappedname/HelloService?wsdl"/>
       </antcall>
 
       <replace file="webclient/Client.java" value="${http.host}" token="HTTP_HOST"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/msgctxt/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/msgctxt/build.xml
index 076e106..e9872d9 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/msgctxt/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/msgctxt/build.xml
@@ -91,7 +91,7 @@
           <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
           <antcall target="wsimport">
             <param name="wsimport.args"
-              value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/msgctxt/HelloService?wsdl"/>
+              value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/msgctxt/HelloService?wsdl"/>
           </antcall>
           <replace file="webclient/Client.java" value="${http.host}" token="HTTP_HOST"/>
           <replace file="webclient/Client.java" value="${http.port}" token="HTTP_PORT"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/noname/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/noname/build.xml
index 71f6512..ed84170 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/noname/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/noname/build.xml
@@ -87,7 +87,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/noname/HelloService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/noname/HelloService?wsdl"/>
       </antcall>
       <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
             includes="webclient/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/noname2/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/noname2/build.xml
index 38106b8..c7b6938 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/noname2/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/noname2/build.xml
@@ -90,7 +90,7 @@
           <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
           <antcall target="wsimport">
             <param name="wsimport.args"
-              value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/noname2/HelloService?wsdl"/>
+              value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/noname2/HelloService?wsdl"/>
           </antcall>
 
          <replace file="webclient/Client.java" token="HTTP_HOST" value="${http.host}"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/oneway/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/oneway/build.xml
index d4aea3b..d86ef12 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/oneway/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/oneway/build.xml
@@ -90,7 +90,7 @@
           <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
           <antcall target="wsimport">
             <param name="wsimport.args"
-              value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/oneway/HelloService?wsdl"/>
+              value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/oneway/HelloService?wsdl"/>
           </antcall>
           <replace file="webclient/Client.java" value="${http.host}" token="HTTP_HOST"/>
           <replace file="webclient/Client.java" value="${http.port}" token="HTTP_PORT"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/postconstruct/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/postconstruct/build.xml
index d3cc1af..c81559f 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/postconstruct/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/postconstruct/build.xml
@@ -91,7 +91,7 @@
           <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
           <antcall target="wsimport">
             <param name="wsimport.args"
-              value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/postconstruct/webservice/HelloService?wsdl"/>
+              value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/postconstruct/webservice/HelloService?wsdl"/>
           </antcall>
 
          <replace file="webclient/Client.java" value="${http.host}" token="HTTP_HOST"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-cobundle/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-cobundle/build.xml
index e2a257e..7ca3e57 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-cobundle/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-cobundle/build.xml
@@ -66,7 +66,7 @@
       <mkdir dir="${build.classes.dir}"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value=" -Xendorsed -p service -keep -d ${build.classes.dir} ${basedir}/SubtractNumbers.wsdl"/>
+          value="  -p service -keep -d ${build.classes.dir} ${basedir}/SubtractNumbers.wsdl"/>
       </antcall>
       <antcall target="compile"/>
       <antcall target="pkg-bundle"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-lookup/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-lookup/build.xml
index 1530e31..1a08231 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-lookup/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/webserviceref-lookup/build.xml
@@ -60,7 +60,7 @@
       <mkdir dir="${build.classes.dir}"/>
       <!--<antcall target="wsimport">
         <param name="wsimport.args"
-          value=" -Xendorsed -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webserviceref-lookup/SubtractNumbers.wsdl"/>
+          value="  -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webserviceref-lookup/SubtractNumbers.wsdl"/>
       </antcall> -->
       <antcall target="compile"/>
       <antcall target="pkg-war">
@@ -75,7 +75,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webserviceref-lookup/webservice/SubtractNumbersService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webserviceref-lookup/webservice/SubtractNumbersService?wsdl"/>
       </antcall>
       <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
             includes="webclient/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-2/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-2/build.xml
index 530d5d5..98885ef 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-2/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-2/build.xml
@@ -60,7 +60,7 @@
       <mkdir dir="${build.classes.dir}"/>
       <!--<antcall target="wsimport">
         <param name="wsimport.args"
-          value=" -Xendorsed -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-addressing/SubtractNumbers.wsdl"/>
+          value="  -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-addressing/SubtractNumbers.wsdl"/>
       </antcall> -->
       <antcall target="compile"/>
       <antcall target="pkg-war">
@@ -75,7 +75,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-addressing-2/webservice/SubtractNumbersService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-addressing-2/webservice/SubtractNumbersService?wsdl"/>
       </antcall>
       <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
             includes="webclient/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-appclient/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-appclient/build.xml
index 3920cfe..9d6a24c 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-appclient/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing-appclient/build.xml
@@ -70,7 +70,7 @@
       <mkdir dir="${build.classes.dir}/appclient"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-Xendorsed -b custom-client.xml -extension -keep -d ${build.classes.dir}/appclient ${env.APS_HOME}/devtests/webservice/annotations/webservices13-addressing-appclient/AddNumbers.wsdl"/>
+          value=" -b custom-client.xml -extension -keep -d ${build.classes.dir}/appclient ${env.APS_HOME}/devtests/webservice/annotations/webservices13-addressing-appclient/AddNumbers.wsdl"/>
       </antcall>
 <javac srcdir="." destdir="${build.classes.dir}/appclient"
             includes="appclient/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing/build.xml
index fb8c04f..9dee0b9 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-addressing/build.xml
@@ -60,7 +60,7 @@
       <mkdir dir="${build.classes.dir}"/>
       <!--<antcall target="wsimport">
         <param name="wsimport.args"
-          value=" -Xendorsed -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-addressing/SubtractNumbers.wsdl"/>
+          value="  -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-addressing/SubtractNumbers.wsdl"/>
       </antcall> -->
       <antcall target="compile"/>
       <antcall target="pkg-war">
@@ -75,7 +75,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-addressing/webservice/SubtractNumbersService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-addressing/webservice/SubtractNumbersService?wsdl"/>
       </antcall>
       <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
             includes="webclient/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-clientdds/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-clientdds/build.xml
index b5073f9..a65fac7 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-clientdds/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-clientdds/build.xml
@@ -60,7 +60,7 @@
       <mkdir dir="${build.classes.dir}"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value=" -Xendorsed -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-clientdds/SubtractNumbers.wsdl"/>
+          value="  -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-clientdds/SubtractNumbers.wsdl"/>
       </antcall>
       <antcall target="compile"/>
       <antcall target="pkg-war">
@@ -75,7 +75,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-clientdds/webservice/SubtractNumbersService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-clientdds/webservice/SubtractNumbersService?wsdl"/>
       </antcall>
       <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
             includes="webclient/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-respectbinding/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-respectbinding/build.xml
index e06d393..a142cbd 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-respectbinding/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/webservices13-respectbinding/build.xml
@@ -60,7 +60,7 @@
       <mkdir dir="${build.classes.dir}"/>
       <!--<antcall target="wsimport">
         <param name="wsimport.args"
-          value=" -Xendorsed -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-respectbinding/SubtractNumbers.wsdl"/>
+          value="  -p endpoint -keep -d ${build.classes.dir} ${env.APS_HOME}/devtests/webservice/annotations/webservices13-respectbinding/SubtractNumbers.wsdl"/>
       </antcall> -->
       <antcall target="compile"/>
       <antcall target="pkg-war">
@@ -75,7 +75,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-respectbinding/webservice/SubtractNumbersService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/webservices13-respectbinding/webservice/SubtractNumbersService?wsdl"/>
       </antcall>
 
 <replace file="webclient/Client.java" value="${http.host}" token="HTTP_HOST"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/wsctxt/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/wsctxt/build.xml
index 97c8198..8e753df 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/wsctxt/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/wsctxt/build.xml
@@ -67,7 +67,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client  -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/wsctx/HelloService?wsdl"/>
+          value="-p client   -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/wsctx/HelloService?wsdl"/>
       </antcall>
       <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
             includes="webclient/**">
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/libdependent/build.xml b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/libdependent/build.xml
index aafc609..f88a714 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/libdependent/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/libdependent/build.xml
@@ -70,7 +70,7 @@
     <echo message="wsimporting http://${http.host}:${http.port}/HelloImplService/HelloImpl?WSDL" />
     <antcall target="wsimport">
       <param name="wsimport.args"
-             value="-keep  -Xendorsed -d ${build.classes.dir}/client http://${http.host}:${http.port}/HelloImplService/HelloImpl?WSDL"
+             value="-keep   -d ${build.classes.dir}/client http://${http.host}:${http.port}/HelloImplService/HelloImpl?WSDL"
       />
     </antcall>
     <javac verbose="true"
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/singleton/build.xml b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/singleton/build.xml
index d0a7b33..c664c50 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/singleton/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/singleton/build.xml
@@ -70,7 +70,7 @@
     <echo message="wsimporting http://${http.host}:${http.port}/HelloImplService/HelloImpl?WSDL" />
     <antcall target="wsimport">
       <param name="wsimport.args"
-             value="-keep  -Xendorsed -d ${build.classes.dir}/client http://${http.host}:${http.port}/HelloImplService/HelloImpl?WSDL"
+             value="-keep   -d ${build.classes.dir}/client http://${http.host}:${http.port}/HelloImplService/HelloImpl?WSDL"
       />
     </antcall>
     <javac verbose="true"
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.xml b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.xml
index 9ce747f..b5c6297 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.xml
@@ -89,7 +89,7 @@
       <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
       <antcall target="wsimport">
         <param name="wsimport.args"
-          value="-p client -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/HelloService/Hello?WSDL"/>
+          value="-p client  -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/HelloService/Hello?WSDL"/>
       </antcall>
       <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
             includes="webclient/**">
diff --git a/appserver/tests/pom.xml b/appserver/tests/pom.xml
index 0798f40..94d4ad5 100755
--- a/appserver/tests/pom.xml
+++ b/appserver/tests/pom.xml
@@ -118,7 +118,6 @@
                 <activeByDefault>true</activeByDefault>
             </activation>
             <modules>
-                <module>tck</module>
                 <module>admin</module>
                 <module>appserv-tests</module>
             </modules>
@@ -135,9 +134,11 @@
             </modules>
         </profile>
         <profile>
-            <id>fast</id>
+            <id>tck</id>
             <modules>
+                <module>admin</module>
                 <module>appserv-tests</module>
+                <module>tck</module>
             </modules>
         </profile>
     </profiles>
diff --git a/appserver/tests/tck/authentication/pom.xml b/appserver/tests/tck/authentication/pom.xml
index 445ad8c..549cb73 100644
--- a/appserver/tests/tck/authentication/pom.xml
+++ b/appserver/tests/tck/authentication/pom.xml
@@ -34,16 +34,16 @@
     <properties>
         <ant.home>${project.build.directory}/apache-ant-${ant.version}</ant.home>
         <ant.zip.url>https://archive.apache.org/dist/ant/binaries/apache-ant-${ant.version}-bin.zip</ant.zip.url>
-        
+
         <tck.home>${project.build.directory}/authentication-tck</tck.home>
-        <tck.tests.home>${tck.home}/src/com/sun/ts/tests/jsf</tck.tests.home> 
-         
+        <tck.tests.home>${tck.home}/src/com/sun/ts/tests/jsf</tck.tests.home>
+
         <glassfish.home>${project.build.directory}/glassfish6</glassfish.home>
         <glassfish.version>${project.version}</glassfish.version>
         <glassfish.asadmin>${glassfish.home}/glassfish/bin/asadmin</glassfish.asadmin>
-       
+
         <jacoco.includes>org/glassfish/**\:com/sun/enterprise/**</jacoco.includes>
-        
+
         <port.admin>14848</port.admin>
         <port.derby>11527</port.derby>
         <port.http>18080</port.http>
@@ -156,7 +156,7 @@
                             <target xmlns:if="ant:if" xmlns:unless="ant:unless">
                                 <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                                          classpathref="maven.plugin.classpath" />
-                                         
+
                                <macrodef name="tck-setting">
                                     <attribute name="key" /> <attribute name="value" />
                                     <sequential>
@@ -164,22 +164,22 @@
                                         match="@{key}=.*" replace="@{key}=@{value}" />
                                     </sequential>
                                 </macrodef>
-                                
+
                                 <macrodef name="tck-add">
                                     <attribute name="key" /> <attribute name="value" />
                                     <sequential>
                                         <concat append="true" destfile="${tck.home}/bin/ts.jte">@{key}=@{value}${line.separator}</concat>
                                     </sequential>
                                 </macrodef>
-                                
+
 
                                 <!-- Change configuration -->
                                 <copy file="${tck.home}/bin/ts.jte.jdk11" tofile="${tck.home}/bin/ts.jte" overwrite="true"  />
-                                
+
                                 <tck-setting key="jaspic.home" value="${glassfish.home}/glassfish"/>
                                 <tck-setting key="harness.log.traceflag" value="true"/>
                                 <tck-setting key="s1as.jvm.options" value="-Dj2eelogin.name=${user}:-Dj2eelogin.password=${password}"/>
-                                
+
                                 <tck-setting key="webServerHost" value="localhost"/>
                                 <tck-setting key="webServerPort" value="${port.http}"/>
                                 <tck-setting key="securedWebServicePort" value="${port.https}"/>
@@ -188,15 +188,15 @@
                                 <tck-setting key="orb.port" value="${port.orb}"/>
                                 <tck-setting key="database.port" value="${port.derby}"/>
                                 <tck-setting key="harness.log.port" value="${port.harness.log}"/>
-                                
+
                                 <tck-setting key="report.dir" value="${tck.home}/authenticationreport/authentication"/>
                                 <tck-setting key="work.dir" value="${tck.home}/authenticationwork/authentication"/>
-                                
-                                <!-- 
+
+                                <!--
                                     # It's an open question why these settings are not just part of ts.jte to begin with.
                                     # It's also an open question why the Authentication TCK insists on these being defined
                                 -->
-                                
+
                                 <tck-add key="persistence.unit.name.2" value="JPATCK2"/>
                                 <tck-add key="persistence.unit.name" value="CTS-EM"/>
                                 <tck-add key="jakarta.persistence.provider" value="org.eclipse.persistence.jpa.PersistenceProvider"/>
@@ -206,7 +206,7 @@
                                 <tck-add key="jakarta.persistence.jdbc.password" value="cts1"/>
                                 <tck-add key="jpa.provider.implementation.specific.properties" value="eclipselink.logging.level=OFF"/>
                                 <tck-add key="persistence.second.level.caching.supported" value="true"/>
-                          
+
                                 <limit maxwait="60">
                                     <exec executable="${glassfish.asadmin}" dir="${glassfish.home}/glassfish/bin">
                                         <arg value="delete-domain"/>
@@ -240,13 +240,13 @@
                                 </limit>
                                 <mkdir dir="${tck.home}/authenticationtckreport"/>
                                 <mkdir dir="${tck.home}/authenticationtckreport/authenticationtck"/>
-                                
+
                                 <replace file="${tck.home}/bin/xml/ts.top.import.xml">
                                   <replacetoken><![CDATA[<jvmarg value="-Xmx512m"/>]]></replacetoken>
                                   <replacevalue><![CDATA[<jvmarg value="-Xmx512m"/>
                                 <jvmarg value="-Djavatest.security.noSecurityManager=true"/>]]></replacevalue>
                                 </replace>
-                                
+
                                 <replace file="${tck.home}/bin/xml/ts.top.import.xml" if:set="suspend-tck" >
                                   <replacetoken><![CDATA[<jvmarg value="-Xmx512m"/>]]></replacetoken>
                                   <replacevalue><![CDATA[<jvmarg value="-Xmx512m"/>
@@ -274,7 +274,7 @@
                                         <arg value="start-domain"/>
                                     </exec>
                                 </limit>
-                                
+
                                 <exec executable="${ant.home}/bin/ant" dir="${tck.home}/bin">
                                     <arg value="config.vi"  />
                                 </exec>
@@ -284,7 +284,7 @@
                             </target>
                         </configuration>
                     </execution>
-      
+
 
                      <execution>
                         <id>run-tck-tests</id>
diff --git a/appserver/tests/tck/faces/pom.xml b/appserver/tests/tck/faces/pom.xml
index 00fc619..67cc981 100644
--- a/appserver/tests/tck/faces/pom.xml
+++ b/appserver/tests/tck/faces/pom.xml
@@ -34,16 +34,16 @@
     <properties>
         <ant.home>${project.build.directory}/apache-ant-${ant.version}</ant.home>
         <ant.zip.url>https://archive.apache.org/dist/ant/binaries/apache-ant-${ant.version}-bin.zip</ant.zip.url>
-        
+
         <tck.home>${project.build.directory}/faces-tck</tck.home>
-        <tck.tests.home>${tck.home}/src/com/sun/ts/tests/jsf</tck.tests.home> 
-         
+        <tck.tests.home>${tck.home}/src/com/sun/ts/tests/jsf</tck.tests.home>
+
         <glassfish.home>${project.build.directory}/glassfish6</glassfish.home>
         <glassfish.version>${project.version}</glassfish.version>
         <glassfish.asadmin>${glassfish.home}/glassfish/bin/asadmin</glassfish.asadmin>
-       
+
         <jacoco.includes>org/glassfish/**\:com/sun/enterprise/**</jacoco.includes>
-        
+
         <port.admin>14848</port.admin>
         <port.derby>11527</port.derby>
         <port.http>18080</port.http>
@@ -111,7 +111,7 @@
                             <outputDirectory>${project.build.directory}</outputDirectory>
                         </configuration>
                     </execution>
-                    <!-- 
+                    <!--
                     <execution>
                         <id>unpack-tck</id>
                         <phase>pre-integration-test</phase>
@@ -158,7 +158,7 @@
                             <target xmlns:if="ant:if" xmlns:unless="ant:unless">
                                 <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                                          classpathref="maven.plugin.classpath" />
-                                         
+
                                <macrodef name="tck-setting">
                                     <attribute name="key" /> <attribute name="value" />
                                     <sequential>
@@ -169,7 +169,7 @@
 
                                 <!-- Change configuration -->
                                 <copy file="${tck.home}/bin/ts.jte.jdk11" tofile="${tck.home}/bin/ts.jte" overwrite="true"  />
-                                
+
                                 <tck-setting key="webServerHost" value="localhost"/>
                                 <tck-setting key="webServerPort" value="${port.http}"/>
                                 <tck-setting key="securedWebServicePort" value="${port.https}"/>
@@ -178,20 +178,20 @@
                                 <tck-setting key="orb.port" value="${port.orb}"/>
                                 <tck-setting key="database.port" value="${port.derby}"/>
                                 <tck-setting key="harness.log.port" value="${port.harness.log}"/>
-                                
+
                                 <tck-setting key="report.dir" value="${tck.home}/facesreport/faces"/>
                                 <tck-setting key="work.dir" value="${tck.home}/faceswork/faces"/>
-                                
+
                                 <tck-setting key="webServerHome" value="${glassfish.home}/glassfish"/>
-                                
+
                                 <replaceregexp file="${tck.home}/bin/ts.jte" byline="true"
                                     match="webServerHome=/ri/glassfish3/glassfish" replace="webServerHome=${glassfish.home}/glassfish" />
-                                 
-                                
+
+
                                 <tck-setting key="impl.vi" value="glassfish"/>
                                 <tck-setting key="impl.vi.deploy.dir" value="${webServerHome}/domains/domain1/autodeploy"/>
                                 <tck-setting key="impl.deploy.timeout.multiplier" value="960"/>
-                                
+
                                 <tck-setting key="jsf.classes" value="${webServerHome}/modules/cdi-api.jar;${webServerHome}/modules/jakarta.servlet.jsp.jstl-api.jar;${webServerHome}/modules/jakarta.inject.jar;${webServerHome}/modules/jakarta.faces.jar;${webServerHome}/modules/jakarta.servlet.jsp-api.jar;${webServerHome}/modules/jakarta.servlet-api.jar;${webServerHome}/modules/jakarta.el.jar"/>
 
                                 <limit maxwait="60">
@@ -227,20 +227,20 @@
                                 </limit>
                                 <mkdir dir="${tck.home}/facesreport"/>
                                 <mkdir dir="${tck.home}/facesreport/faces"/>
-                                
+
                                 <replace file="${tck.home}/bin/xml/ts.top.import.xml">
                                   <replacetoken><![CDATA[<jvmarg value="-Xmx512m" />]]></replacetoken>
                                   <replacevalue><![CDATA[<jvmarg value="-Xmx512m" />
                                 <jvmarg value="-Djavatest.security.noSecurityManager=true"/>]]></replacevalue>
                                 </replace>
-                                
+
                                 <replace file="${tck.home}/bin/xml/ts.top.import.xml" if:set="suspend-tck" >
                                   <replacetoken><![CDATA[<jvmarg value="-Xmx512m" />]]></replacetoken>
                                   <replacevalue><![CDATA[<jvmarg value="-Xmx512m" />
                                 <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=9008"/>]]></replacevalue>
                                 </replace>
-                                
-                                
+
+
                             </target>
                         </configuration>
                         <goals>
@@ -263,7 +263,7 @@
                                         <arg value="start-domain"/>
                                     </exec>
                                 </limit>
-                                
+
                                 <exec executable="${ant.home}/bin/ant" dir="${tck.tests.home}">
                                     <arg value="-Dutil.dir=${tck.home}"  />
                                     <arg value="deploy.all"  />
@@ -271,7 +271,7 @@
                             </target>
                         </configuration>
                     </execution>
-      
+
 
                      <execution>
                         <id>run-tck-tests</id>
diff --git a/appserver/tests/tck/pom.xml b/appserver/tests/tck/pom.xml
index 9d5c53f..82ae1e8 100644
--- a/appserver/tests/tck/pom.xml
+++ b/appserver/tests/tck/pom.xml
@@ -32,9 +32,12 @@
     <name>TCK: Parent</name>
 
     <modules>
-        <module>tck-download</module>
-        <module>authorization</module>
         <module>embedded_ejb_smoke</module>
+        <module>tck-download</module>
+        <module>rest</module>
+        <module>faces</module>
+        <module>authentication</module>
+        <module>authorization</module>
     </modules>
 
     <build>
@@ -50,33 +53,4 @@
             </plugin>
         </plugins>
     </build>
-    
-    <profiles>
-        <profile>
-            <id>tck-all</id>
-            <modules>
-                <module>rest</module>
-                <module>faces</module>
-                <module>authentication</module>
-            </modules>
-        </profile>
-        <profile>
-            <id>tck-rest</id>
-            <modules>
-                <module>rest</module>
-            </modules>
-        </profile>
-        <profile>
-            <id>tck-faces</id>
-            <modules>
-                <module>faces</module>
-            </modules>
-        </profile>
-        <profile>
-            <id>tck-authentication</id>
-            <modules>
-                <module>authentication</module>
-            </modules>
-        </profile>
-    </profiles>
 </project>
diff --git a/appserver/tests/tck/rest/pom.xml b/appserver/tests/tck/rest/pom.xml
index 4622e02..97ab06c 100644
--- a/appserver/tests/tck/rest/pom.xml
+++ b/appserver/tests/tck/rest/pom.xml
@@ -34,16 +34,16 @@
     <properties>
         <ant.home>${project.build.directory}/apache-ant-${ant.version}</ant.home>
         <ant.zip.url>https://archive.apache.org/dist/ant/binaries/apache-ant-${ant.version}-bin.zip</ant.zip.url>
-        
+
         <tck.home>${project.build.directory}/restful-ws-tck</tck.home>
         <tck.tests.home>${tck.home}/src/com/sun/ts/tests</tck.tests.home>
-         
+
         <glassfish.home>${project.build.directory}/glassfish6</glassfish.home>
         <glassfish.version>${project.version}</glassfish.version>
         <glassfish.asadmin>${glassfish.home}/glassfish/bin/asadmin</glassfish.asadmin>
-       
+
         <jacoco.includes>org/glassfish/**\:com/sun/enterprise/**</jacoco.includes>
-        
+
         <port.admin>14848</port.admin>
         <port.derby>11527</port.derby>
         <port.http>18080</port.http>
@@ -156,7 +156,7 @@
                             <target xmlns:if="ant:if" xmlns:unless="ant:unless">
                                 <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                                          classpathref="maven.plugin.classpath" />
-                                         
+
                                <macrodef name="tck-setting">
                                     <attribute name="key" /> <attribute name="value" />
                                     <sequential>
@@ -167,7 +167,7 @@
 
                                 <!-- Change configuration -->
                                 <copy file="${tck.home}/bin/ts.jte.jdk11" tofile="${tck.home}/bin/ts.jte" overwrite="true"  />
-                                
+
                                 <tck-setting key="webServerHost" value="localhost"/>
                                 <tck-setting key="webServerPort" value="${port.http}"/>
                                 <tck-setting key="securedWebServicePort" value="${port.https}"/>
@@ -176,16 +176,16 @@
                                 <tck-setting key="orb.port" value="${port.orb}"/>
                                 <tck-setting key="database.port" value="${port.derby}"/>
                                 <tck-setting key="harness.log.port" value="${port.harness.log}"/>
-                                
+
                                 <tck-setting key="report.dir" value="${tck.home}/restreport/rest"/>
                                 <tck-setting key="work.dir" value="${tck.home}/restwork/rest"/>
-                                
+
                                 <tck-setting key="web.home" value="${glassfish.home}/glassfish"/>
                                 <tck-setting key="impl.vi" value="glassfish"/>
                                 <tck-setting key="impl.vi.deploy.dir" value="${web.home}/domains/domain1/autodeploy"/>
-                                
+
                                 <tck-setting key="jaxrs_impl_name" value="jersey"/>
-                                
+
                                 <tck-setting key="jaxrs_impl.classes" value="${web.home}/modules/jakarta.json.jar:${web.home}/modules/jakarta.json.bind-api.jar:${web.home}/modules/jakarta.json.jar:${web.home}/modules/jsonp-jaxrs.jar:${web.home}/modules/jersey-client.jar:${web.home}/modules/jersey-common.jar:${web.home}/modules/jersey-server.jar:${web.home}/modules/jersey-container-servlet.jar:${web.home}/modules/jersey-container-servlet-core.jar:${web.home}/modules/jersey-media-jaxb.jar:${web.home}/modules/jersey-media-sse.jar:${web.home}/modules/jersey-hk2.jar:${web.home}/modules/osgi-resource-locator.jar:${web.home}/modules/jakarta.inject-api.jar:${web.home}/modules/guava.jar:${web.home}/modules/hk2-api.jar:${web.home}/modules/hk2-locator.jar:${web.home}/modules/hk2-utils.jar:${web.home}/modules/javassist.jar:${web.home}/modules/cglib.jar:${web.home}/modules/jakarta.annotation-api.jar:${web.home}/modules/jakarta.xml.bind-api.jar:${web.home}/modules/jakarta.activation.jar"/>
                                 <tck-setting key="jaxrs_impl_lib" value="${web.home}/modules/jersey-container-servlet-core.jar"/>
                                 <tck-setting key="jaxrs.classes" value="${web.home}/modules/jakarta.ws.rs-api.jar"/>
@@ -225,13 +225,13 @@
                                 </limit>
                                 <mkdir dir="${tck.home}/resttckreport"/>
                                 <mkdir dir="${tck.home}/resttckreport/resttck"/>
-                                
+
                                 <replace file="${tck.home}/bin/xml/ts.top.import.xml">
                                   <replacetoken><![CDATA[<jvmarg value="-Xmx512m"/>]]></replacetoken>
                                   <replacevalue><![CDATA[<jvmarg value="-Xmx512m"/>
                                 <jvmarg value="-Djavatest.security.noSecurityManager=true"/>]]></replacevalue>
                                 </replace>
-                                
+
                                 <replace file="${tck.home}/bin/xml/ts.top.import.xml" if:set="suspend-tck" >
                                   <replacetoken><![CDATA[<jvmarg value="-Xmx512m"/>]]></replacetoken>
                                   <replacevalue><![CDATA[<jvmarg value="-Xmx512m"/>
@@ -272,7 +272,7 @@
                             </target>
                         </configuration>
                     </execution>
-      
+
 
                      <execution>
                         <id>run-tck-tests</id>
diff --git a/appserver/tests/tck/tck-download/jakarta-authentication-tck/pom.xml b/appserver/tests/tck/tck-download/jakarta-authentication-tck/pom.xml
index a9a8cb5..c2d4574 100644
--- a/appserver/tests/tck/tck-download/jakarta-authentication-tck/pom.xml
+++ b/appserver/tests/tck/tck-download/jakarta-authentication-tck/pom.xml
@@ -32,7 +32,8 @@
     <name>TCK: Install Jakarta Authentication TCK</name>
 
     <properties>
-        <tck.test.authentication.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/jakarta-authentication-tck-2.0.1.zip</tck.test.authentication.url>
+        <tck.test.authentication.file>jakarta-authentication-tck-2.0.1.zip</tck.test.authentication.file>
+        <tck.test.authentication.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/${tck.test.authentication.file}</tck.test.authentication.url>
     </properties>
 
     <build>
@@ -65,7 +66,7 @@
                             <goal>install-file</goal>
                         </goals>
                         <configuration>
-                            <file>${project.build.directory}/jakarta-authentication-tck-2.0.1.zip</file>
+                            <file>${project.build.directory}/${tck.test.authentication.file}</file>
                             <groupId>${project.groupId}</groupId>
                             <artifactId>${project.artifactId}</artifactId>
                             <version>${project.version}</version>
diff --git a/appserver/tests/tck/tck-download/jakarta-authorization-tck/pom.xml b/appserver/tests/tck/tck-download/jakarta-authorization-tck/pom.xml
index e78bcc8..f4d6ce0 100644
--- a/appserver/tests/tck/tck-download/jakarta-authorization-tck/pom.xml
+++ b/appserver/tests/tck/tck-download/jakarta-authorization-tck/pom.xml
@@ -32,7 +32,8 @@
     <name>TCK: Install Jakarta Authorization TCK</name>
 
     <properties>
-        <tck.tests.authorization.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/jakarta-authorization-tck-2.0.1.zip</tck.tests.authorization.url>
+        <tck.test.authorization.file>jakarta-authorization-tck-2.0.1.zip</tck.test.authorization.file>
+        <tck.tests.authorization.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/${tck.test.authorization.file}</tck.tests.authorization.url>
     </properties>
 
     <build>
@@ -65,7 +66,7 @@
                             <goal>install-file</goal>
                         </goals>
                         <configuration>
-                            <file>${project.build.directory}/jakarta-authorization-tck-2.0.1.zip</file>
+                            <file>${project.build.directory}/${tck.test.authorization.file}</file>
                             <groupId>${project.groupId}</groupId>
                             <artifactId>${project.artifactId}</artifactId>
                             <version>${project.version}</version>
diff --git a/appserver/tests/tck/tck-download/jakarta-faces-tck/pom.xml b/appserver/tests/tck/tck-download/jakarta-faces-tck/pom.xml
index b5598cb..6f7bb2a 100644
--- a/appserver/tests/tck/tck-download/jakarta-faces-tck/pom.xml
+++ b/appserver/tests/tck/tck-download/jakarta-faces-tck/pom.xml
@@ -32,7 +32,8 @@
     <name>TCK: Install Jakarta Faces TCK</name>
 
     <properties>
-        <tck.test.faces.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/jakarta-faces-tck-3.0.1.zip</tck.test.faces.url>
+        <tck.test.faces.file>jakarta-faces-tck-3.0.1.zip</tck.test.faces.file>
+        <tck.test.faces.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/${tck.test.faces.file}</tck.test.faces.url>
     </properties>
 
     <build>
@@ -65,7 +66,7 @@
                             <goal>install-file</goal>
                         </goals>
                         <configuration>
-                            <file>${project.build.directory}/jakarta-faces-tck-3.0.1.zip</file>
+                            <file>${project.build.directory}/${tck.test.faces.file}</file>
                             <groupId>${project.groupId}</groupId>
                             <artifactId>${project.artifactId}</artifactId>
                             <version>${project.version}</version>
diff --git a/appserver/tests/tck/tck-download/jakarta-rest-tck/pom.xml b/appserver/tests/tck/tck-download/jakarta-rest-tck/pom.xml
index 448dc66..516de34 100644
--- a/appserver/tests/tck/tck-download/jakarta-rest-tck/pom.xml
+++ b/appserver/tests/tck/tck-download/jakarta-rest-tck/pom.xml
@@ -32,7 +32,8 @@
     <name>TCK: Install Jakarta REST TCK</name>
 
     <properties>
-        <tck.test.rest.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/jakarta-restful-ws-tck-3.0.2.zip</tck.test.rest.url>
+        <tck.test.rest.file>jakarta-restful-ws-tck-3.0.2.zip</tck.test.rest.file>
+        <tck.test.rest.url>https://download.eclipse.org/ee4j/jakartaee-tck/jakartaee9-eftl/promoted/${tck.test.rest.file}</tck.test.rest.url>
     </properties>
 
     <build>
@@ -65,7 +66,7 @@
                             <goal>install-file</goal>
                         </goals>
                         <configuration>
-                            <file>${project.build.directory}/jakarta-restful-ws-tck-3.0.2.zip</file>
+                            <file>${project.build.directory}/${tck.test.rest.file}</file>
                             <groupId>${project.groupId}</groupId>
                             <artifactId>${project.artifactId}</artifactId>
                             <version>${project.version}</version>
diff --git a/appserver/tests/tck/tck-download/pom.xml b/appserver/tests/tck/tck-download/pom.xml
index aca7fa1..e3f78ef 100644
--- a/appserver/tests/tck/tck-download/pom.xml
+++ b/appserver/tests/tck/tck-download/pom.xml
@@ -33,6 +33,9 @@
     <name>TCK: Download and Install Dependencies not in Maven Repos</name>
 
     <modules>
+        <module>jakarta-rest-tck</module>
+        <module>jakarta-faces-tck</module>
+        <module>jakarta-authentication-tck</module>
         <module>jakarta-authorization-tck</module>
         <module>tsharness</module>
         <module>javatest</module>
@@ -53,33 +56,4 @@
             </plugin>
         </plugins>
     </build>
-    
-    <profiles>
-        <profile>
-            <id>tck-all</id>
-            <modules>
-                <module>jakarta-rest-tck</module>
-                <module>jakarta-faces-tck</module>
-                <module>jakarta-authentication-tck</module>
-            </modules>
-        </profile>
-        <profile>
-            <id>tck-rest</id>
-            <modules>
-                <module>jakarta-rest-tck</module>
-            </modules>
-        </profile>
-        <profile>
-            <id>tck-faces</id>
-            <modules>
-                <module>jakarta-faces-tck</module>
-            </modules>
-        </profile>
-        <profile>
-            <id>tck-authentication</id>
-            <modules>
-                <module>jakarta-authentication-tck</module>
-            </modules>
-        </profile>
-    </profiles>
 </project>
diff --git a/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java b/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java
index 56201ce..a8f69f0 100644
--- a/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java
+++ b/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation
+ * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
  * Copyright 2004 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,27 +18,42 @@
 
 package org.apache.catalina.connector;
 
-import org.apache.catalina.LogFacade;
-import org.apache.catalina.Globals;
-import org.apache.catalina.core.RequestFacadeHelper;
-import org.apache.catalina.security.SecurityUtil;
+import com.sun.enterprise.security.web.integration.WebPrincipal;
 
-import jakarta.servlet.*;
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletInputStream;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
 import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletMapping;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.servlet.http.HttpSession;
 import jakarta.servlet.http.HttpUpgradeHandler;
 import jakarta.servlet.http.Part;
 import jakarta.servlet.http.PushBuilder;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.security.AccessControlException;
 import java.security.AccessController;
+import java.security.Principal;
 import java.security.PrivilegedAction;
 import java.security.SecurityPermission;
-import java.util.*;
-import jakarta.servlet.http.HttpServletMapping;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.catalina.Globals;
+import org.apache.catalina.LogFacade;
+import org.apache.catalina.core.RequestFacadeHelper;
+import org.apache.catalina.security.SecurityUtil;
 
 
 /**
@@ -60,6 +76,7 @@
     private final class GetAttributePrivilegedAction
             implements PrivilegedAction<Enumeration<String>> {
 
+        @Override
         public Enumeration<String> run() {
             return request.getAttributeNames();
         }
@@ -69,6 +86,7 @@
     private final class GetParameterMapPrivilegedAction
             implements PrivilegedAction<Map<String, String[]>> {
 
+        @Override
         public Map<String, String[]> run() {
             return request.getParameterMap();
         }
@@ -78,12 +96,13 @@
     private final class GetRequestDispatcherPrivilegedAction
             implements PrivilegedAction<RequestDispatcher> {
 
-        private String path;
+        private final String path;
 
         public GetRequestDispatcherPrivilegedAction(String path){
             this.path = path;
         }
 
+        @Override
         public RequestDispatcher run() {
             return request.getRequestDispatcher(path);
         }
@@ -99,6 +118,7 @@
             this.name = name;
         }
 
+        @Override
         public String run() {
             return request.getParameter(name);
         }
@@ -108,6 +128,7 @@
     private final class GetParameterNamesPrivilegedAction
             implements PrivilegedAction<Enumeration<String>> {
 
+        @Override
         public Enumeration<String> run() {
             return request.getParameterNames();
         }
@@ -123,6 +144,7 @@
             this.name = name;
         }
 
+        @Override
         public String[] run() {
             return request.getParameterValues(name);
         }
@@ -132,6 +154,7 @@
     private final class GetCookiesPrivilegedAction
             implements PrivilegedAction<Cookie[]> {
 
+        @Override
         public Cookie[] run() {
             return request.getCookies();
         }
@@ -141,6 +164,7 @@
     private final class GetCharacterEncodingPrivilegedAction
             implements PrivilegedAction<String> {
 
+        @Override
         public String run() {
             return request.getCharacterEncoding();
         }
@@ -150,12 +174,13 @@
     private final class GetHeadersPrivilegedAction
             implements PrivilegedAction<Enumeration<String>> {
 
-        private String name;
+        private final String name;
 
         public GetHeadersPrivilegedAction(String name){
             this.name = name;
         }
 
+        @Override
         public Enumeration<String> run() {
             return request.getHeaders(name);
         }
@@ -165,6 +190,7 @@
     private final class GetHeaderNamesPrivilegedAction
             implements PrivilegedAction<Enumeration<String>> {
 
+        @Override
         public Enumeration<String> run() {
             return request.getHeaderNames();
         }
@@ -174,6 +200,7 @@
     private final class GetLocalePrivilegedAction
             implements PrivilegedAction<Locale> {
 
+        @Override
         public Locale run() {
             return request.getLocale();
         }
@@ -183,6 +210,7 @@
     private final class GetLocalesPrivilegedAction
             implements PrivilegedAction<Enumeration<Locale>> {
 
+        @Override
         public Enumeration<Locale> run() {
             return request.getLocales();
         }
@@ -191,12 +219,13 @@
     private final class GetSessionPrivilegedAction
             implements PrivilegedAction<HttpSession> {
 
-        private boolean create;
+        private final boolean create;
 
         public GetSessionPrivilegedAction(boolean create){
             this.create = create;
         }
 
+        @Override
         public HttpSession run() {
             return request.getSession(create);
         }
@@ -205,6 +234,7 @@
     private final class ChangeSessionIdPrivilegedAction
             implements PrivilegedAction<String> {
 
+        @Override
         public String run() {
             return request.changeSessionId();
         }
@@ -276,6 +306,7 @@
     /**
     * Prevent cloning the facade.
     */
+    @Override
     protected Object clone()
         throws CloneNotSupportedException {
         throw new CloneNotSupportedException();
@@ -392,6 +423,7 @@
         return request.getInputStream();
     }
 
+    @Override
     public HttpServletMapping getHttpServletMapping() {
 
         if (request == null) {
@@ -401,6 +433,7 @@
         return request.getHttpServletMapping();
     }
 
+    @Override
     public String getParameter(String name) {
 
         if (request == null) {
@@ -447,7 +480,7 @@
             ret = AccessController.doPrivileged(
                 new GetParameterValuePrivilegedAction(name));
             if (ret != null) {
-                ret = (String[]) ret.clone();
+                ret = ret.clone();
             }
         } else {
             ret = request.getParameterValues(name);
@@ -653,7 +686,7 @@
             ret = AccessController.doPrivileged(
                 new GetCookiesPrivilegedAction());
             if (ret != null) {
-                ret = (Cookie[]) ret.clone();
+                ret = ret.clone();
             }
         } else {
             ret = request.getCookies();
@@ -830,12 +863,30 @@
     }
 
     @Override
-    public java.security.Principal getUserPrincipal() {
+    public Principal getUserPrincipal() {
 
         if (request == null) {
             throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
         }
 
+        Principal principal = request.getUserPrincipal();
+        if (principal instanceof WebPrincipal) {
+            WebPrincipal webPrincipal = (WebPrincipal) principal;
+            if (webPrincipal.getCustomPrincipal() != null) {
+                principal = webPrincipal.getCustomPrincipal();
+            }
+        }
+
+        return principal;
+    }
+
+    // returns the original, unwrapped principal from the underlying request
+    public Principal getRequestPrincipal() {
+        if (request == null) {
+            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        }
+
+
         return request.getUserPrincipal();
     }
 
diff --git a/docs/pom.xml b/docs/pom.xml
index 134f9e3..ff95d02 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -70,7 +70,7 @@
         <plugins>
             <plugin>
                 <artifactId>maven-enforcer-plugin</artifactId>
-                <version>1.4.1</version>
+                <version>3.0.0</version>
                 <executions>
                     <execution>
                         <id>enforce-versions</id>
@@ -81,7 +81,7 @@
                             <rules>
                                 <requireJavaVersion>
                                     <version>[1.8.0,1.9.0)</version>
-                                    <message>You need JDK8 or lower</message>
+                                    <message>You need JDK8</message>
                                 </requireJavaVersion>
                             </rules>
                         </configuration>
diff --git a/etc/PruneMavenCache.groovy b/etc/PruneMavenCache.groovy
index f190487..b4d4b05 100644
--- a/etc/PruneMavenCache.groovy
+++ b/etc/PruneMavenCache.groovy
@@ -20,7 +20,6 @@
   - name: jnlp
     image: jenkins/jnlp-slave:alpine
     imagePullPolicy: IfNotPresent
-    volumeMounts:
     env:
       - name: JAVA_TOOL_OPTIONS
         value: -Xmx1G
diff --git a/nucleus/admin/cli/pom.xml b/nucleus/admin/cli/pom.xml
index bfa0bf8..a6636dd 100755
--- a/nucleus/admin/cli/pom.xml
+++ b/nucleus/admin/cli/pom.xml
@@ -182,7 +182,7 @@
                     <verbose>false</verbose>
                     <linksource>true</linksource>
                     <links>
-                        <link>https://docs.oracle.com/javase/8/docs/api/</link>
+                        <link>https://docs.oracle.com/en/java/javase/11/docs/api/</link>
                     </links>
                     <show>private</show>
                 </configuration>
diff --git a/nucleus/hk2/config-generator/pom.xml b/nucleus/hk2/config-generator/pom.xml
index 6e4870c..e725176 100644
--- a/nucleus/hk2/config-generator/pom.xml
+++ b/nucleus/hk2/config-generator/pom.xml
@@ -53,7 +53,6 @@
         <dependency>
             <groupId>org.glassfish.hk2</groupId>
             <artifactId>hk2-utils</artifactId>
-            <version>${hk2.version}</version>
         </dependency>
         <dependency>
             <groupId>org.glassfish.main.hk2</groupId>
@@ -79,5 +78,14 @@
             <groupId>jakarta.annotation</groupId>
             <artifactId>jakarta.annotation-api</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest</artifactId>
+        </dependency>
     </dependencies>
 </project>
diff --git a/nucleus/hk2/config-generator/src/test/java/com/sun/enterprise/tools/classmodel/UtilitiesTest.java b/nucleus/hk2/config-generator/src/test/java/com/sun/enterprise/tools/classmodel/UtilitiesTest.java
index 2e819fd..3bf2cd5 100644
--- a/nucleus/hk2/config-generator/src/test/java/com/sun/enterprise/tools/classmodel/UtilitiesTest.java
+++ b/nucleus/hk2/config-generator/src/test/java/com/sun/enterprise/tools/classmodel/UtilitiesTest.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -16,9 +17,9 @@
 
 package com.sun.enterprise.tools.classmodel;
 
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
 
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 
 public class UtilitiesTest {
diff --git a/nucleus/parent/pom.xml b/nucleus/parent/pom.xml
index cfb23e8..256b172 100644
--- a/nucleus/parent/pom.xml
+++ b/nucleus/parent/pom.xml
@@ -122,8 +122,8 @@
         <grizzly.version>3.0.1</grizzly.version>
         <grizzly.npn.version>2.0.0</grizzly.npn.version>
         <glassfish-management-api.version>3.2.3</glassfish-management-api.version>
-        <hk2.version>3.0.2</hk2.version>
-        <hk2.plugin.version>3.0.2</hk2.plugin.version>
+        <hk2.version>3.0.3</hk2.version>
+        <hk2.plugin.version>3.0.3</hk2.plugin.version>
         <hk2.config-generator.version>2.5.0-b53</hk2.config-generator.version>
         <pfl.version>4.1.2</pfl.version>
 
@@ -600,7 +600,7 @@
                 <artifactId>org.apache.felix.bundlerepository</artifactId>
                 <version>2.0.10</version>
             </dependency>
-            <!-- This is currently used by osgi-shell cmd, but can be used for others as well -->
+            <!-- This is currently used by osgi-shell cmd -->
             <dependency>
                 <groupId>jline</groupId>
                 <artifactId>jline</artifactId>
@@ -690,7 +690,7 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-compiler-plugin</artifactId>
-                    <version>3.8.1</version>
+                    <version>3.10.1</version>
                     <configuration>
                         <source>11</source>
                         <target>11</target>
@@ -704,7 +704,7 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-dependency-plugin</artifactId>
-                    <version>3.1.2</version>
+                    <version>3.3.0</version>
                 </plugin>
                 <plugin>
                     <groupId>org.glassfish.build</groupId>
@@ -713,7 +713,7 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-javadoc-plugin</artifactId>
-                    <version>3.3.1</version>
+                    <version>3.3.2</version>
                 </plugin>
                 <plugin>
                     <artifactId>maven-source-plugin</artifactId>
@@ -721,11 +721,11 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-clean-plugin</artifactId>
-                    <version>3.1.0</version>
+                    <version>3.2.0</version>
                 </plugin>
                 <plugin>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <version>3.0.0-M5</version>
+                    <version>3.0.0-M6</version>
                     <configuration>
                         <argLine>${surefire.argLine}</argLine>
                         <trimStackTrace>false</trimStackTrace>
@@ -740,7 +740,7 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-failsafe-plugin</artifactId>
-                    <version>3.0.0-M5</version>
+                    <version>3.0.0-M6</version>
                     <configuration>
                         <argLine>${failsafe.argLine}</argLine>
                         <trimStackTrace>false</trimStackTrace>
@@ -795,7 +795,7 @@
                         <dependency>
                             <groupId>com.puppycrawl.tools</groupId>
                             <artifactId>checkstyle</artifactId>
-                            <version>8.43</version>
+                            <version>10.1</version>
                         </dependency>
                     </dependencies>
                     <executions>
@@ -810,13 +810,17 @@
                     </executions>
                 </plugin>
                 <plugin>
+                    <artifactId>maven-gpg-plugin</artifactId>
+                    <version>3.0.1</version>
+                </plugin>
+                <plugin>
                     <groupId>com.googlecode.maven-download-plugin</groupId>
                     <artifactId>download-maven-plugin</artifactId>
-                    <version>1.6.7</version>
+                    <version>1.6.8</version>
                 </plugin>
                 <plugin>
                     <artifactId>maven-release-plugin</artifactId>
-                    <version>3.0.0-M1</version>
+                    <version>3.0.0-M5</version>
                 </plugin>
                 <plugin>
                     <artifactId>maven-resources-plugin</artifactId>
@@ -824,7 +828,7 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-site-plugin</artifactId>
-                    <version>3.9.0</version>
+                    <version>3.11.0</version>
                 </plugin>
                 <plugin>
                     <artifactId>maven-assembly-plugin</artifactId>
@@ -832,7 +836,7 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-deploy-plugin</artifactId>
-                    <version>3.0.0-M1</version>
+                    <version>3.0.0-M2</version>
                 </plugin>
                 <plugin>
                     <artifactId>maven-install-plugin</artifactId>
@@ -840,12 +844,12 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-jar-plugin</artifactId>
-                    <version>3.2.0</version>
+                    <version>3.2.2</version>
                 </plugin>
                 <plugin>
                     <groupId>org.codehaus.mojo</groupId>
                     <artifactId>build-helper-maven-plugin</artifactId>
-                    <version>3.2.0</version>
+                    <version>3.3.0</version>
                 </plugin>
                 <plugin>
                     <artifactId>maven-invoker-plugin</artifactId>
@@ -927,10 +931,9 @@
             </plugins>
         </pluginManagement>
         <plugins>
-            <!-- Sets minimal Maven version to 3.5.4 -->
             <plugin>
                 <artifactId>maven-enforcer-plugin</artifactId>
-                <version>3.0.0-M3</version>
+                <version>3.0.0</version>
                 <executions>
                     <execution>
                         <id>enforce-maven</id>
@@ -940,7 +943,7 @@
                         <configuration>
                             <rules>
                                 <requireMavenVersion>
-                                    <version>3.5.4</version>
+                                    <version>3.6.0</version>
                                 </requireMavenVersion>
                             </rules>
                         </configuration>
@@ -948,12 +951,6 @@
                 </executions>
             </plugin>
 
-            <!-- force cleaning of the local repository <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions>
-                <execution> <id>purge-local-dependencies</id> <phase>initialize</phase> <goals> <goal>purge-local-repository</goal> </goals>
-                <configuration> <resolutionFuzziness>groupId</resolutionFuzziness> <includes> <include>jakarta.ejb</include> <include>jakarta.transaction</include>
-                <include>jakarta.resource</include> <include>jakarta.enterprise.concurrent</include> <include>jakarta.ws.rs</include> <include>javax.xml.registry</include>
-                <include>jakarta.websocket</include> <include>org.glassfish.jersey</include> </includes> </configuration> </execution> </executions>
-                </plugin> -->
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>build-helper-maven-plugin</artifactId>
@@ -1376,7 +1373,7 @@
             <id>jacoco</id>
             <properties>
                 <jacoco.report.outputDirectory>${project.build.directory}/jacoco</jacoco.report.outputDirectory>
-                <jacoco.version>0.8.7</jacoco.version>
+                <jacoco.version>0.8.8</jacoco.version>
                 <maven.test.failure.ignore>true</maven.test.failure.ignore>
                 <surefire.argLine>${maven.test.jvmoptions} @{argLine}</surefire.argLine>
             </properties>
diff --git a/nucleus/pom.xml b/nucleus/pom.xml
index 58f50d7..2e61c02 100644
--- a/nucleus/pom.xml
+++ b/nucleus/pom.xml
@@ -95,18 +95,8 @@
                     <version>2.4</version>
                 </plugin>
                 <plugin>
-                    <groupId>org.jvnet.jaxb2.maven2</groupId>
-                    <artifactId>maven-jaxb2-plugin</artifactId>
-                    <version>0.8.1</version>
-                </plugin>
-                <plugin>
                     <artifactId>maven-war-plugin</artifactId>
-                    <version>3.3.1</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.codehaus.mojo</groupId>
-                    <artifactId>jaxws-maven-plugin</artifactId>
-                    <version>1.12</version>
+                    <version>3.3.2</version>
                 </plugin>
             </plugins>
         </pluginManagement>
diff --git a/nucleus/security/core/src/main/java/com/sun/enterprise/security/SecurityContext.java b/nucleus/security/core/src/main/java/com/sun/enterprise/security/SecurityContext.java
index 7f1789d..3770f04 100644
--- a/nucleus/security/core/src/main/java/com/sun/enterprise/security/SecurityContext.java
+++ b/nucleus/security/core/src/main/java/com/sun/enterprise/security/SecurityContext.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation
  * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -46,6 +47,9 @@
  *
  * This class is used on the server side to represent the security context.
  *
+ * Class is a concept introduced in JDK1.0.
+ * Thread is a concept introduced in JDK1.0.
+ * Principal is a concept introduced in JDK1.1.
  * Thread Local Storage is a concept introduced in JDK1.2.
  *
  * @see java.lang.ThreadLocal
@@ -71,6 +75,8 @@
     // Did the client log in as or did the server generate the context
     private boolean SERVER_GENERATED_SECURITY_CONTEXT = false;
 
+    private Principal sessionPrincipal;
+
     /* This creates a new SecurityContext object.
      * Note: that the docs for Subject state that the internal sets
      * (eg. the principal set) cannot be modified unless the caller
@@ -352,6 +358,14 @@
         return "SecurityContext[ " + "Initiator: " + initiator + "Subject " + subject + " ]";
     }
 
+    public Principal getSessionPrincipal() {
+        return sessionPrincipal;
+    }
+
+    public void setSessionPrincipal(Principal sessionPrincipal) {
+        this.sessionPrincipal = sessionPrincipal;
+    }
+
     public Set<Principal> getPrincipalSet() {
         return subject.getPrincipals();
     }
diff --git a/pom.xml b/pom.xml
index f018f39..272c634 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,7 +50,7 @@
             <plugins>
                 <plugin>
                     <artifactId>maven-deploy-plugin</artifactId>
-                    <version>2.7</version>
+                    <version>3.0.0-M2</version>
                     <configuration>
                         <skip>true</skip>
                     </configuration>
@@ -58,7 +58,7 @@
                 <plugin>
                      <groupId>org.glassfish.copyright</groupId>
                      <artifactId>glassfish-copyright-maven-plugin</artifactId>
-                     <version>1.42</version>
+                     <version>2.4</version>
                      <configuration>
                         <scm>git</scm>
                         <scmOnly>true</scmOnly>
@@ -71,10 +71,9 @@
             </plugins>
         </pluginManagement>
         <plugins>
-            <!-- Sets minimal Maven version to 3.5.4 -->
             <plugin>
                 <artifactId>maven-enforcer-plugin</artifactId>
-                <version>3.0.0-M3</version>
+                <version>3.0.0</version>
                 <executions>
                     <execution>
                         <id>enforce-maven</id>
@@ -84,7 +83,7 @@
                         <configuration>
                             <rules>
                                 <requireMavenVersion>
-                                    <version>3.5.4</version>
+                                    <version>3.6.0</version>
                                 </requireMavenVersion>
                             </rules>
                         </configuration>
@@ -148,7 +147,7 @@
                     <plugin>
                         <groupId>org.jacoco</groupId>
                         <artifactId>jacoco-maven-plugin</artifactId>
-                        <version>0.8.7</version>
+                        <version>0.8.8</version>
                         <executions>
                             <execution>
                                 <id>jacoco-merge</id>