users@glassfish.java.net

Re: How to bind a .war INSIDE OF EAR file to http://localhost:80/ ?

From: Daniel Adelhardt <Daniel.Adelhardt_at_Sun.COM>
Date: Wed, 09 Jul 2008 12:53:33 +0200

Which version are you using? I just gave it a try on V2 ur2, created a
new virtual server + new listener and deployed the clusterjsp.ear sample
with asadmin deploy --virtualservers test --contextroot / clusterjsp.ear
and I see the app on localhost:4711/

Forgot to mention: You can also use deploydir on a .ear file but the
.war inside your ear has also to be extracted and to be postfixed _war.

So if you have something like
clusterjsp.ear
  META-INF/application.xml
  clusterjsp.war

then the exploded version should look like this:

clusterjsp
  META-INF/application.xml
  clusterjsp_war
      WEB-INF/....
      ...

That way you can also do asadmin deploydir --virtualservers --contextroot.


Daniel


Markus Karg schrieb:
> Daniel,
>
> we already tried that. The result is that the deployment works fine, it
> seems to ignore the "--contextroot /": If we try
> "http://localhost:80/x.txt" we do not get a result, while
> "http://localhost:80/mywar.war/x.txt" returns a result. So maybe there
> is a bug?
>
> Thanks
> Markus
>
> -----Original Message-----
> From: Daniel.Adelhardt_at_Sun.COM [mailto:Daniel.Adelhardt_at_Sun.COM]
> Sent: Mittwoch, 9. Juli 2008 12:06
> To: users_at_glassfish.dev.java.net
> Subject: Re: How to bind a .war INSIDE OF EAR file to
> http://localhost:80/ ?
>
> Markus,
>
> "asadmin deploy" has almost the same subparameters like "asadmin
> deploydir". So you can also use "asadmin deploy --virtualservers
> <yourvs> --contextroot / <yourapp.ear>" for deployment. Let us know if
> that works for you.
>
> Daniel
>
>
> Markus Karg schrieb:
>
>> Wolfram,
>>
>> thank you so much for your kind help.
>>
>> Unfortunately now we are stuck with the next issue, which is very
>> closely related. Would be great if you could give us the essential
>>
> tip.
>
>> :-)
>>
>> The .war now is packaged inside of a .ear file, so the deploydir is
>>
> not
>
>> working (I tried to just use the .ear instead of .war using the same
>> asadmin deploydir command), but it does not work (error message in log
>> "Application NOT loaded"). If I just do "asadmin deploy MyApp.ear"
>>
> that
>
>> deploys well (but then the .war is not bound to the virtual server at
>> port 80).
>>
>> What is our fault, and how to fix it?
>>
>> Thanks!
>> Markus
>>
>> -----Original Message-----
>> From: Markus Karg
>> Sent: Dienstag, 8. Juli 2008 17:20
>> To: users_at_glassfish.dev.java.net
>> Subject: RE: Re: How to bind a .war file to http://localhost:80/ ?
>>
>> Wolfram,
>>
>> thank you very much for your kind help. I did exactly what you said
>>
> and
>
>> it works very well! :-)
>>
>> But I am using "asadmin deploydir" instead of "asadmin deployd",
>>
> because
>
>> GlassFish told me that "deployd" is an unknown command.
>>
>> Thanks! :-)
>> Markus
>>
>> -----Original Message-----
>> From: Wolfram Rittmeyer [mailto:w.rittmeyer_at_jsptutorial.org]
>> Sent: Sonntag, 6. Juli 2008 22:49
>> To: users_at_glassfish.dev.java.net
>> Subject: Re: How to bind a .war file to http://localhost:80/ ?
>>
>> Markus KARG wrote:
>>
>>
>>> I need to bind a .war file to http://localhost:80/ (Port 80, Root
>>> Context) !
>>>
>>> It seems all .war's by default are bound to
>>> http://localhost:8080/mywarfile/ (Port 8080, Sub Context mywarfile)
>>>
>>> So my question is:
>>>
>>> How to bind this specific .war file to port 80 instead of 8080 and
>>>
> how
>
>>>
>>>
>>
>>
>>> to bind to the root / instead to subcontext /mywarfile? The default
>>> Context in the admin GUI is shown as "mywarfile", so I wanted to just
>>>
>
>
>>> empty it, but the admin GUI doesn't allow empty field.
>>>
>>>
>> First you have to create a virtual server for the domain to use. E.g.:
>> asadmin create-virtual-server --hosts www.whatever.org,whatever.org
>> someMeaningfulName
>>
>> Then you have to define a specific listener that listens to port 80:
>> asadmin create-http-listener --listeneraddress 0.0.0.0 --listenerport
>>
> 80
>
>> --defaultvs someMeaningfulName listenername
>>
>> You have to use the name of the virtual server created in the first
>>
> step
>
>> here.
>>
>> Of course this wont work on any Unix-based system if GlassFish is not
>> run as root (which is IMHO *no* good idea). You might choose to
>>
> redirect
>
>> any traffic to port 80 to port 8080 using the firewall of the system
>> (e.g. for Linux this is possible using iptables).
>>
>> Now whenever you deploy a app you have to link this app with the
>>
> virtual
>
>> server created in the first step:
>> asadmin deployd --virtualservers someMeaningfulName --contextroot "/"
>> --name someNameForYourApp whatever.war
>>
>> Of course you could also use the GlassFish-sepcific deployment
>> descriptor sun-web.xml to set the context-root to "/".
>>
>> --
>> Wolfram Rittmeyer
>> http://weblogs.java.net/blog/writtmeyer
>> http://www.nosilverbullet.de/blog/category/GlassFish (German only)
>>
>>
>>
>>> Thanks a lot!
>>> Markus
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>
>
>


-- 
========================================================================
Daniel Adelhardt                        Tel:           +49 89 460082443
Software Architect                      Mobile:        +49 172 8417283               
Sun Microsystems GmbH                   Email:  daniel.adelhardt_at_sun.com
Sonnenallee 1
D-85551 Kirchheim-Heimstetten
Sitz der Gesellschaft: Sun Microsystems GmbH, Sonnenallee 1, D-85551
Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer