• 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

Problem on INITIAL_CONTEXT_FACTORY

 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I am using snippet :
public static Context getInitialContext() throws javax.naming.NamingException
{
Hashtable p = new Hashtable(5);
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7001");
return new javax.naming.InitialContext(p);
}
This code compiles but gives an error on runtime saying:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory. Root exception is java.lang.ClassNotFoundException: we
blogic.jndi.WLInitialContextFactory
Why it is not finding the class ?. Do I am writing something wrong ?. Please write me ?.
thank you,
 
Author
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you running this from a server-side component or from a client application? If a client app, do you have the weblogic.jar from the server on your CLASSPATH?
 
Gurpreet Saini
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aaron,
I am writing this from Client side application. No, Aaron I had not set the classpath of weblogic.jar with my application. I am using Win 2000 professional. And I am new to it could you please tell me how to set the classpath ?.
thank you, waiting for your reply.
 
Aaron Mulder
Author
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if you're that new to this, you should probably be hanging out in some starter Java forums...
But to answer your question, either set your CLASSPATH environment variable before you kick off the client application:
Windows:
set CLASSPATH=c:\somewhere\weblogic.jar
Linux:
export CLASSPATH=/somewhere/weblogic.jar
Or pass in the -classpath argument when you run your client application (the following should be all on one line):
java -classpath c:\somewhere\weblogic.jar some.package.MyApp
 
Gurpreet Saini
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Mr Author,
There is third way also you can write the following command on your path :
D:\jar xf weblogic.jar
I bet if you engrave the above command in your book I am sure the cost of your book will increase by 100 and thousand dollars.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic