Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Running Client Application from Windows98

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Win NT machine which EJB resides.I have got Windows 98 nd windows 95 m/c's connected to that NT m/c.
I made a login screen (using JFrame) in one of the client machines (Windows platform), from which one can login to my EJB application in the NT Server.
I am not able to connect ..
Please provide me the steps for doing that..and also the requiremnts..
Thx.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
}
}
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic