aspose file tools
The moose likes JBoss/WildFly and the fly likes A small EJB problem in the NamingContextFactory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "A small EJB problem in the NamingContextFactory" Watch "A small EJB problem in the NamingContextFactory" New topic

A small EJB problem in the NamingContextFactory

Narendran Nair
Ranch Hand

Joined: Sep 25, 2003
Posts: 35
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..


Narendran J S<br />SCJP 1.4<br /><a href="" target="_blank" rel="nofollow"></a><br /><a href="" target="_blank" rel="nofollow"></a><br /><a href="" target="_blank" rel="nofollow"></a>
jQuery in Action, 2nd edition
subject: A small EJB problem in the NamingContextFactory