aspose file tools*
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
Author

problem in context lookup

sathiya moorthy
Greenhorn

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();
System.out.print("1");
props.put (Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
System.out.print("2");
props.put(Context.PROVIDER_URL,"iiop://localhost:2809");
System.out.print("3");
Context context = new InitialContext(props);
System.out.print("4");
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) {
e.printStackTrace();
}

}

}
///**** and error is
123May 27, 2005 2:50:47 PM com.ibm.ws.naming.util.CommonHelpers
WARNING: jndiproviderProperties
May 27, 2005 2:50:48 PM com.ibm.ws.naming.util.CommonHelpers
WARNING: jndiproviderProperties
May 27, 2005 2:50:48 PM com.ibm.websphere.naming.WsnInitialContextFactory
WARNING: noInitCtxFactoryImpl
javax.naming.ConfigurationException: The property com.ibm.ws.naming.wsn.factory.initial is not set. The most likely cause is that the jar which contains the file com/ibm/websphere/naming/jndiprovider.properties cannot be found by the class loader.
at com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(WsnInitialContextFactory.java:194)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:112)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:675)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:257)
at javax.naming.InitialContext.init(InitialContext.java:233)
at javax.naming.InitialContext.<init>(InitialContext.java:209)
at ejbs.Client.main(Client.java:23)
// ***


Thanks and regards
sathiyan
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

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

Shailesh
[ 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: http://aspose.com/file-tools
 
subject: problem in context lookup