Typical scenario:
[1] You are developing a dynamic web application using Eclipse in Java with project name, say "ServletTutorial".
[2] You have configured your web.xml in the WEB-INF folder.
[3] Everything looks fine when you are testing your web application within Eclipse and with the URL localhost:8080/ServletTutorial
You feel happy BUT ... you are not that happy and not completely satisfied and you want to set the root URL of your web application at localhost:8080
Soon after that, you tried to look at the web.xml, context.xml and server.xml and perhaps, not only looking at those files but also editing them hoping to get your web application running at localhost:8080 instead of localhost:8080/ServletTutorial
You feel frustrated and do more online research. Googling, Binging and Yahooing with the keyword string "do not show java project name in localhost:8080" does not yield any relevant results. Even worse, you type in "localhost:8080 does not show java project name" and the search engines thought that you are experiencing some issue with Tomcat or with localhost:8080 and suggest you links about showing the project name. Frustration is mounting and your web application is still running at localhost:8080/ServletTutorial but not at localhost:8080
You then bang at the wall or the table or try to suffocate yourself with the pillow if you are doing programming lying on the bed.
SOLUTION: After spending quite some time tinkering with Tomcat Apache and doing lots of reading by myself, I have finally come out with a simple solution. As simple as it may be, many IT Operations Engineers may have other much better suggestions and probably disagree with this solution.
My solution works anyway, otherwise it is not a solution, isn't it?
This is what I did eventually:
[1] Export your project as ROOT.war
[2] Keep in mind that it is case-sensitive ROOT.war
[3] Copy the ROOT.war file into the webapps folder of your Tomcat directory
[4] Tomcat will unpack the war file by itself
You will now able to run your web application at localhost:8080 and you are smiling again :)
Tuesday, June 9, 2009
localhost:8080 and not localhost:8080/projectname
Email the blog author at: nicholaskeytholeong [at] gmail [dot] com
Subscribe to:
Post Comments (Atom)
I'm smiling again! No need for pillow suffocation, hurray! Thanks, Nicholas, you made my day :)
ReplyDelete