File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Naming Exception at runtime when running client. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Naming Exception at runtime when running client." Watch "Naming Exception at runtime when running client." New topic
Author

Naming Exception at runtime when running client.

dimpsonu arora
Ranch Hand

Joined: Aug 13, 2003
Posts: 51
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---------
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You need to provide certain configuration properties to the constructor of InitialContext. Search this forum and you'll find plenty of examples.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Naming Exception at runtime when running client.
 
Similar Threads
NameNotFoundException
Running EJB Client
NoInitialContextException: Prob
ejb hanging
Fetch Exception In Entity Bean