This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Problem with contextPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Problem with contextPath" Watch "Problem with contextPath" New topic
Author

Problem with contextPath

Martin Reuter
Greenhorn

Joined: Sep 11, 2008
Posts: 3
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

Joined: Jul 20, 2005
Posts: 9956
    
163

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 ]

[My Blog] [JavaRanch Journal]
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

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.


Regards, Rene Larsen
Dropbox Invite
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

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

Joined: Sep 11, 2008
Posts: 3
I don't have a ear-file. I only have a war-file.
Sanjay Madhu
Greenhorn

Joined: Sep 11, 2008
Posts: 3
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

Joined: Oct 12, 2001
Posts: 1179

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...
 
wood burning stoves
 
subject: Problem with contextPath
 
Similar Threads
Context Path Problem
how can change wsdl contextPath in weblogic 10.3
site transfer context path problem
contextpath in javscript
Context Path Issue in Struts