Hi
Since you are accessing the EJB deployed in another J2EE machine ( not the same machine as your client), you will have to specify this information when looking you the initial context.
To do that you have 2 choices
-----------------------------
1) Use java.util.Properties object to set the properties of the initial Host for the JNDI ( the machine which has the EJB)
Dorg.omg.CORBA.ORBInitialHost=buzz
here 'buzz' is the name of the machine that has the EJB.
So your code will be something like this
Properties prop = new Properties();
// u will set the properties over here
Context initial = new InitialContext(prop);
2) Specify this property as a system property when you start your client application
you will do it something like this
java -Dorg.omg.CORBA.ORBInitialHost=buzz ClientApplicaton
Here again 'buzz' is the name of the machine that contains the EJB Object that your client is trying to access.
When you are using this method make sure that you use the default InitialContext constructor in your source code i.e Context initial = new InitialContext();
---------------------------------
I have tried the 2nd method on a J2EE server and it work perfectly fine, and I have tried both the methods on a Weblogic5.1 Server and it works fine.
Assumptions made for the above 2 choices
----------------------------------------
1) The JNDI naming service is running on the same machine as the Machine that contains the
deployed EJB ( i.e buzz ) : In a real world you may have JNDI running on Machine A , EJB
deployed in Machine B , and Client in Machine C.In this case you will look up the initial
context on Machine A , which contains the information about where the EJB are deplyed, in
effect you as the client do not need to know on which machine the EJB is deployed -- this is
on the same lines as location Transperency in distributed applications.
2) The J2EE server uses the default port no: The J2EE server that contains your deplyed EJB
uses the default port number, if it were listening on a different port number then you can
sepciffy that in the Properties, in either of the above mentioned methods.
You can more information about this stuff in the J2EE docs
'Developer's Guide' Chapter 8 - Clients
Vivek Viswanathan
P.S I still have to learn to spell.