Help me in resoving JNDI error
Hi All,
I am a proficient J2SE & JSP coder... but I am writing my first EJB. So I am a fresher in this case.
I am starting with a simple EJB with Sun application server. I have coded the programs as follows
Home interface:->
public interface SimpleSessionHome extends EJBHome
{
public SimpleSession create() throws CreateException,RemoteException;
}
Remote interface:
public interface SimpleSession extends EJBObject
{
public void printString(String str) throws RemoteException;
}
EJB class
public class SimpleSessionBean implements SessionBean
{
public SimpleSessionBean()
{}
public void printString(String str)
{
System.out.println(str);
}
- //standard ejb methods...
--
My client code is like this:
public class SimpleSessionClient
{
public static void main(String args[]) throws Exception
{
InitialContext jndi=new InitialContext();
Object ref=jndi.lookup("SimpleSessionBean");
SimpleSessionHome home=(ejb/SimpleSessionHome)PortableRemoteObject.narrow(ref,SimpleSessionHome.class);
SimpleSession ss=home.create();
ss.printString("Hello World");
}
}
while executing the program I am getting the NoInitialContextException
I am executing it with the command
java -Dorg.omg.CORBA.InitialHost=localhost
-Dorg.omg.CORBA.InitialPort=3700 firstEjbclient.SimpleSessionClient
I have put the files in firstEjb(for Home,remote & bean files) & firstEjbclient(for client prog) packages resp.
I think this may be a deployment error... as the program is not so huge..
Can somebody answer me?
Sorry for writing such a long entry....

