• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Naming Exception at runtime when running client.

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Naming Exception caught: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
--------Client Code-------------
import javax.ejb.*;
import hello.*;
import java.util.*;
import javax.naming.InitialContext;
class helloClient
{
public static void main(String args[])
{
try
{
InitialContext ctx = new InitialContext();
Object objRef=ctx.lookup("HelloEJB");
HelloHome home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(objRef, HelloHome.class);
HelloSonu bean=home.create();
System.out.println("Monthly net Salary: "+bean.sayHello());
}
catch(javax.naming.NamingException ne)
{
System.out.println("Naming Exception caught: " +ne);
}
catch(javax.ejb.CreateException ce)
{
System.out.println("Create Exception caught: " +ce);
}
catch(java.rmi.RemoteException re)
{
System.out.println("Remote Exception caught: " +re);
}
}
}
-------------Please help--------Using j2ee server---------
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to provide certain configuration properties to the constructor of InitialContext. Search this forum and you'll find plenty of examples.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic