I’ve been bashing my head against THIS one for weeks, on and off. Each time I tried to figure out how to map my app to the name of my choice (‘/’) nothing I did seemed to work!
Finally today I learned about yet another XML file you have to edit in Java EE – application.xml. Yep, the Java EE development life is filled with wonderful and magical XML files.
Application.xml is a lot like web.xml, but it applies to the EAR. What isn’t obvious, and which nobody warned me about, is that the context-root for an app is set in application.xml, and it doesn’t matter what you put into sun-web.xml, web.xml, or anything else to try and rename the context-root of your war. application.xml will override all of that.
So, I’m happy to have found it, but sad that it took so long. Hopefully others having the same problem – “context-root in sun-web.xml ignored” or “glassfish ignores my context-root” for those searchers out there – can find this post and be enlightened by it!