To customise the root context of a web app in jboss 5.1 there is a documented way that describe how to add a jboss-web.xml file under the WEB-INF directory of the web application
<jboss-web>
<context-root>/my/custom/context/root</context-root>
</jboss-web>
and this works great but requires one to modify the war file.
Another option would be to rename my war file, but I'd rather keep the original name which include the version number and this wouldn't cater for the need to have a folder hierarchy in the context root (as the # notation is not supported in the deploy
folder).
I want to achieve the same but without modifying the war file. I know tomcat can do that through the use of a context configuration and from what I understand jboss 5.1 does include a flavour of tomcat, so I am wondering if we can achieve the same effect.
I have found this page on the jboss.org wiki which describe context configuration for various versions of jboss and tomcat, but this doesn't work for me: trying to add
<Context docBase="/path/to/my.war" path="/my/custom/context/root"/>
to deploy/jboss.sar/server.xml
generate an error on startup:
org.jboss.xb.binding.JBossXBException: Failed to parse source: Context not found as a child of Host in unordered_sequence: Listener* Valve* Alias* Realm? attributes?
Which tells me that a Context
tag is not supported under Host
.
Adding the Context
element to a file named deploy/jboss.sar/jboss.web/localhost/my#custom#context#root.xml
doesn't do anything and is blissfully ignored by jboss (though I can see that the file is being open by the java process).
Maybe this is just not possible with jboss 5.1? Any ideas welcome.
Note: It looks like this has been commented out of the source code. That would explain why this is not supported, yet is there any other alternatives?