Hello,
I've run into an issue that I don't understand. I'm using JMX to set logging levels. I do this in two places: 1) in a console command. 2) in a web bundle.
The code works fine in the console but fails in the web bundle with a java.lang.NoClassDefFoundError: javax/management/ObjectName
What am I missing?
Why would this fail in the web bundle?
I'm running Virgo Jetty 3.5
Thanks for any help
Here is the code used in both scenarios:
private final static String logMBeanObjectName = "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator";
private void setLogger(String logger, String level)
throws MalformedObjectNameException, NullPointerException, InstanceNotFoundException, ReflectionException, MBeanException {
try {
log.trace("==> Entry");
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName objectName = new ObjectName(logMBeanObjectName);
Object[] params = new Object[]{logger, level};
String[] signature = new String[]{"java.lang.String", "java.lang.String"};
server.invoke(objectName, "setLoggerLevel", params, signature);
} finally {
log.trace("<== Exit");
}
}
Thanks,
T