DISQUS

Dobesland: Glassfish: Setting the context-root of a WAR inside an EAR | Dobesland

  • Alexis MP · 1 year ago
    Thanks for sharing this.
  • cw · 1 year ago
    Thanks for sharing this information. Like you, I also spent quite some time trying to achieve this supposedly easy task.
  • Dj Rabbit JAvA · 1 year ago
    Dobes,

    This was just what I needed. I also did not quite figure out what happend.

    Thank your for sharing this!
  • Stephan · 1 year ago
    Thanks, had are hard time looking into this.
  • xlinuks · 1 year ago
    The GlassFish server has a server GUI manager available at localhost port 4848 through the browser.
    One can log in (default username/password are "admin" and "adminadmin" respectively), go to Applications->WebApplications, click on the name of your one and you'll see to the right the Context Root option which you can change and click "Save" and you're done.
  • dobes · 1 year ago
    Thanks xlinuks - that'll help for a a WAR file (a Web Application), but this tip is for people who've created an EAR file (an Enterprise Application). In the version of glassfish I have, I can't change the context root of a WAR file that's bundled inside an EAR file using the admin interface, although I can, as you've shown, change the context root of a WAR file.

    FWIW, anyone who didn't know already, you CAN change the context root of a WAR file by editing it's web.xml or sun-web.xml, as long as it's not being deployed as part of an EAR file.
  • Guille · 8 months ago
    I've already known than the file is applicattion.xml, but my problem is that I want to set me root context to "/", but when I deploy it, and enter the URL like http:localhost:82/ (thats de URL), then, it don't load the applicattion, so I don't know how to set the root context into "/" and make it work.

    Ane help?
  • dobes_vandermeer · 8 months ago
    Did you try using an empty string? I'm not sure what else might work.
    Another option is to set the war as the "default web application" in the
    glassfish admin panel, I believe it's the virtual server configuration that
    lets you do that.
  • spangen · 3 months ago
    I had this issue with eclipse - Galileo and Glassfish 2.1
    Initially there was no application.xml listed in my deployment descriptors for my EAR, and my context root _still_ wasn't being set to "/"

    I generated the Application.xml by right clicking the EAR in eclipse, and selecting "Generate Deployment Descriptor Stub". This created an application.xml that I could edit in eclipse before deploying to Glassfish