Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help needed ....NoInitialContextException  RSS feed

 
Priyank Patwa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
h.put( Context.PROVIDER_URL, "iiop:///" ) ;

You have not specified the host name.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!