File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes problem in context lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "problem in context lookup" Watch "problem in context lookup" New topic

problem in context lookup

sathiya moorthy

Joined: Nov 27, 2004
Posts: 9
Hi all
I m very new to IBM websphere, I m using ibm websphere application server6 and rational application developer.
Now I have deployed my jar successfully and whenever I call my client code I m getting error. Can any one please help me

//*** this is client program

package ejbs;

import java.util.Properties;

import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;

import ejbs.MyFirst;
import ejbs.MyFirstHome;

public class Client {
public static void main(String str[]) {
try {
Properties props = System.getProperties();
props.put (Context.INITIAL_CONTEXT_FACTORY,"");
Context context = new InitialContext(props);
MyFirstHome myhome =(MyFirstHome)context.lookup("ejb/ejbs/MyFirstHome");
MyFirst myremote=myhome.create();
String s=myremote.getMSG("from client side");
System.out.print("the total string" +s);
} catch (Exception e) {


///**** and error is
123May 27, 2005 2:50:47 PM
WARNING: jndiproviderProperties
May 27, 2005 2:50:48 PM
WARNING: jndiproviderProperties
May 27, 2005 2:50:48 PM
WARNING: noInitCtxFactoryImpl
javax.naming.ConfigurationException: The property is not set. The most likely cause is that the jar which contains the file com/ibm/websphere/naming/ cannot be found by the class loader.
at javax.naming.spi.NamingManager.getInitialContext(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.InitialContext.<init>(
at ejbs.Client.main(
// ***

Thanks and regards
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1082

Websphere and main method of java run in different JVM so you can get the initialContext from you main program

you can refer this post

[ May 27, 2005: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
I agree. Here's the link:
subject: problem in context lookup
It's not a secret anymore!