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

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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic