HCRockWorks HCRockWorks - 5 months ago 52x
Java Question

How to remove Java Project Name in URL

I have this project name in my eclipse 'abc-work' and when I run it on localhost the url is


The default file or page that opens is (as per web.xml below)


I successfully deployed this application on a cloud and linked it to my domain.

The URL now is:


Now, the problem is - I need to remove the last
from this link, login page should directly open with the link

My project is in Glassfish 3.1.2

I need to make this change, maybe by URL rewriting in web.xml, but I have no clue how to achieve it.

I have tried changing context root from Eclipse project properties, tried changing glassfish-web.xml's context root too - did not work for me.

Any help shall be highly appreciated. Thanks.


Option 1: You can set one of your webapps as default. This can be done with the admin console:

Configuration --> Virtual Servers --> server

Then select your default web application from the drop-down menu. If your webserver port is 8080, you can start your application now by:


instead of http://hostname:8080/webapp

Notice that "server" is the name of Glassfish's default virtual server. If you configured a different virtual server for your webapp you need to change it accordingly.

Furthermore regarding this source, there might be some problems with JDBCRealms.

Option 2: You could also deploy your default webapp to "/" instead of "/webapp" but I think the first option is more flexible.