Skip to main content

asadmin restart-domain not working for war inside ear as the default-web-module

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-09-26
Points: 0

I need to have war inside ear to be deployed as a default-web-module.
It works but only till server restart. I'm inspired in my solution by the suggestions present on:

My use case:
1. deploy ear (foo) containing war (my-webapp) using asadmin
2. set war as a default-web-module

asadmin set server.http-service.virtual-server.server.default-web-module=foo#my-webapp-1.0-SNAPSHOT.war

3. works as expected, I can see war deployed to root
4. try to restart domain:
asadmin restart-domain

I see following error in logs and war is not deployed any more to root url:
[#|2013-04-18T09:17:25.744+0200|WARNING|glassfish3.1.2||_ThreadID=10;_ThreadName=Thread-2;|java.lang.Exception: WEB0145: Unable to deploy web module [foo#my-webapp-1.0-SNAPSHOT.war] at root context of virtual server [server], because this virtual server declares a default-web-module
java.lang.Exception: WEB0145: Unable to deploy web module [foo#my-webapp-1.0-SNAPSHOT.war] at root context of virtual server [server], because this virtual server declares a default-web-module
at com.sun.enterprise.web.WebContainer.loadWebModule(
at com.sun.enterprise.web.WebContainer.loadWebModule(
at com.sun.enterprise.web.WebApplication.start(
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(
at com.sun.hk2.component.AbstractCreatorImpl.inject(
at com.sun.hk2.component.ConstructorCreator.initialize(
at com.sun.hk2.component.AbstractCreatorImpl.get(
at com.sun.hk2.component.SingletonInhabitant.get(
at com.sun.hk2.component.EventPublishingInhabitant.get(
at com.sun.hk2.component.AbstractInhabitantImpl.get(
at com.sun.enterprise.v3.server.AppServerStartup.doStart(
at com.sun.enterprise.v3.server.AppServerStartup.start(
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(
at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(

My environment:
GlassFish Server Open Source Edition (build 5)

java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b16, mixed mode)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-09-26
Points: 0

OK, never mind, got it :)

the problem was, that my ear contained application.xml that already had:

that was enough for glassfish to publish it on the root of the virtual server's HTTP url.

So all the confusion came from the:

Based on that I set it explicitly as the default-web-module.

That was not needed a reading sources of the: gave me the hint:

if (wmContextPath.length() == 0 &&
        vs.getDefaultWebModuleID() != null) {
    String msg = rb.getString("webcontainer.defaultWebModuleConflict");
    msg = MessageFormat.format(msg,
            new Object[]{wmName, vs.getID()});
    throw new Exception(msg);

So thanks for letting Glassfish been open source!