• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

naming.InvalidNameException

 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • 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.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • 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
 
Sany Bel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using t3 instead of http. The protocol that is generally used is t3
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic