users@glassfish.java.net

Re: How to deploy a war file inside a ear file as a root project of glassfish?

From: Hong Zhang <Hong.Zhang_at_Sun.COM>
Date: Fri, 28 Sep 2007 13:10:30 -0400

2) is expected behavior. We don't have a way to pass in the context root
for ear (containing web modules) using admin cli today. One reason is an
ear could contain multiple web modules, and it would make the command
line syntax quite complicated to do that.

Antonio Goncalves wrote:
> Hi,
>
> I have a /project.ear/ file which contains a /mywebapp.war/ file and I
> would like to set it up as a root project. I've read the How to deploy
> a war file as a root project of glassfish?
> <http://forums.java.net/jive/thread.jspa?messageID=233259> thread
> which explains two ways of doing it :
>
> 1) Through the Admin console => *works fine* when I select
> project#mywebapp.war
>
> - go to Configuration -> HTTP Listeners -> http-listener-1
> look at the Default Virtual Server, by default it is set to 'server'.
> - go to Configuration -> Virtual Servers -> <server>
> There is a dropdown box with the label :Default Web Module. Select
> *project#mywebapp.war* as the default one.
>
> 2) Through the asadmin deploy command => *doesn't work*
>
> I've used asadmin deploy --contextroot "/" <your-webapp> (with
> project.ear, project#mywebapp.war, mywebapp.war) but it doesn't work.
> In the deploy command help it says "--contextroot Valid only if
> the archive is a web module. It is ignored for other archive types;
> defaults to filename without". So it looks like it doesn't work for
> .ear file.
>
> Is there a way to do it with a asadmin command ?
>
> Thanks,
> Antonio
>
>