#23369 Fix ClassNotFoundException: com.sun.jndi.cosnaming.CNCtxFactory


Signed-off-by: arjantijms <arjan.tijms@gmail.com>
diff --git a/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java b/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java
index 8625a2f..92388cf 100644
--- a/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java
+++ b/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java
@@ -137,7 +137,7 @@
             // Now that we have an ORB, initialize the CosNaming service
             // and set it on the server's naming service.
             Hashtable cosNamingEnv = new Hashtable();
-            cosNamingEnv.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
+            cosNamingEnv.put("java.naming.factory.initial", "org.glassfish.jndi.cosnaming.CNCtxFactory");
             cosNamingEnv.put("java.naming.corba.orb", orb);
             cosContext = new InitialContext(cosNamingEnv);
             ProviderManager pm = ProviderManager.getProviderManager();
diff --git a/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/util/IIOPObjectFactory.java b/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/util/IIOPObjectFactory.java
index 7922396..a0735e0 100644
--- a/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/util/IIOPObjectFactory.java
+++ b/appserver/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/util/IIOPObjectFactory.java
@@ -35,7 +35,7 @@
                                     Name name,
                                     Context nameCtx,
                                     Hashtable env) throws Exception {
-        env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
+        env.put("java.naming.factory.initial", "org.glassfish.jndi.cosnaming.CNCtxFactory");
 
         InitialContext ic = new InitialContext(env);
 
diff --git a/appserver/orb/orb-connector/pom.xml b/appserver/orb/orb-connector/pom.xml
index e92e5cf..e3f0029 100755
--- a/appserver/orb/orb-connector/pom.xml
+++ b/appserver/orb/orb-connector/pom.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-    Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 1997, 2021 Oracle 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
@@ -17,22 +17,19 @@
 
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
+
     <parent>
         <groupId>org.glassfish.main.orb</groupId>
         <artifactId>orb</artifactId>
         <version>6.0.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
+
     <artifactId>orb-connector</artifactId>
     <packaging>glassfish-jar</packaging>
-    
-    <name>GlassFish ORB connector implementation</name>
 
-    <properties>
-        <findbugs.exclude>${project.basedir}/exclude.xml</findbugs.exclude>
-    </properties>
+    <name>GlassFish ORB connector implementation</name>
 
     <developers>
         <developer>
@@ -46,20 +43,26 @@
             </roles>
         </developer>
     </developers>
+
+    <properties>
+        <findbugs.exclude>${project.basedir}/exclude.xml</findbugs.exclude>
+    </properties>
+
     <dependencies>
-    	<dependency>
+        <dependency>
+            <groupId>jakarta.ejb</groupId>
+            <artifactId>jakarta.ejb-api</artifactId>
+        </dependency>
+    
+        <!-- ORB -->
+        <dependency>
             <groupId>org.glassfish.main.orb</groupId>
             <artifactId>orb-enabler</artifactId>
             <version>${project.version}</version>
-        </dependency>         
-        <dependency>
-            <groupId>org.glassfish.main.admin</groupId>
-            <artifactId>admin-util</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.glassfish.pfl</groupId>
-            <artifactId>pfl-basic</artifactId>
+             <groupId>org.glassfish.corba</groupId>
+             <artifactId>glassfish-corba-orb</artifactId>
         </dependency>
         <dependency>
             <groupId>org.glassfish.corba</groupId>
@@ -69,61 +72,73 @@
             <groupId>org.glassfish.corba</groupId>
             <artifactId>glassfish-corba-internal-api</artifactId>
         </dependency>
+        
+        <!-- Other modules -->
         <dependency>
-            <groupId>org.glassfish.hk2</groupId>
-            <artifactId>hk2-core</artifactId>
-        </dependency>
-       <dependency>
             <groupId>org.glassfish.main.deployment</groupId>
             <artifactId>dol</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>jakarta.ejb</groupId>
-            <artifactId>jakarta.ejb-api</artifactId>
+            <groupId>org.glassfish.main.common</groupId>
+            <artifactId>glassfish-api</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
-           <groupId>org.glassfish.main.cluster</groupId>
-           <artifactId>cluster-admin</artifactId>
-	   <version>${project.version}</version>
-	   <scope>test</scope>
-       </dependency>
-        <dependency>
-           <groupId>org.glassfish.main.common</groupId>
-           <artifactId>glassfish-api</artifactId>
-           <version>${project.version}</version>
-       </dependency>
-        <dependency>
-           <groupId>org.glassfish.main.admin</groupId>
-           <artifactId>config-api</artifactId>
-           <version>${project.version}</version>
-       </dependency>
-       <dependency>
-           <groupId>org.glassfish.main.admin</groupId>
-           <artifactId>monitoring-core</artifactId>
-           <version>${project.version}</version>
-       </dependency>
-       <dependency>
-	    <groupId>org.glassfish.external</groupId>
-	    <artifactId>management-api</artifactId>
-	</dependency>
-        <dependency>
-	    <groupId>org.glassfish.gmbal</groupId>
-	    <artifactId>gmbal</artifactId>
+            <groupId>org.glassfish.main.admin</groupId>
+            <artifactId>config-api</artifactId>
+            <version>${project.version}</version>
         </dependency>
-       <dependency>
-           <groupId>org.glassfish.main.core</groupId>
-           <artifactId>kernel</artifactId>
-           <version>${project.version}</version>
-           <scope>test</scope>
-       </dependency>
-
-       <dependency>
-           <groupId>org.glassfish.main.tests</groupId>
-           <artifactId>utils</artifactId>
-           <version>${project.version}</version>
-           <scope>test</scope>
-       </dependency>
+        <dependency>
+            <groupId>org.glassfish.main.admin</groupId>
+            <artifactId>monitoring-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.main.admin</groupId>
+            <artifactId>admin-util</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        
+        <!-- HK2 / PFL / GMBAL -->
+        <dependency>
+            <groupId>org.glassfish.hk2</groupId>
+            <artifactId>hk2-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.pfl</groupId>
+            <artifactId>pfl-basic</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.gmbal</groupId>
+            <artifactId>gmbal</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.external</groupId>
+            <artifactId>management-api</artifactId>
+        </dependency>
+        
+        
+        <!-- TEST dependencies -->
+        
+        <dependency>
+            <groupId>org.glassfish.main.cluster</groupId>
+            <artifactId>cluster-admin</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.main.core</groupId>
+            <artifactId>kernel</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.main.tests</groupId>
+            <artifactId>utils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>jakarta.el</groupId>
             <artifactId>jakarta.el-api</artifactId>
@@ -135,6 +150,7 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+
     <build>
         <resources>
             <resource>
diff --git a/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBFactory.java b/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBFactory.java
index 043771f..f48fb2c 100644
--- a/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBFactory.java
+++ b/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2021 Oracle 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
@@ -23,33 +23,31 @@
 import java.util.Properties;
 
 /**
- * @author Mahesh Kannan
- *         Date: Jan 17, 2009
+ * @author Mahesh Kannan Date: Jan 17, 2009
  */
 @Contract
 public interface GlassFishORBFactory {
+    
     // This is ORBConstants.ENV_IS_SERVER_PROPERTY. We cannot
     // reference ORBConstants from this class.
-    public static final String ENV_IS_SERVER_PROPERTY = 
-        "com.sun.corba.ee.ORBEnvironmentIsGlassFishServer" ;
+    String ENV_IS_SERVER_PROPERTY = "com.sun.corba.ee.ORBEnvironmentIsGlassFishServer";
 
-    public ORB createORB(Properties props);
+    ORB createORB(Properties props);
+    int getOTSPolicyType();
 
-    public int getOTSPolicyType();
+    int getCSIv2PolicyType();
 
-    public int getCSIv2PolicyType();
+    Properties getCSIv2Props();
 
-    public Properties getCSIv2Props();
+    void setCSIv2Prop(String name, String value);
 
-    public void setCSIv2Prop(String name, String value);
+    int getORBInitialPort();
 
-    public int getORBInitialPort();
+    String getORBHost(ORB orb);
 
-    public String getORBHost(ORB orb);
+    int getORBPort(ORB orb);
 
-    public int getORBPort(ORB orb); 
+    boolean isEjbCall(ServerRequestInfo sri);
 
-    public boolean isEjbCall (ServerRequestInfo sri);
-
-    public String getIIOPEndpoints() ;
+    String getIIOPEndpoints();
 }
diff --git a/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBHelper.java b/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBHelper.java
index edbdfef..fad8305 100644
--- a/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBHelper.java
+++ b/appserver/orb/orb-connector/src/main/java/org/glassfish/enterprise/iiop/api/GlassFishORBHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2021 Oracle 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
@@ -16,42 +16,41 @@
 
 package org.glassfish.enterprise.iiop.api;
 
-import jakarta.inject.Inject;
-import jakarta.inject.Provider;
+import static com.sun.logging.LogDomains.CORBA_LOGGER;
+import static org.glassfish.api.event.EventTypes.SERVER_SHUTDOWN;
 
-import org.jvnet.hk2.annotations.Service;
-import org.glassfish.hk2.api.ServiceLocator;
-import org.omg.CORBA.ORB;
-import org.omg.PortableInterceptor.ServerRequestInfo;
-
-import org.glassfish.api.admin.ProcessEnvironment;
-
-import org.glassfish.api.naming.GlassfishNamingManager;
-import org.glassfish.internal.api.ORBLocator;
-
-import java.util.Properties;
-import java.rmi.Remote;
 import java.nio.channels.SelectableChannel;
-
-import org.glassfish.hk2.api.PostConstruct;
-
-import org.glassfish.api.event.Events;
-import org.glassfish.api.event.EventTypes;
-import org.glassfish.api.event.Events;
-import org.glassfish.api.event.EventListener;
-import com.sun.logging.LogDomains;
-
+import java.rmi.Remote;
+import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.glassfish.api.admin.ProcessEnvironment;
+import org.glassfish.api.event.EventListener;
+import org.glassfish.api.event.Events;
+import org.glassfish.api.naming.GlassfishNamingManager;
+import org.glassfish.hk2.api.PostConstruct;
+import org.glassfish.hk2.api.ServiceLocator;
+import org.glassfish.internal.api.ORBLocator;
+import org.jvnet.hk2.annotations.Service;
+import org.omg.CORBA.ORB;
+import org.omg.PortableInterceptor.ServerRequestInfo;
+
+import com.sun.logging.LogDomains;
+
+import jakarta.inject.Inject;
+import jakarta.inject.Provider;
+
 /**
- * This class exposes any orb/iiop functionality needed by modules in the app server.
- * This prevents modules from needing any direct dependencies on the orb-iiop module.
- * @author Mahesh Kannan
- *         Date: Jan 17, 2009
+ * This class exposes any orb/iiop functionality needed by modules in the app server. This prevents modules from needing
+ * any direct dependencies on the orb-iiop module.
+ * 
+ * @author Mahesh Kannan Date: Jan 17, 2009
  */
 @Service
 public class GlassFishORBHelper implements PostConstruct, ORBLocator {
+    
+    private static final Logger _logger = LogDomains.getLogger(GlassFishORBHelper.class, CORBA_LOGGER);
 
     @Inject
     private ServiceLocator services;
@@ -59,112 +58,101 @@
     @Inject
     private ProcessEnvironment processEnv;
 
-    private static final Logger _logger =
-        LogDomains.getLogger(GlassFishORBHelper.class, LogDomains.CORBA_LOGGER);
-
-    private volatile ORB orb = null ;
-
-    private ProtocolManager protocolManager = null ;
-
-    private ORBLazyServiceInitializer lazyServiceInitializer;
-
-    private SelectableChannelDelegate selectableChannelDelegate;
-
     @Inject
     Provider<ProtocolManager> protocolManagerProvider;
 
-
     @Inject
     Provider<GlassfishNamingManager> glassfishNamingManagerProvider;
 
     @Inject
     private Provider<Events> eventsProvider;
 
-    //@Inject
+    private volatile ORB orb;
+
+    private ProtocolManager protocolManager;
+
+    private SelectableChannelDelegate selectableChannelDelegate;
+
     private GlassFishORBFactory orbFactory;
 
     public void postConstruct() {
         orbFactory = services.getService(GlassFishORBFactory.class);
     }
 
-
     public void onShutdown() {
         _logger.log(Level.FINE, ("ORB Shutdown started"));
         orb.destroy();
     }
 
-    public synchronized void setORB( ORB orb ) {
-        this.orb = orb ;
-        
-        if (orb != null) {
-            EventListener glassfishEventListener = new org.glassfish.api.event.EventListener() {
+    public synchronized void setORB(ORB orb) {
+        this.orb = orb;
 
-                public void event(org.glassfish.api.event.EventListener.Event event) {
-                if (event.is(EventTypes.SERVER_SHUTDOWN)) {
+        if (orb != null) {
+            EventListener glassfishEventListener = new EventListener() {
+
+                @Override
+                public void event(EventListener.Event event) {
+                    if (event.is(SERVER_SHUTDOWN)) {
                         onShutdown();
                     }
                 }
+
             };
             eventsProvider.get().register(glassfishEventListener);
         }
     }
 
     /**
-     * Get or create the default orb.  This can be called for any process type.  However,
-     * protocol manager and CosNaming initialization only take place for the Server.
+     * Get or create the default orb. This can be called for any process type. However, protocol manager and CosNaming
+     * initialization only take place for the Server.
      */
     public ORB getORB() {
         // Use a volatile double-checked locking idiom here so that we can publish
-        // a partly-initialized ORB early, so that lazy init can come into getORB() 
+        // a partly-initialized ORB early, so that lazy init can come into getORB()
         // and allow an invocation to the transport to complete.
         if (orb == null) {
 
-            synchronized( this ) {
+            synchronized (this) {
                 if (orb == null) {
                     try {
-                        final boolean isServer = processEnv.getProcessType().isServer() ;
+                        boolean isServer = processEnv.getProcessType().isServer();
 
                         Properties props = new Properties();
-                        props.setProperty( GlassFishORBFactory.ENV_IS_SERVER_PROPERTY,
-                            Boolean.valueOf( isServer ).toString() ) ;
+                        props.setProperty(GlassFishORBFactory.ENV_IS_SERVER_PROPERTY, Boolean.valueOf(isServer).toString());
 
-                        // Create orb and make it visible.  This will allow
-                        // loopback calls to getORB() from
-                        // portable interceptors activated as a side-effect of the
-                        // remaining initialization. If it's a
-                        // server, there's a small time window during which the
-                        // ProtocolManager won't be available.  Any callbacks that
-                        // result from the protocol manager initialization itself
-                        // cannot depend on having access to the protocol manager.
+                        // Create orb and make it visible. 
+                        //
+                        // This will allow loopback calls to getORB() from portable interceptors activated as a 
+                        // side-effect of the remaining initialization. 
+                        //
+                        // If it's a server, there's a small time window during which the ProtocolManager won't be available. 
+                        // Any callbacks that result from the protocol manager initialization itself cannot depend on having 
+                        // access to the protocol manager.
                         orb = orbFactory.createORB(props);
 
                         if (isServer) {
                             if (protocolManager == null) {
-                                ProtocolManager tempProtocolManager =
-                                                protocolManagerProvider.get();
+                                ProtocolManager tempProtocolManager = protocolManagerProvider.get();
 
                                 tempProtocolManager.initialize(orb);
-                                // Move startup of naming to PEORBConfigurator so it runs
-                                // before interceptors.
-                                // tempProtocolManager.initializeNaming();
+                                
+                                // Move startup of naming to PEORBConfigurator so it runs before interceptors.
                                 tempProtocolManager.initializePOAs();
 
                                 // Now make protocol manager visible.
                                 protocolManager = tempProtocolManager;
-                                
-                                GlassfishNamingManager namingManager =
-                                    glassfishNamingManagerProvider.get();
 
-                                Remote remoteSerialProvider =
-                                    namingManager.initializeRemoteNamingSupport(orb);
+                                GlassfishNamingManager namingManager = glassfishNamingManagerProvider.get();
+
+                                Remote remoteSerialProvider = namingManager.initializeRemoteNamingSupport(orb);
 
                                 protocolManager.initializeRemoteNaming(remoteSerialProvider);
                             }
                         }
-                    } catch(Exception e) {
+                    } catch (Exception e) {
                         orb = null;
                         protocolManager = null;
-                        throw new RuntimeException("Orb initialization erorr", e);    
+                        throw new RuntimeException("Orb initialization erorr", e);
                     }
                 }
             }
@@ -173,7 +161,6 @@
         return orb;
     }
 
-
     public void setSelectableChannelDelegate(SelectableChannelDelegate d) {
         selectableChannelDelegate = d;
     }
@@ -183,44 +170,40 @@
     }
 
     public static interface SelectableChannelDelegate {
-
         public void handleRequest(SelectableChannel channel);
-
     }
-    
 
     /**
-     * Get a protocol manager for creating remote references. ProtocolManager is only
-     * available in the server.  Otherwise, this method returns null.
+     * Get a protocol manager for creating remote references. ProtocolManager is only available in the server. Otherwise,
+     * this method returns null.
      *
-     * If it's the server and the orb hasn't been already created, calling
-     * this method has the side effect of creating the orb.
+     * If it's the server and the orb hasn't been already created, calling this method has the side effect of creating the
+     * orb.
      */
     public ProtocolManager getProtocolManager() {
-
-        if( !processEnv.getProcessType().isServer() ) {
+        if (!processEnv.getProcessType().isServer()) {
             return null;
         }
-        
+
         synchronized (this) {
             if (protocolManager == null) {
                 getORB();
             }
-            
+
             return protocolManager;
         }
     }
 
     public boolean isORBInitialized() {
-	return (orb != null);
+        return (orb != null);
     }
 
     public int getOTSPolicyType() {
-        return orbFactory.getOTSPolicyType();    
+        return orbFactory.getOTSPolicyType();
     }
 
     public int getCSIv2PolicyType() {
-        return orbFactory.getCSIv2PolicyType();    
+        return orbFactory.getCSIv2PolicyType();
     }
 
     public Properties getCSIv2Props() {
@@ -242,10 +225,9 @@
     public int getORBPort(ORB orb) {
         return orbFactory.getORBPort(orb);
     }
-      
+
     public boolean isEjbCall(ServerRequestInfo sri) {
         return orbFactory.isEjbCall(sri);
     }
-      
-    
+
 }
diff --git a/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java b/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
index c57870b..d450cb8 100644
--- a/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
+++ b/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
@@ -695,7 +695,7 @@
         }
 
         // Make sure we set initial port in System properties so that
-        // any instantiations of com.sun.jndi.cosnaming.CNCtxFactory
+        // any instantiations of org.glassfish.jndi.cosnaming.CNCtxFactory
         // use same port.
         props.setProperty(ORBConstants.INITIAL_PORT_PROPERTY, initialPort);
 
diff --git a/appserver/tests/appserv-tests/devtests/cdi/run_test.sh b/appserver/tests/appserv-tests/devtests/cdi/run_test.sh
index d977d01..be54fc5 100755
--- a/appserver/tests/appserv-tests/devtests/cdi/run_test.sh
+++ b/appserver/tests/appserv-tests/devtests/cdi/run_test.sh
@@ -31,7 +31,7 @@
 	${S1AS_HOME}/bin/asadmin start-domain
 	${S1AS_HOME}/bin/asadmin start-database
 	
-	printf "\n%s \n\n" "===== TEST RUN - RUNNING TESTS ====="
+	printf "\n%s \n\n" "===== TEST RUN - RUNNING TESTS for ${TARGET} ====="
 	ant ${TARGET} | tee ${TEST_RUN_LOG}
 	
 	printf "\n%s \n\n" "===== TEST RUN - STOPPING GLASSFISH AND DB ====="
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml
index 2dc8d89..00cdb90 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!--
 
-    Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2010, 2021 Oracle 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
@@ -29,78 +29,64 @@
     &commonBuild;
     &testproperties;
 
-    <target name="all" depends="build,deploy,run,undeploy"/>
+    <target name="all" depends="build,deploy,run,undeploy" />
 
-    <target name="clean" depends="init-common">
-      <antcall  target="clean-common"/>
-      <delete file="client/Client.java"/>
-    </target>
- 
-    <target name="compile" depends="clean">
-        <copy file="client/Client.java.token" tofile="client/Client.java"/>
-        <replace file="client/Client.java"
-          token="@ORB_PORT@" value="${orb.port}"/>
+	<target name="clean" depends="init-common">
+		<antcall target="clean-common" />
+		<delete file="client/Client.java" />
+	</target>
 
-        <antcall target="compile-common">
-            <param name="src" value="ejb"/>
-        </antcall>
-        <antcall target="compile-common">
-            <param name="src" value="client"/>
-        </antcall>
-    </target>
+	<target name="compile" depends="clean">
+		<copy file="client/Client.java.token" tofile="client/Client.java" />
+		<replace file="client/Client.java" token="@ORB_PORT@" value="${orb.port}" />
 
-    <target name="build" depends="compile">
-        <antcall target="build-ear-common">
-            <param name="ejbjar.classes" 
-              value="**/Sful*.class,**/Sless*.class, **/TestBean.class"/>
-            <param name="appclientjar.classes" 
-              value="**/Client.class,**/Sful.class,**/Sless.class"/>
-        </antcall>
-    </target> 
-    
-    <target name="deploy" 
-            depends="init-common">
-        <antcall target="deploy-common"/>
-    </target>
+		<antcall target="compile-common">
+			<param name="src" value="ejb" />
+		</antcall>
+		<antcall target="compile-common">
+			<param name="src" value="client" />
+		</antcall>
+	</target>
 
-    <target name="run" depends="init-common">
-        <antcall target="runclient-common"/>
-<!--
-        <antcall target="run_standaloneclient"/>
-        <antcall target="run_standaloneclient2"/>
--->
-    </target>
+	<target name="build" depends="compile">
+		<antcall target="build-ear-common">
+			<param name="ejbjar.classes" value="**/Sful*.class,**/Sless*.class, **/TestBean.class" />
+			<param name="appclientjar.classes" value="**/Client.class,**/Sful.class,**/Sless.class" />
+		</antcall>
+	</target>
 
- 
-    <target name="run_standaloneclient" depends="init-common">
-       <java  fork="on" 
-              failonerror="true"
-              classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
-              classname="${simple.client}">
-        <sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
-        </java>
-    </target>
+	<target name="deploy" depends="init-common">
+		<antcall target="deploy-common" />
+	</target>
 
-    <target name="run_standaloneclient2" depends="init-common">
-       <java  fork="on" 
-              failonerror="true"
-              classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
-              classname="${simple.client2}">
-              <jvmarg
-                   value="-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"/>
-              <jvmarg
-                   value="-Djava.naming.provider.url=iiop://localhost:${orb.port}"/>
-              <jvmarg
-                   value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}"/>
+	<target name="run" depends="init-common">
+		<antcall target="runclient-common" />
+	</target>
 
-        </java>
-    </target>
+	<target name="run_standaloneclient" depends="init-common">
+		<java fork="on" failonerror="true" 
+			classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar" 
+			classname="${simple.client}">
+			<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}" />
+		</java>
+	</target>
 
-    <target name="undeploy" depends="init-common">
-        <antcall target="undeploy-common"/>
-    </target>   
+	<target name="run_standaloneclient2" depends="init-common">
+		<java fork="on" failonerror="true" 
+			classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar" 
+			classname="${simple.client2}">
+			<jvmarg value="-Djava.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory" />
+			<jvmarg value="-Djava.naming.provider.url=iiop://localhost:${orb.port}" />
+			<jvmarg value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}" />
 
-    <target name="usage">
-        <antcall target="usage-common"/>
-    </target>
+		</java>
+	</target>
+
+	<target name="undeploy" depends="init-common">
+		<antcall target="undeploy-common" />
+	</target>
+
+	<target name="usage">
+		<antcall target="usage-common" />
+	</target>
 </project>
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/client/Client.java.token b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/client/Client.java.token
index a375441..b22c951 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/client/Client.java.token
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/client/Client.java.token
@@ -16,7 +16,6 @@
 
 package com.sun.s1asdev.cdi.ejb.hello.session.client;
 
-
 import java.io.*;
 import java.util.*;
 import jakarta.ejb.EJB;
@@ -26,43 +25,41 @@
 
 public class Client {
 
-    private static SimpleReporterAdapter stat = 
-        new SimpleReporterAdapter("appserv-tests");
+    private static SimpleReporterAdapter stat = new SimpleReporterAdapter("appserv-tests");
 
-    public static void main (String[] args) {
-
+    public static void main(String[] args) {
         stat.addDescription("simple-ejb-cdi");
         Client client = new Client(args);
         client.doTest();
         stat.printSummary("simple-ejb-cdi");
-    }  
-    
-    public Client (String[] args) {
+    }
+
+    public Client(String[] args) {
     }
 
     private static @EJB Sful sful;
-    
-    private static @EJB(mappedName="com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless;
+
+    private static @EJB(mappedName = "com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless;
 
     //
-    // NOTE: Token @ORB_PORT@ will be replaced in @EJB annotations below 
+    // NOTE: Token @ORB_PORT@ will be replaced in @EJB annotations below
     // with the value of the port from config.properties during the build
     //
-    private static @EJB(mappedName="corbaname:iiop:localhost:@ORB_PORT@#com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless2;
+    private static @EJB(mappedName = "corbaname:iiop:localhost:@ORB_PORT@#com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless2;
 
-    private static @EJB(mappedName="corbaname:iiop:localhost:@ORB_PORT@#java:global/simple-ejb-cdiApp/simple-ejb-cdi-ejb/SlessEJB!com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless3;
+    private static @EJB(mappedName = "corbaname:iiop:localhost:@ORB_PORT@#java:global/simple-ejb-cdiApp/simple-ejb-cdi-ejb/SlessEJB!com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless3;
 
-    private static @EJB(mappedName="corbaname:iiop:localhost:@ORB_PORT@#java:global/simple-ejb-cdiApp/simple-ejb-cdi-ejb/SlessEJB") Sless sless4;
+    private static @EJB(mappedName = "corbaname:iiop:localhost:@ORB_PORT@#java:global/simple-ejb-cdiApp/simple-ejb-cdi-ejb/SlessEJB") Sless sless4;
 
     public void doTest() {
 
         try {
 
-      System.out.println("Creating InitialContext()");
-	    InitialContext ic = new InitialContext();
-	    org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) ic.lookup("java:comp/ORB"); 
-	    Sful sful = (Sful) ic.lookup("com.sun.s1asdev.cdi.ejb.hello.session.Sful");
-	    Sless sless = (Sless) ic.lookup("com.sun.s1asdev.cdi.ejb.hello.session.Sless");
+            System.out.println("Creating InitialContext()");
+            InitialContext ic = new InitialContext();
+            org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) ic.lookup("java:comp/ORB");
+            Sful sful = (Sful) ic.lookup("com.sun.s1asdev.cdi.ejb.hello.session.Sful");
+            Sless sless = (Sless) ic.lookup("com.sun.s1asdev.cdi.ejb.hello.session.Sless");
 
             String response = null;
 
@@ -72,40 +69,37 @@
             response = sless.hello();
             testResponse("invoking stateless", response);
 
-	        response = sless2.hello();
+            response = sless2.hello();
             testResponse("invoking stateless2", response);
 
             System.out.println("ensuring that sless1 and sless2 are not equal");
-            if( !sless.equals(sless2) ) {
-                stat.addStatus("ensuring that sless1 and sless2 are not equal" , stat.FAIL);
-                throw new Exception("invalid equality checks on same " +
-                                    "sless session beans");
+            if (!sless.equals(sless2)) {
+                stat.addStatus("ensuring that sless1 and sless2 are not equal", stat.FAIL);
+                throw new Exception("invalid equality checks on same " + "sless session beans");
             }
 
-
-	        response = sless3.hello();
+            response = sless3.hello();
             testResponse("invoking stateless3", response);
-	        response = sless4.hello();
+            response = sless4.hello();
             testResponse("invoking stateless4", response);
 
             System.out.println("test complete");
 
             stat.addStatus("local main", stat.PASS);
 
-        } catch(Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
-            stat.addStatus("local main" , stat.FAIL);
+            stat.addStatus("local main", stat.FAIL);
         }
-        
-    	return;
+
+        return;
     }
 
-    private void testResponse(String testDescription, String response){
-        if(response.equals("hello")) 
+    private void testResponse(String testDescription, String response) {
+        if (response.equals("hello"))
             stat.addStatus(testDescription, stat.PASS);
         else
             stat.addStatus(testDescription, stat.FAIL);
     }
 
 }
-
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sful.java b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sful.java
index 3b5927d..333e748 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sful.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sful.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2021 Oracle 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
@@ -17,9 +17,8 @@
 package com.sun.s1asdev.cdi.ejb.hello.session;
 
 import jakarta.ejb.Remote;
-	
+
 @Remote
-public interface Sful
-{
-    public String hello();
+public interface Sful {
+    String hello();
 }
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SfulEJB.java b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SfulEJB.java
index 5eaa970..9281d87 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SfulEJB.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SfulEJB.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2021 Oracle 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
@@ -20,23 +20,17 @@
 import jakarta.inject.Inject;
 
 @Stateful
-public class SfulEJB implements Sful
-{
-    @Inject TestBean tb; // field injection
-
-/*
-@todo: check why constructor injection doesn't work
-    TestBean tb;
+public class SfulEJB implements Sful {
     @Inject
-    public SfulEJB(TestBean tb){
-        this.tb = tb;
-        if (tb == null) throw new RuntimeException("tb is null");
-    }
-*/
+    TestBean tb; // field injection
+
     public String hello() {
         System.out.println("In SfulEJB:hello()");
-        if (tb != null) return "hello";
-        else return null;
+        if (tb != null) {
+            return "hello";
+        }
+        
+        return null;
     }
 
 }
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sless.java b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sless.java
index 8bb0acd..837a52b 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sless.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/Sless.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2021 Oracle 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
@@ -19,9 +19,8 @@
 import jakarta.ejb.Remote;
 
 @Remote
-public interface Sless
-{
-    public String hello();
+public interface Sless {
+    String hello();
 
-    public org.glassfish.common.util.timer.TimerSchedule foo ();
+    org.glassfish.common.util.timer.TimerSchedule foo();
 }
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SlessEJB.java b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SlessEJB.java
index 2def848..2b0dff8 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SlessEJB.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/SlessEJB.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2021 Oracle 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
@@ -13,22 +13,26 @@
  *
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
  */
-
 package com.sun.s1asdev.cdi.ejb.hello.session;
 
 import jakarta.ejb.Stateless;
 import jakarta.inject.Inject;
 
 @Stateless
-public class SlessEJB implements Sless
-{
-    @Inject TestBean tb; //Field Injection
+public class SlessEJB implements Sless {
+    @Inject
+    TestBean tb; // Field Injection
 
     public String hello() {
         System.out.println("In SlessEJB:hello()");
-        if (tb != null) return "hello";
-        else return null;
+        if (tb != null) {
+            return "hello";
+        }
+        
+        return null;
     }
 
-    public org.glassfish.common.util.timer.TimerSchedule foo () {return null;}
+    public org.glassfish.common.util.timer.TimerSchedule foo() {
+        return null;
+    }
 }
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/TestBean.java b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/TestBean.java
index 3f97997..6fff7dd 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/TestBean.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/ejb/TestBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2021 Oracle 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
@@ -16,7 +16,6 @@
 
 package com.sun.s1asdev.cdi.ejb.hello.session;
 
-
 //Simple TestBean to test CDI. This bean implements Serializable as it needs to be placed into a Stateful Bean
-public class TestBean implements java.io.Serializable
-{}
+public class TestBean implements java.io.Serializable {
+}
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/readme.txt b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/readme.txt
index bad16d6..138f18f 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/readme.txt
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/readme.txt
@@ -1 +1,2 @@
-client/Client.java is created during build process from client/Client.java.token via copying it and replacing token @ORB_PORT@ with the ORB port number from config.properties (${orb.pprt}).
+client/Client.java is created during build process from client/Client.java.token via copying it 
+and replacing token @ORB_PORT@ with the ORB port number from config.properties (${orb.pprt}).
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml
index 01da725..bb47a4c 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml
@@ -85,7 +85,7 @@
               classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
               classname="${simple.client2}">
               <jvmarg
-                   value="-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"/>
+                   value="-Djava.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory"/>
               <jvmarg
                    value="-Djava.naming.provider.url=iiop://localhost:${orb.port}"/>
               <jvmarg
diff --git a/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/client/jndi.properties.cosnaming b/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/client/jndi.properties.cosnaming
index 7ee99a6..0e5e7b4 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/client/jndi.properties.cosnaming
+++ b/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/client/jndi.properties.cosnaming
@@ -1 +1 @@
-java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
\ No newline at end of file
+java.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory
\ No newline at end of file
diff --git a/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/jndi.properties.cosnaming b/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/jndi.properties.cosnaming
index 7ee99a6..0e5e7b4 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/jndi.properties.cosnaming
+++ b/appserver/tests/appserv-tests/devtests/ejb/sfsb/stress/jndi.properties.cosnaming
@@ -1 +1 @@
-java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
\ No newline at end of file
+java.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory
\ No newline at end of file
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml
index 3604ef4..4f9f151 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml
@@ -111,7 +111,7 @@
     <target name="run_cosnaming_override" depends="init-common">
         <antcall target="runclient_withoverride">
             <param name="jndi.clash"
-                   value="-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"/>
+                   value="-Djava.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory"/>
         </antcall>
     </target>
 
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Btest.java b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Btest.java
index 421184b..75d0f05 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Btest.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Btest.java
@@ -92,7 +92,7 @@
     {
         Properties _props = new Properties();
         _props.put(Context.INITIAL_CONTEXT_FACTORY, 
-            "com.sun.jndi.cosnaming.CNCtxFactory");
+            "org.glassfish.jndi.cosnaming.CNCtxFactory");
         _props.put(Context.PROVIDER_URL, "iiop://achumba:3700");
 
         try {
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Client.java b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Client.java
index 93dd624..fd77433 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Client.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/client/Client.java
@@ -117,7 +117,6 @@
     {
         Properties env = new Properties();
 
-//        env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
         
         env.put( Context.PROVIDER_URL, "iiop://" + host + ":" + port );
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/jndi.properties.cosnaming b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/jndi.properties.cosnaming
index 7ee99a6..0e5e7b4 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/jndi.properties.cosnaming
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/jndi.properties.cosnaming
@@ -1 +1 @@
-java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
\ No newline at end of file
+java.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory
\ No newline at end of file
diff --git a/appserver/tests/appserv-tests/devtests/naming/externalnameservicelookup/docroot/newjsp.jsp b/appserver/tests/appserv-tests/devtests/naming/externalnameservicelookup/docroot/newjsp.jsp
index e7482b4..93ca2d3 100644
--- a/appserver/tests/appserv-tests/devtests/naming/externalnameservicelookup/docroot/newjsp.jsp
+++ b/appserver/tests/appserv-tests/devtests/naming/externalnameservicelookup/docroot/newjsp.jsp
@@ -52,7 +52,7 @@
         out.println("new InitialContext()...\n");
         Properties p2 = new Properties();
         p2.put( Context.INITIAL_CONTEXT_FACTORY, 
-	        "com.sun.jndi.cosnaming.CNCtxFactory" );
+	        "org.glassfish.jndi.cosnaming.CNCtxFactory" );
 Properties p1 = new Properties();
         p1.put( "org.omg.CORBA.ORBInitialHost", "localhost" );
         p1.put( "org.omg.CORBA.ORBInitialPort", "1345" );
diff --git a/appserver/tests/appserv-tests/devtests/naming/loadbalancing/enroller/client/EnrollerClient.java b/appserver/tests/appserv-tests/devtests/naming/loadbalancing/enroller/client/EnrollerClient.java
index b005a5d..708b545 100755
--- a/appserver/tests/appserv-tests/devtests/naming/loadbalancing/enroller/client/EnrollerClient.java
+++ b/appserver/tests/appserv-tests/devtests/naming/loadbalancing/enroller/client/EnrollerClient.java
@@ -29,7 +29,7 @@
 import java.net.MalformedURLException;
 import java.net.UnknownHostException;
 
-import com.sun.jndi.cosnaming.IiopUrl;
+import org.glassfish.jndi.cosnaming.IiopUrl;
 
 public class EnrollerClient {
 
diff --git a/appserver/tests/appserv-tests/devtests/naming/lookup/enroller/client/EnrollerClient.java b/appserver/tests/appserv-tests/devtests/naming/lookup/enroller/client/EnrollerClient.java
index d0c7229..6689bf3 100755
--- a/appserver/tests/appserv-tests/devtests/naming/lookup/enroller/client/EnrollerClient.java
+++ b/appserver/tests/appserv-tests/devtests/naming/lookup/enroller/client/EnrollerClient.java
@@ -63,13 +63,13 @@
 		queueString = "java:comp/env/jms/SampleQueue";
 	    }
 	    Properties env = new Properties();
-	    env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
+	    env.put("java.naming.factory.initial", "org.glassfish.jndi.cosnaming.CNCtxFactory");
 	    ORBLocator orbLocator = Globals.getDefaultHabitat().getService(ORBLocator.class);
 	    
 	    env.put("java.naming.corba.orb", orbLocator.getORB());
 	    // Initialize the Context with JNDI specific properties
 	    InitialContext ctx = new InitialContext(env);
-	    System.out.println("looking up ejb/MyStudent using com.sun.jndi.cosnaming.CNCtxFactory...");
+	    System.out.println("looking up ejb/MyStudent using org.glassfish.jndi.cosnaming.CNCtxFactory...");
 	    Object obj = ctx.lookup("ejb/MyStudent");
 	    System.out.println("Looked up ejb/MyStudent with CnCtxFactory...");
 	    StudentHome sH = 
diff --git a/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloClient.java b/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloClient.java
index 0e8e186..02f36bb 100644
--- a/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloClient.java
+++ b/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloClient.java
@@ -30,8 +30,6 @@
     {
       try{
 	  Properties p1 = new Properties();
-	  //p1.put( "org.omg.CORBA.ORBInitialHost", "localhost" );
-	  //p1.put( "org.omg.CORBA.ORBInitialPort", "2510" );
 	  p1.put("org.omg.CORBA.ORBClass", "com.inprise.vbroker.orb.ORB");
 	  p1.put("org.omg.CORBA.ORBSingletonClass", "com.inprise.vbroker.orb.ORBSingleton");
 	  org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init( new String[]{"",""}, p1 );
@@ -50,27 +48,6 @@
 	  System.out.println("Obtained a handle on server object: " + helloImpl);
 	  System.out.println(helloImpl.sayHello());
 	  helloImpl.shutdown();
-	  
-	  /*	  Properties p2 = new Properties();
-	  p2.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY, 
-		  "com.sun.jndi.cosnaming.CNCtxFactory" );
-	  p2.put("java.naming.corba.orb", orb);
-	  
-	  InitialContext ic = new InitialContext( p2);
-	  
-	  System.out.println("Done");
-	  System.out.println("About to do lookup...");
-	  
-	  java.lang.Object o = ic.lookup("Hello" );
-	  System.out.println("Completed lookup!!");
-	  
-	  HelloApp.Hello hello = (HelloApp.Hello) PortableRemoteObject.narrow( o, HelloApp.Hello.class );
-	  
-	  System.out.println(hello.sayHello());
-	  System.out.println("Done");
-	  
-	  hello.shutdown();*/
-	  
 
 	} catch (Exception e) {
           System.out.println("ERROR : " + e) ;
diff --git a/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloServer.java b/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloServer.java
index a24294f..4f34597 100644
--- a/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloServer.java
+++ b/appserver/tests/appserv-tests/devtests/naming/visibroker/lookup/src/HelloServer.java
@@ -61,7 +61,7 @@
       // create and initialize the ORB		
       ORB orb = ORB.init( args, p );
       Hashtable env = new Hashtable();
-      env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
+      env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"org.glassfish.jndi.cosnaming.CNCtxFactory");
       env.put("java.naming.corba.orb", orb);
       
       
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/classloader/stateless/converter/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/classloader/stateless/converter/build.xml
index 8f7641b..ff0daf3 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/classloader/stateless/converter/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/classloader/stateless/converter/build.xml
@@ -103,7 +103,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/notification/lookup/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/notification/lookup/build.xml
index ed94e69..1460d8f 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/notification/lookup/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/notification/lookup/build.xml
@@ -379,7 +379,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/client/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/client/build.xml
index 8eaa536..9d6a28b 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/client/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/client/build.xml
@@ -148,7 +148,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/deployment/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/deployment/build.xml
index 4825c7a..785b959 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/deployment/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/deployment/build.xml
@@ -187,7 +187,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/security/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/security/build.xml
index ba5536c..ab07acd 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/security/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/api/security/build.xml
@@ -208,7 +208,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/cleaner/application/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/cleaner/application/build.xml
index b590bbe..e593946 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/cleaner/application/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/synchronization/cleaner/application/build.xml
@@ -134,7 +134,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/build.xml
index 3a06a05..ef58efe 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/build.xml
@@ -103,7 +103,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 -->
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
         classpath="${s1astest.classpath}:${assemble.dir}/${appname}AppClient.jar"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/soar/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/soar/build.xml
index 526dbb2..99692c8 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/soar/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/jaxr/soar/build.xml
@@ -106,7 +106,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 -->
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
         classpath="${s1astest.classpath}:${assemble.dir}/${appname}AppClient.jar"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/converter/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/converter/build.xml
index 6160c43..d341ecf 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/converter/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/converter/build.xml
@@ -94,7 +94,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/ejbjar/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/ejbjar/build.xml
index cfe70af..1fb2009 100644
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/ejbjar/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/ejbjar/build.xml
@@ -112,10 +112,10 @@
     </target>
 
     <target name="run-standalone" depends="init-common">
-        <property name="ctxfactory" value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+        <property name="ctxfactory" value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
         <property name="provider.url" value="iiop://${admin.host}:${orb.port}"/>
         <echo message="provider url used is ${provider.url}"/>
-        <echo message="ctxfactory used is com.sun.jndi.cosnaming.CNCtxFactory" />
+        <echo message="ctxfactory used is org.glassfish.jndi.cosnaming.CNCtxFactory" />
         <java classname="examples.sfsb.Client"
             classpath="${s1astest.classpath}:${assemble.dir}/${appname}AppClient.jar"
             failonerror="true" fork="true">
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/avk/ejb/stateless/converter/build.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/avk/ejb/stateless/converter/build.xml
index b9aafc5..68286fc 100644
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/avk/ejb/stateless/converter/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/sqetests/avk/ejb/stateless/converter/build.xml
@@ -97,7 +97,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateful/persistence/build.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateful/persistence/build.xml
index d691dd1..514d943 100644
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateful/persistence/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateful/persistence/build.xml
@@ -110,10 +110,10 @@
     </target>
 
     <target name="run-standalone" depends="init-common">
-        <property name="ctxfactory" value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+        <property name="ctxfactory" value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
         <property name="provider.url" value="iiop://${admin.host}:${orb.port}"/>
         <echo message="provider url used is ${provider.url}"/>
-        <echo message="ctxfactory used is com.sun.jndi.cosnaming.CNCtxFactory" />
+        <echo message="ctxfactory used is org.glassfish.jndi.cosnaming.CNCtxFactory" />
         <java classname="examples.sfsb.Client"
             classpath="${s1astest.classpath}:${assemble.dir}/${appname}AppClient.jar"
             failonerror="true" fork="true">
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateless/converter/build.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateless/converter/build.xml
index 85f0443..003ae5a 100644
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateless/converter/build.xml
+++ b/appserver/tests/v2-tests/appserv-tests/sqetests/ejb/stateless/converter/build.xml
@@ -90,7 +90,7 @@
             value="com.sun.enterprise.naming.SerialInitContextFactory"/>
 <!--
 	<property name="ctxfactory" 
-            	value="com.sun.jndi.cosnaming.CNCtxFactory"/>
+            	value="org.glassfish.jndi.cosnaming.CNCtxFactory"/>
 -->
 	<echo message="provider.url used is ${provider.url}"/>
       <java classname="${test.client}"
diff --git a/docs/application-development-guide/src/main/jbake/content/jndi.adoc b/docs/application-development-guide/src/main/jbake/content/jndi.adoc
index 9b16ebe..39f2d8f 100644
--- a/docs/application-development-guide/src/main/jbake/content/jndi.adoc
+++ b/docs/application-development-guide/src/main/jbake/content/jndi.adoc
@@ -203,13 +203,13 @@
 `InitialContext` constructor. However, if EJB client code explicitly
 instantiates an `InitialContext` that points to the `CosNaming` naming
 service, it is necessary to set the `java.naming.factory.initial`
-property to `com.sun.jndi.cosnaming.CNCtxFactory` in the client JVM
+property to `org.glassfish.jndi.cosnaming.CNCtxFactory` in the client JVM
 software when accessing EJB components. You can set this property using
 the `asadmin create-jvm-options` command, as follows:
 
 [source,oac_no_warn]
 ----
-asadmin> create-jvm-options -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
+asadmin> create-jvm-options -Djava.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory
 ----
 
 For details about `asadmin create-jvm-options`, see the
@@ -223,7 +223,7 @@
       try {
             properties = new Properties();
             properties.put("java.naming.factory.initial",
-                  "com.sun.jndi.cosnaming.CNCtxFactory");
+                  "org.glassfish.jndi.cosnaming.CNCtxFactory");
             ...
           }
       ...
diff --git a/nucleus/core/extra-jre-packages/pom.xml b/nucleus/core/extra-jre-packages/pom.xml
index 60d87dd..1b5ebb9 100755
--- a/nucleus/core/extra-jre-packages/pom.xml
+++ b/nucleus/core/extra-jre-packages/pom.xml
@@ -76,7 +76,6 @@
                                 com.sun.j3d.utils.image,
                                 com.sun.j3d.utils.timer,
                                 com.sun.java.swing.plaf.windows,
-                                com.sun.jndi.cosnaming,
                                 com.sun.jndi.ldap,
                                 com.sun.mirror.apt,
                                 com.sun.mirror.declaration,