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

Initial Context Factory

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai
Can any one tell me what could be the error in the following code
Hashtable ht2=new Hashtable();
ht2.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.Websphere.naming.WsnInitialContextFactory");
ht2.put(Context.PROVIDER_URL,"iiop://localhost");
Context cxt=new InitialContext(ht2);
I am getting the following exception
[01.09.20 15:03:32:090 PDT] 6130ab1c WebGroup X Servlet Error: Cannot instantiate class: com.ibm.Websphere.naming.WsnInitialContextFactory: javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.Websphere.naming.WsnInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.Websphere.naming.WsnInitialContextFactory
Begin backtrace for rootCause
java.lang.ClassNotFoundException: com.ibm.Websphere.naming.WsnInitialContextFactory
Is any thing wrong in Initial Context Factory?
Thank's in advance
Venkat
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
You are using the wrong intial context factory. Pl refer any of samples.
Rgds
Johnson

Originally posted by Venkat Ammisetty:
Hai
Can any one tell me what could be the error in the following code
Hashtable ht2=new Hashtable();
ht2.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.Websphere.naming.WsnInitialContextFactory");
ht2.put(Context.PROVIDER_URL,"iiop://localhost");
Context cxt=new InitialContext(ht2);
I am getting the following exception
[01.09.20 15:03:32:090 PDT] 6130ab1c WebGroup X Servlet Error: Cannot instantiate class: com.ibm.Websphere.naming.WsnInitialContextFactory: javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.Websphere.naming.WsnInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.Websphere.naming.WsnInitialContextFactory
Begin backtrace for rootCause
java.lang.ClassNotFoundException: com.ibm.Websphere.naming.WsnInitialContextFactory
Is any thing wrong in Initial Context Factory?
Thank's in advance
Venkat


 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put com.ibm.Websphere.naming.WsnInitialContextFactory in your classpath. Also, use iiop://localhost:900 is better. You need a port number for iiop.
 
Jun Hong
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used com.ibm.ejs.ns.jndi.CNInitialContextFactory for 3.5 and com.ibm.websphere.naming.WsnInitialContextFactory for 4.0. I think com.ibm.websphere.naming.WsnInitialContextFactory is in ns.jar.
Jun Hong
 
Venkat Ammisetty
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai thank's for user suggestions.
Yes there is a mistake in my Initial Context Factory that is case sensitivity i.e. I used Websphere insted of websphere in the following context and port number for URL is 900.
com.ibm.websphere.naming.WsnInitialContextFactory
iiop://localhost:900
Now I am able to run my application on WebSphere 4.0 Single Server Edition.
The Initail Context Mentioned as
com.ibm.ejs.ns.jndi.CNInitialContextFactory
is also correct but it is deprecated that's why I used earlier one.
Thank's one and all for your help.
Bye
Venkat
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am also facing the same problem in websphere6.1. Please do help us.
We are getting the following error while migrating from websphere6.0 to websphere6.1.
junit] java.lang.ClassNotFoundException:
[junit] com.ibm.websphere.naming.WsnInitialContextFactory
[junit]
[junit] at java.lang.Class.forName(Class.java:160)
[junit] at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:57)
[junit] at com.actiontech.jmetro.server.config.Jndi.getContext(Jndi.java:114)
[junit] at com.actiontech.jmetro.client.Config$ServiceLocator.getContext(Config.java:127)
[junit] at com.actiontech.jmetro.client.Config$ServiceLocator.(Config.java:118)
[junit] at com.actiontech.jmetro.client.Config$ServiceLocator.(Config.java:106)
[junit] at java.lang.J9VMInternals.initializeImpl(Native Method)
[junit] at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)

The code which we are running is
java.util.Hashtable appContext = new java.util.Hashtable();
appContext.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
appContext.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:2809");
Context context = new InitialContext(appContext);
Object objref = context.lookup("AdminSessionBean");
Object obj = PortableRemoteObject.narrow(objref, com.actiontech.jmetro.server.ejb.AdminSessionHome.class);
EJBHome home = (EJBHome) obj;

we have added the plugins\com.ibm.ws.runtime_6.1.0.jar which contains com.ibm.websphere.naming.WsnInitialContextFactory in the websphere6.1 cclasspath but still we get the same error.
Can somebody help us in fixing the above error.
Thanks in advance,
Vinod
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try with naming.jar
 
No holds barred. And no bars holed. Except this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic