My Program is package client;
import homeif.HelloWorldHome;
import remoteif.HelloWorld;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.awt.image.LookupOp;
import java.util.Properties;
public class HelloClient {
public static void main(String args[]) {
try {
Context initialContext = new InitialContext();
Object object = initialContext.lookup("myHelloWorld");
HelloWorldHome home =
(HelloWorldHome) PortableRemoteObject.narrow(object,
HelloWorldHome.class);
HelloWorld myHelloWorld = home.create();
String message = myHelloWorld.sayHello();
System.out.println(message);
} catch (Exception e) {
System.err.println(" Error : " + e);
System.exit(2);
}
}
}
I am getting a javax.naming.NameNotFoundException: myHelloWorld not bound.I have tried to bind it using initialContext.bind("myHelloWorld",null); But getting a NullPointerException. My jndi.properties includes
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=jnp://localhost:1099I have specified lookup-name myHelloWorld in ejb-jar.xml. what should I have to do to bind the lookup
In jonas-ejb-jar.xml
ejb-name->HelloWorld
jndi-name->myHelloWorld