what do you mean by ejb resides on the NT server means some server is running on that PC which contains the deployed ejb. then connect to that server's JNDI and lookup for you bean by the name you have deployed the bean .
use this program as reference
import java.rmi.RemoteException;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
public class Client
{
private static final
String JNDI_NAME = "LHome";
private static final String url = "t3://localhost:7001";
private LHome home=null;
public Client() throws NamingException
{
home = lookupHome();
}
public static void main(String[] args) throws Exception
{
log("\nBeginning statelessSession.Client...\n");
Client client = null;
try
{
client = new Client();
}
catch (NamingException ne)
{
System.exit(1);
}
try
{
client.example();
}
catch (Exception e)
{
log("There was an exception while creating and using the Trader.");
log("This indicates that there was a problem communicating with the server: "+e);
e.printStackTrace();
}
log("\nEnd statelessSession.Client...\n");
}
public void example() throws CreateException, RemoteException, RemoveException
{
// create a Trader
log("Creating a trader");
LRemote trader = (LRemote) narrow(home.create(), LRemote.class);
trader.printHelloWorld();
trader.remove();
// remove the Trader
log("Removing the trader ");
}
private Object narrow(Object ref, Class c)
{
return PortableRemoteObject.narrow(ref, c);
}
private LHome lookupHome()throws NamingException
{
Context ctx = getInitialContext();
try
{
Object home = ctx.lookup(JNDI_NAME);
return (LHome) narrow(home, LHome.class);
}
catch (NamingException ne)
{
log("The client was unable to lookup the EJBHome. Please make sure ");
log("that you have deployed the ejb with the JNDI name "+JNDI_NAME+" on the WebLogic server at "+url);
throw ne;
}
}
private Context getInitialContext() throws NamingException
{
try
{
// Get an InitialContext
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
h.put(Context.SECURITY_PRINCIPAL, "system");
h.put(Context.SECURITY_CREDENTIALS, "sandeepk");
return new InitialContext(h);
}
catch (NamingException ne)
{
log("We were unable to get a connection to the WebLogic server at "+url);
log("Please make sure that the server is running.");
throw ne;
}
}
private static void log(String s)
{
System.out.println(s);
}
}