ObjectName objectName = new ObjectName("jboss:name=test,type=ds");
MBeanServerConnection mbeanServer = utils.getConnection();
System.out.println("Calling TestMBean.test() on server");
String s = (String) mbeanServer.invoke(objectName, "test", new Object[0], new String[0]);
System.out.println("Received reply: " + s);
<BUG>} catch (Exception e) {
e.printStackTrace();
} finally {
utils.undeploy();
safeClose(utils);</BUG>
}

ObjectName objectName = new ObjectName("jboss:name=test,type=ds");
MBeanServerConnection mbeanServer = utils.getConnection();
System.out.println("Calling TestMBean.test() on server");
String s = (String) mbeanServer.invoke(objectName, "test", new Object[0], new String[0]);
System.out.println("Received reply: " + s);
} catch (Exception e) {
Throwable parent = e;
while (parent != null) {
if (parent instanceof NameNotFoundException && e.getMessage().indexOf("H2DS") > -1) {
usage(parent);
return;
