I've got several applications running within a JBoss 4 Application Server. Two of the applications are actually the same (with slightly difference configurations) so the urls' are of the form:
I'm using JMX and MBean management to control and monitor the applications however as both applications are based on the same source code they try to overwrite eachothers mbeans on the mbean server.
What I'd like to do is for the application to determine the name of the servlet context it is running under and name the appropriate MBeans accordingly.
However, I need to be able to obtain a reference to the servlet context outside of a JSP tag and Servlet.
Is there any way of getting a reference to the context the application is running in from within a normal Java class?
Thanks in advance