users@glassfish.java.net

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

From: <Jan.Luehe_at_Sun.COM>
Date: Wed, 09 Jul 2008 12:36:11 -0700

Markus KARG wrote:

> Thank you very much for that link! :-)
>
> Just to correctly understand it: So inside the application.xml I can
> set the ContextRoot for the .war, right?


Yes, that should work.

Jan


>
> Thanks
> Markus
>
> Jan.Luehe_at_Sun.COM schrieb:
>
>> Hi Markus,
>>
>> Markus Karg wrote:
>>
>>> I am running GFv2ur2.
>>>
>>> The virtual server and listener is correctly installed (otherwise it
>>> would not work on Port 80 but on Port 8080) -- so I am sure both,
>>> virtual server and listener is correct.
>>>
>>> I deployed using this command line:
>>>
>>> asadmin deploy --virtualservers QUIPSY --contextroot / "C:\myear.ear"
>>>
>>> There are no error messages in the server.log.
>>>
>>> http://localhost:80/mywar/x.txt is working, but
>>> http://localhost:80/x.txt is NOT working.
>>>
>>> When deploying a .war file, --contextroot / is working well (tried out
>>> yesterday), but inside of the EAR it seems --contextroot / is ignored!
>>>
>>> So for me it looks like a bug in GlassFish. :-(
>>>
>>>
>>
>> Actually, I think this is the expected behaviour.
>>
>> Please see Hong's explanation under
>>
>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=3876
>>
>> and let us know if you still have any questions.
>>
>> Thanks,
>>
>>
>> Jan
>>
>>
>>> Regards
>>> Markus
>>>
>>> -----Original Message-----
>>> From: Daniel.Adelhardt_at_Sun.COM [mailto:Daniel.Adelhardt_at_Sun.COM]
>>> Sent: Mittwoch, 9. Juli 2008 12:54
>>> To: users_at_glassfish.dev.java.net
>>> Subject: Re: How to bind a .war INSIDE OF EAR file to
>>> http://localhost:80/ ?
>>>
>>> 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
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
>