• 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

Help needed ....NoInitialContextException

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to write my first Stateless session bean...
i have written the approp interfaces and the bean class and deployed the ear successfully
i have written the following code but am getting the same exception that u were getting
"Exception in thread "main" javax.naming.NoInitialContextException"
could uu please suggest me some solution!!!
here's the Client Code
package examples;
import java.util.Properties ;
import javax.naming.Context ;
import javax.naming.InitialContext ;
public class HelloClient {
public static void main( String [] args ) throws Exception {

Properties h = new Properties();

h.put( Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.WsnInitialContextFactory" ) ;
h.put( Context.PROVIDER_URL, "iiop:///" ) ;
Context ctx = new InitialContext(h) ;

Object obj = ctx.lookup( "HelloWorld") ;
HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow( obj, HelloHome.class ) ;
Hello hello = home.create() ;
System.out.println( "Output from EJB: " + hello.hello() ) ;
hello.remove() ;
}
}
Thanx & Regards,
Priyank Patwa.
Cognizant Technology Solutions India Pvt. Ltd.
Infotech Park,
Hinjawadi,
Pune 411027,
India.
Ph. 2931100 extn: 2476
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

h.put( Context.PROVIDER_URL, "iiop:///" ) ;


You have not specified the host name.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic