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

NoInitialContextException  RSS feed

Benjamin Ho
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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) {
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("end of running exception");

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