users@glassfish.java.net

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

From: Markus Karg <karg_at_quipsy.de>
Date: Wed, 9 Jul 2008 10:56:41 +0200

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