Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

naming.InvalidNameException

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello GUys,

I am trying to run a message bean client, I get the following exception.

http://127.0.0.1:4848/
Could not create JNDI context: javax.naming.InvalidNameException: unknown protocol: http

Here is the code

--------------------------------------------------------------------------------------
final String contextRoot = "http://127.0.0.1:4848/";
Hashtable env = new Hashtable(5);
try {
//env.put(Context.INITIAL_CONTEXT_FACTORY,
// "com.sun.jndi.fscontext.RefFSContextFactory");
// env.put(Context.PROVIDER_URL, contextRoot);

env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
System.out.println(contextRoot);
env.put(Context.PROVIDER_URL,contextRoot);
// DirContext ctx = new InitialDirContext(env);

jndiContext = new InitialContext(env);
} catch (NamingException e) {
System.out.println("Could not create JNDI " + "context: "
+ e.toString());
System.exit(1);
}
-------------------------------------------------------------------------------
I am using Sun App server installed on my machine.
What might be the cause of this exception.
ANy help would be appreciated.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if we use,
.fscontext.RefFSContextFactory
don't we have to use file://<<path to location>> protocol instead http?
Thanks
Maulin
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try using t3 instead of http. The protocol that is generally used is t3
 
I was born with webbed fish toes. This tiny ad is my only friend:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic