Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 3rd, 2005, 03:14 AM
Authorized User
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default EJB questn: Need to specify class name ????

I am trying to run this program from Chapter2 of Professional EJB by WROX.
import javax.ejb.*;
import simpleBean.*;
import javax.naming.InitialContext;
class SalaryClient{
    public static void main(String[] args){
            InitialContext ctx = new InitialContext();
            Object objRef = ctx.lookup("Salary");

            SalaryHome home = (SalaryHome) javax.rmi.PortableRemoteObject.narrow(objRef,SalaryHome.class);

            Salary bean = home.create();

            System.out.println("Monthly net salary: "+bean.calculateSalary(28000,2,500));
        catch(javax.naming.NamingException ne){
            System.out.println("Naming Exception caught: "+ne);
        catch(Exception e){
            System.out.println("Exception caught: "+e);

I am getting the following error:
Naming Exception caught: 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
Press any key to continue...

Can anybody help me on this please ????

Similar Threads
Thread Thread Starter Forum Replies Last Post
EJB in Tomcat robinsdr EJB 2 June 18th, 2007 06:10 AM
EJB problem g_svadla EJB 0 April 26th, 2007 03:48 PM
EJB gillani EJB 1 July 1st, 2006 07:57 PM
EJB 3.0 GLichten BOOK: Expert One-on-One J2EE Design and Development 0 December 1st, 2005 06:02 AM
EJB - TransactionRolledbackException JavaNoob J2EE 0 August 12th, 2004 08:32 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.