Reputation: 352
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?
Upvotes: 3
Views: 2811
Reputation: 648
I don't have answer for you but I can tell you that JBoss Web Server is definitely not pure Apache Tomcat and some of the possibilities that are available in Tomcat does not work in JBoss Web Server. One of those disabled features is also that you can't have specific <Valve>
elements within separate <Service>
element.
But, to your question, think of it from JBoss Web Server's perspective. In war, there is possibility to change root context in jboss-web.xml
. In Tomcat, you can change it in server.xml
. What will be the resulting context, if you change it both in jboss-web.xml
and server.xml
? This is most probably the reason, why configuration in server.xml
is disabled.
Upvotes: 1