This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in context lookup

 
sathiya moorthy
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1082
Java Oracle Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic