Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A small EJB problem in the NamingContextFactory  RSS feed

Narendran Nair
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Every one

I started to use JBoss from last week onwards and i was successful enough to deploy my first Session Bean in the JBoss4 Server with out any errors. But when i tried to write the client application, i was not successful as the deployment. the file compiles correctly withone any warnings and errors but when i try to run the application it gives a small error.

First let me tell abt the bean i wrote . it is a small bean that returns a string value and it is similar to the normal HelloWorld applications. The deployed jar has got the 3 needed class files and the ejb-jar.xml file.

The client program compiles fine and here it is ....

import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Hashtable;

public class HelloWorldClient {
public static void main(String args[]){
Hashtable env = new Hashtable();
//env.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("HelloWorld");
HelloWorldHome home = (HelloWorldHome) javax.rmi.PortableRemoteObject.narrow(obj,HelloWorldHome.class);
HelloWorld helloWorld = home.create();
}catch(Exception ex){

when i tried to run the above program it gives this message and exits

Cannot instantiate class: org.jnp.interfaces.NamingContextFactory

Can any one help me in this ...
i am using Jboss4 and J2SE1.4

thanking you in advance..

Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!