Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » NoClassDef: javax/management/ObjectName from Web Bundle(NoClassDef: javax/management/ObjectName from Web Bundle)
NoClassDef: javax/management/ObjectName from Web Bundle [message #925448] Thu, 27 September 2012 18:25 Go to next message
Tom Missing name is currently offline Tom Missing nameFriend
Messages: 16
Registered: February 2010
Junior Member
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
Re: NoClassDef: javax/management/ObjectName from Web Bundle [message #925462 is a reply to message #925448] Thu, 27 September 2012 18:46 Go to previous message
Tom Missing name is currently offline Tom Missing nameFriend
Messages: 16
Registered: February 2010
Junior Member
Ah, I figured this out.
I simply needed to add the package as an import on the bundle.
I didn't have to do this with the console bundle for some reason.

Thanks,
T
Previous Topic:How to use JNDI to lookup services
Next Topic:Virgo Tools 3.5.0 Released
Goto Forum:
  


Current Time: Mon Dec 22 20:53:00 GMT 2014

Powered by FUDForum. Page generated in 0.01816 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software