This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes NoInitialContextException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "NoInitialContextException " Watch "NoInitialContextException " New topic
Author

NoInitialContextException

Benjamin Ho
Greenhorn

Joined: Nov 19, 2003
Posts: 16
hi everybody,
i dont know why NoInitialContextException is occured when a client call a session bean.
The error shown in the following:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

The following is the source of client:
import javax.naming.Context;
import javax.naming.InitialContext;
import com.oneToMany.person.PersonRemote;
import com.oneToMany.person.PersonRemoteHome;
public class ClientTestPerson {
public static void main(String[] args) {
try{
Context ctx = new InitialContext();
Object ref = ctx.lookup("PersonRemoteHome");
PersonRemoteHome home = (PersonRemoteHome)javax.rmi.PortableRemoteObject.narrow(ref, PersonRemoteHome.class);
PersonRemote person = home.create();
person.setPersonInfo(1, "Yuk", "Lee", "Tom");
System.out.println("Already run client program");
}catch(Exception e){
System.out.println(e);
System.out.println("end of running exception");
}
}
}

Best regards,
Benjamin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoInitialContextException