M
mike
Hi,
I have the following test ( see below)
Everything is fine until start my AlarmNotificationManager that tries
to connect to the AlarmNotificationServer that runs in a separate
thread. When I call the start() that calls connect()
my code breaks on the following line in the AlarmNotificationServer:
connector = JMXConnectorFactory.connect(url, null);
Any hints?
cheers,
//mikael
Test class
========
public void testSendAlarm()throws Exception{
Runnable runnable = new AlarmNotificationThread();
Thread thread = new Thread(runnable);
thread.start();
AlarmNotificationManager anm =
AlarmNotificationManager.getInstance();
anm.start();
}
public class AlarmNotificationThread implements Runnable {
// This method is called when the thread runs
public void run() {
AlarmNotifcationServer.main(new String []{});
}
}
AlarmNotificationManager
====================
public void start(){
connect();
//Some other code.
}
public void connect() {
try {
// Create JMX Agent URL
JMXServiceURL url = new JMXServiceURL(
"service:jmx:jmxmp://localhost:1099");
// Connect the JMXConnector
connector = JMXConnectorFactory.connect(url, null);
// Get the MBeanServerConnection
mbsc = connector.getMBeanServerConnection();
} catch (MalformedURLException mue) {
LOG.debug("Incorrect URL", mue);
} catch (IOException ioe) {
LOG.debug("could not connect to server!", ioe);
}
This is the error message that I get:
java.lang.NoSuchMethodError:
javax.management.MBeanServer.getClassLoaderRepository()Ljavax/
management/loading/ClassLoaderRepository;
at javax.management.remote.generic.ServerIntermediary
$3.run(ServerIntermediary.java:971)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.management.remote.generic.ServerIntermediary.getClassLoaderRepository(ServerIntermediary.java:
968)
at javax.management.remote.generic.ServerIntermediary.access
$000(ServerIntermediary.java:72)
at javax.management.remote.generic.ServerIntermediary
$1.run(ServerIntermediary.java:120)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.management.remote.generic.ServerIntermediary.<init>(ServerIntermediary.java:
117)
at javax.management.remote.generic.GenericConnectorServer
$ClientCreation.run(GenericConnectorServer.java:451)
at com.sun.jmx.remote.opt.util.ThreadService
$ThreadServiceJob.run(ThreadService.java:208)
at com.sun.jmx.remote.opt.util.JobExecutor.run(JobExecutor.java:59)
Oct 23, 2007 6:29:01 PM GenericConenctor RequestHandler-
connectionException
I have the following test ( see below)
Everything is fine until start my AlarmNotificationManager that tries
to connect to the AlarmNotificationServer that runs in a separate
thread. When I call the start() that calls connect()
my code breaks on the following line in the AlarmNotificationServer:
connector = JMXConnectorFactory.connect(url, null);
Any hints?
cheers,
//mikael
Test class
========
public void testSendAlarm()throws Exception{
Runnable runnable = new AlarmNotificationThread();
Thread thread = new Thread(runnable);
thread.start();
AlarmNotificationManager anm =
AlarmNotificationManager.getInstance();
anm.start();
}
public class AlarmNotificationThread implements Runnable {
// This method is called when the thread runs
public void run() {
AlarmNotifcationServer.main(new String []{});
}
}
AlarmNotificationManager
====================
public void start(){
connect();
//Some other code.
}
public void connect() {
try {
// Create JMX Agent URL
JMXServiceURL url = new JMXServiceURL(
"service:jmx:jmxmp://localhost:1099");
// Connect the JMXConnector
connector = JMXConnectorFactory.connect(url, null);
// Get the MBeanServerConnection
mbsc = connector.getMBeanServerConnection();
} catch (MalformedURLException mue) {
LOG.debug("Incorrect URL", mue);
} catch (IOException ioe) {
LOG.debug("could not connect to server!", ioe);
}
This is the error message that I get:
java.lang.NoSuchMethodError:
javax.management.MBeanServer.getClassLoaderRepository()Ljavax/
management/loading/ClassLoaderRepository;
at javax.management.remote.generic.ServerIntermediary
$3.run(ServerIntermediary.java:971)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.management.remote.generic.ServerIntermediary.getClassLoaderRepository(ServerIntermediary.java:
968)
at javax.management.remote.generic.ServerIntermediary.access
$000(ServerIntermediary.java:72)
at javax.management.remote.generic.ServerIntermediary
$1.run(ServerIntermediary.java:120)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.management.remote.generic.ServerIntermediary.<init>(ServerIntermediary.java:
117)
at javax.management.remote.generic.GenericConnectorServer
$ClientCreation.run(GenericConnectorServer.java:451)
at com.sun.jmx.remote.opt.util.ThreadService
$ThreadServiceJob.run(ThreadService.java:208)
at com.sun.jmx.remote.opt.util.JobExecutor.run(JobExecutor.java:59)
Oct 23, 2007 6:29:01 PM GenericConenctor RequestHandler-
connectionException