Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Problem to connect client and server in junit test

Reply
Thread Tools

Problem to connect client and server in junit test

 
 
mike
Guest
Posts: n/a
 
      10-23-2007
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.getClassLoaderReposit ory()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:
96
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.GenericConnectorSe rver
$ClientCreation.run(GenericConnectorServer.java:45 1)
at com.sun.jmx.remote.opt.util.ThreadService
$ThreadServiceJob.run(ThreadService.java:20
at com.sun.jmx.remote.opt.util.JobExecutor.run(JobExe cutor.java:59)
Oct 23, 2007 6:29:01 PM GenericConenctor RequestHandler-
connectionException

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
connect a database in remote server (can connect to the server via SSH) zhangxiaoyu912@gmail.com Perl Misc 2 07-18-2007 07:20 PM
Problem with Junit test djgavenda2@yahoo.com Java 6 08-03-2006 06:48 PM
Where to put JUnit test cases? Ken Java 2 07-16-2004 04:02 AM
Junit Test From Ant--java.lang.LinkageError Tom Koenning Java 0 07-28-2003 07:11 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57