Index: nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/adapter/AdminEndpointDecider.java =================================================================== --- nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/adapter/AdminEndpointDecider.java (revision 61590) +++ nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/adapter/AdminEndpointDecider.java (working copy) @@ -43,14 +43,18 @@ import com.sun.enterprise.config.serverbeans.AdminService; import com.sun.enterprise.config.serverbeans.Config; import com.sun.enterprise.config.serverbeans.ServerTags; +import com.sun.enterprise.config.serverbeans.VirtualServer; import com.sun.enterprise.v3.admin.AdminAdapter; import org.glassfish.grizzly.config.dom.NetworkListener; import org.glassfish.grizzly.config.dom.ThreadPool; +import org.glassfish.hk2.api.ServiceLocator; +import org.glassfish.internal.api.Globals; import org.jvnet.hk2.config.types.Property; import org.glassfish.server.ServerEnvironmentImpl; import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -123,8 +127,20 @@ } catch (NumberFormatException ne) { } } + String dvs = nl.findHttpProtocol().getHttp().getDefaultVirtualServer(); - guiHosts = Collections.unmodifiableList(Arrays.asList(dvs)); + ServiceLocator locator = Globals.getDefaultBaseServiceLocator(); + VirtualServer vs = locator.getService(VirtualServer.class, dvs); + List hosts = Arrays.asList(vs.getHosts().split(",")); + if (hosts.isEmpty()) { + guiHosts = Collections.unmodifiableList(Arrays.asList(dvs)); + } else { + List trimmedHosts = new ArrayList(); + for (String host : hosts) { + trimmedHosts.add(host.trim()); + } + guiHosts = Collections.unmodifiableList(trimmedHosts); + } asadminHosts = guiHosts; //same for now try { address = InetAddress.getByName(nl.getAddress()); Index: nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GlassfishNetworkListener.java =================================================================== --- nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GlassfishNetworkListener.java (revision 61590) +++ nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GlassfishNetworkListener.java (working copy) @@ -165,7 +165,11 @@ final ContainerMapper containerMapper = new ContainerMapper(grizzlyService, this); containerMapper.setMapper(mapper); - containerMapper.setDefaultHost(http.getDefaultVirtualServer()); + if (!http.getDefaultVirtualServer().equals("__asadmin")) { + containerMapper.setDefaultHost(http.getDefaultVirtualServer()); + } else { + containerMapper.setDefaultHost(null); + } containerMapper.configureMapper(); VirtualServer vs = null; Index: nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ContainerMapper.java =================================================================== --- nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ContainerMapper.java (revision 61590) +++ nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ContainerMapper.java (working copy) @@ -134,11 +134,13 @@ */ protected synchronized void configureMapper() { mapper.setDefaultHostName(defaultHostName); - mapper.addHost(defaultHostName, new String[]{}, null); - mapper.addContext(defaultHostName, ROOT, - new ContextRootInfo(this, null), - new String[]{"index.html", "index.htm"}, null); - // Container deployed have the right to override the default setting. + if (defaultHostName != null) { + mapper.addHost(defaultHostName, new String[]{}, null); + mapper.addContext(defaultHostName, ROOT, + new ContextRootInfo(this, null), + new String[]{"index.html", "index.htm"}, null); + // Container deployed have the right to override the default setting. + } Mapper.setAllowReplacement(true); } @@ -539,6 +541,7 @@ }); for (String host : vs) { + mapper.addHost(host, new String[0], c); mapper.addContext(host, contextRoot, c, new String[0], null); /* if (adapter instanceof StaticResourcesAdapter) { Index: nucleus/common/internal-api/src/main/java/org/glassfish/internal/grizzly/V3Mapper.java =================================================================== --- nucleus/common/internal-api/src/main/java/org/glassfish/internal/grizzly/V3Mapper.java (revision 61590) +++ nucleus/common/internal-api/src/main/java/org/glassfish/internal/grizzly/V3Mapper.java (working copy) @@ -93,10 +93,10 @@ // Prevent any admin related artifacts from being registered on a // non-admin listener, and vice versa - if (ADMIN_LISTENER.equals(getId()) && !ADMIN_VS.equals(name) || - !ADMIN_LISTENER.equals(getId()) && ADMIN_VS.equals(name)) { - return; - } + //if (ADMIN_LISTENER.equals(getId()) && !ADMIN_VS.equals(name) || + // !ADMIN_LISTENER.equals(getId()) && ADMIN_VS.equals(name)) { + // return; + //} super.addHost(name, aliases, host); } @@ -116,10 +116,10 @@ // Prevent any admin related artifacts from being registered on a // non-admin listener, and vice versa - if (ADMIN_LISTENER.equals(getId()) && !ADMIN_VS.equals(hostName) || - !ADMIN_LISTENER.equals(getId()) && ADMIN_VS.equals(hostName)) { - return; - } + //if (ADMIN_LISTENER.equals(getId()) && !ADMIN_VS.equals(hostName) || + // !ADMIN_LISTENER.equals(getId()) && ADMIN_VS.equals(hostName)) { + // return; + //} // The WebContainer is registering new Context. In that case, we must // clean all the previously added information, specially the Index: appserver/web/web-glue/src/main/java/com/sun/enterprise/web/connector/MapperListener.java =================================================================== --- appserver/web/web-glue/src/main/java/com/sun/enterprise/web/connector/MapperListener.java (revision 61590) +++ appserver/web/web-glue/src/main/java/com/sun/enterprise/web/connector/MapperListener.java (working copy) @@ -218,8 +218,10 @@ return; } - if (defaultHost != null) { + if (!"__asadmin".equals(defaultHost)) { mapper.setDefaultHostName(defaultHost); + } else { + mapper.setDefaultHostName(null); } for (VirtualServer vs : httpService.getVirtualServer()) {