Hi, I want to know how make a client to access a certain method of a certain MBean. IE.: I have the EquipmentQuerie class, that implements the EquipmentMBean interface ( this interface have two public methods hiGreeting() and byeGreeting() ). The service's name is Greeting.
I've been searching on the web and I found this:
public class TestClient{
public static void main (String a[]){
InitialContext ctx;
try {
ctx = new InitialContext();
ctx.lookup("Greeting/hiGreeting");
} catch (NamingException e) {
e.printStackTrace();
}
}
}
But I get the following exception:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.Test.main(Test.java:23) Thanks in advance
JP