Hi
I am upgrading from jboss 4 to jboss 7.
In jboss 4 we had a piece of code that fetched all the context roots of the deployed applications:
private static MBeanServer getServer() {
MBeanServer lServer = null;
List servers = MBeanServerFactory.findMBeanServer(null);
if (servers != null && !servers.isEmpty()) {
lServer = (MBeanServer) servers.get(0);
}
return lServer;
}
MBeanServer mBeanServer = getServer();
List <String>contexts = new ArrayList<String>();
try {
ObjectName queryHosts = new ObjectName("*:j2eeType=WebModule,*");
Set hostsON = mBeanServer.queryNames(queryHosts, null);
ObjectName contextON; String webModuleName;
for (Object aHostsON : hostsON) {
contextON = (ObjectName) aHostsON;
webModuleName = contextON.getKeyProperty("name");
if (webModuleName.startsWith("//")) {
webModuleName = webModuleName.substring(webModuleName.indexOf("/", 2));
}
int slash = webModuleName.indexOf("/");
if (slash == -1) {
continue;
}
if(webModuleName.length()>1){
//if its longer than single char '/' contexts.add(webModuleName);
}
}
}
The ObjectName doesn't contain the name property any more which use to represent the war context root.
Is there a way to get this information?
Thanks in advance
Shai