Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

NoInitialContextException

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys
I'm trying to do simple Stateless SessionBean using MyEclipse and jboss.

But while deploying it is giving javax.naming.NoInitialContextException.

Please help me.
Here is the code.

package sample.ejb;
import javax.ejb.*;
import javax.naming.*;

import sample.interfaces.*;

import java.util.*;
public class HelloClient
{
public static void main(String args[])
{
try
{
Hashtable ht=new Hashtable();
//ht.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming");
//ht.put(Context.PROVIDER_URL,"t3://localhost:8080");
ht.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
ht.put(Context.PROVIDER_URL, "localhost:8080");
ht.put("java.naming.factory.url.pkgs", "org.jboss.naming");
Context ctx=new InitialContext(ht);
HelloHome home=(HelloHome)ctx.lookup("roses");
Hello h1=home.create();
String str=h1.sayHello("kishore");
System.out.println(str);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic