• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing Context Root Headache

 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends, I have a little problem to my Enterprise Project. I use NetBeans 6.5.


Can we change the web application context root after we created the project ? Currently the context root is named "/converter-war" and I want to change it to "/converter". How can I do that ? I already tried many ways but it didn't work. Please help me.

As an information, there is 4 projects :
converter
converter-app-client
converter-ejb
converter-war

This is the sample project in the Java EE tutorial, but I create the project and typing the source file instead of just opening the sample project.


Thanks


Jeffry Kristianto Yanuar (Java Instructor) SCJP 5.0 SCJA SCJD
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There shouldn't be any headaches. As long as you haven't hard-coded the context path within your application you should be able to deploy it to any path.

What specific problems are you having?
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying, I already found the solution. By changing the name of the web module project, the context root is changed too.

If the web module name is converter-war, then the context root is "/converter-war". I changed the web module name to converter, then the context root is "/converter"

Before changing web module, the entire projects are :
converter
converter-app-client
converter-ejb
converter-war
I accessed the web application by typing "www.localhost:8080/converter-war"

Now I changed the web module into :
converter
converter-app-client
converter-ejb
converter
Now I can access the web application by typing "www.localhost:8080/converter" which is what I want(I wanted to change the way I access the web application)


I can't believe it that the name of the web module in enterprise project in Netbeans determines the context root. Or maybe there is something I miss. Any idea ?


Jeffry Kristianto Yanuar (Java Instructor) SCJP 5.0 SCJA SCJD
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this is a Netbeans issue, rather than a general servlet question, I've moved it to the IDEs forum.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What application server are you using? Most of the ones I have worked with use the WAR file name as the default context name. Many application servers provide some mechanism to assign a different context name to the application. This is really is not a NetBeans issue.
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use GlassFish V2 Application server. Any idea ? Maybe when I was changing the web application module name, the JAR was changed too.


Jeffry Kristianto Yanuar (Java Instructor) SCJP 5.0 SCJA SCJD
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The IDEs tend to name the WAR file using the project's name, so I can see how changing the project name could change the context.
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was the Netbeans developes did that on purpose ?

Jeffry Kristianto Yanuar (Java Instructor) SCJP 5.0 SCJA SCJD
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic