• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with contextPath

 
Martin Reuter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody. I have a problem with my Java-Application. I've created a war-file of my application and deployed it with JBoss. The application works fine but I can only call the applicication with the contextPath "/bank" which is automatically set by JBoss. How can I change the contextPath? Thank you.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your war file create a jboss-web.xml under the WEB-INF folder with the following contents:



You can then access your application at http://server:port/NameOfYourChoice
[ September 11, 2008: Message edited by: Jaikiran Pai ]
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have your application package in an EAR file??

If this is the case then you should have a META-INF/application.xml in the root of that EAR. In this application.xml there should be a and here you need to change the "context-root" name.

If you only have a WAR file then the name of this file will be the name of your context.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yes, i forgot about the EAR files. Rene, is right - For EARs the application.xml is the right place to set this. For WAR files, see my earlier reply.
 
Martin Reuter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have a ear-file. I only have a war-file.
 
Sanjay Madhu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm...
You can create jboss-web.xml under WEB-INF folder of WAR file.
Specify context-root in jboss-wex.xml.
<jboss-web>
<context-root>sanjay</context-root>
</jboss-web>


Sanjay.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sanjay Madhu:
Hmm...
You can create jboss-web.xml under WEB-INF folder of WAR file.
Specify context-root in jboss-wex.xml.
<jboss-web>
<context-root>sanjay</context-root>
</jboss-web>


Sanjay.


Exactly the same as Jaikiran wrote earlier...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic