I am trying to run my loginpage but i am getting the following error: my application uses Jboss 4.0.2, EJB ,

 

Error:

-----------------------------------------------------------------------------------

17:10:59,562 INFO  [STDOUT] mapping.getPath()::111111111111:::/login
17:10:59,562 INFO  [STDOUT] mapping.getPath()::222222222222:::/login
17:10:59,562 INFO  [STDOUT] mapping.getPath():::3333333333333::/login
17:10:59,562 INFO  [STDOUT] ######## Handler Name :com.srb.bl.login.LoginHandler
17:10:59,562 INFO  [STDOUT] ####### Load EJB's 1
17:10:59,562 INFO  [STDOUT] Load EJB com.srb.bl.login.LoginHandler
17:10:59,562 INFO  [STDOUT] Load EJB 1com.srb.bl.login.LoginHandler
17:10:59,843 INFO  [STDOUT] obj::::::com.srb.bl.login.LoginHandlerHome
17:10:59,843 INFO  [STDOUT] Load EJB 2com.srb.bl.login.LoginHandler
17:10:59,859 INFO  [STDOUT] java.lang.ClassCastException
17:10:59,859 INFO  [STDOUT]     at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(
Unknown Source)
17:10:59,859 INFO  [STDOUT]     at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.action.EJBFactory.loadEJB(EJBFactory.java:105)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.action.EJBFactory.loadEJBNames(EJBFactory.java:87)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.action.EJBFactory.(EJBFactory.java:40)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.action.Action.getInterface(Action.java:43)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.action.Action.getHandler(Action.java:62)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.login.LoginAction.perform(LoginAction.java:35)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.action.ActionServlet.processActionPerform(ActionServl
et.java:74)
17:10:59,859 INFO  [STDOUT]     at org.apache.struts.action.ActionServlet.process(ActionServlet.jav
a:1586)
17:10:59,859 INFO  [STDOUT]     at com.srb.wl.action.ActionServlet.process(ActionServlet.java:36)

-------------------------

EJBFactory.java

----------------------------------------------------------------------------------


package com.srb.wl.action;


import com.srb.ml.handler.BusinessHandlerHome;


import java.util.*;


import javax.naming.*;

import javax.rmi.PortableRemoteObject;


public class EJBFactory {
    private static HashMap _ejbRef = new HashMap();
    private static String className = "EJBFactory";

    static {
        String[] jndiNames = {
                Action.LOGIN      
                };
        loadEJBNames(jndiNames);
    }

    final static boolean VERBOSE = true;

    /**
     *  Gets the eJBHome attribute of the EJBFactory class
     *
     *@param  name  String
     *@return       The eJBHome value
     */
    public static BusinessHandlerHome getEJBHome(String name) {
        BusinessHandlerHome home = null;
        System.out.println("###### getEJBHome map  : "+_ejbRef);
        if (_ejbRef != null) {
            System.out.println("###### getEJBHome map 1 : "+_ejbRef);
            home = (BusinessHandlerHome) _ejbRef.get(name);
            System.out.println("###### getEJBHome map 2 : "+_ejbRef);
            System.out.println(" name : "+name);
            if (home == null) {
                home = loadEJB(name);
            }
        }

        return home;
    }

    /**
     * puts the EjbHome
     *
     *@param  name  String
     *@param  home  EJBHome
     */
    private static void putEJBHome(String name, BusinessHandlerHome home) {
        if (_ejbRef != null) {
            _ejbRef.put(name, home);
        }
    }

    /**
     * loads the EJBNames
     *
     *@param  names  String Array
     */
    private static void loadEJBNames(String[] names) {
        System.out.println("####### Load EJB's "+ names.length);
        for (int i = 0; i < names.length; i++) {
            putEJBHome(names[i], loadEJB(names[i]));
        }
    }

    /**
     * loads the EJ
     *
     *@param  lookupName  String
     *@return             EJBHome
     */
    private static BusinessHandlerHome loadEJB(String lookupName) {
        try {
            System.out.println("Load EJB "+ lookupName);
            Context ctx = getInitialContext();
            System.out.println("Load EJB 1"+ lookupName);
            Object obj =  ctx.lookup(lookupName);
            System.out.println("obj::::::"+obj);
            System.out.println("Load EJB 2"+ lookupName);
            BusinessHandlerHome home =(BusinessHandlerHome)PortableRemoteObject.narrow(obj,BusinessHandlerHome.class);
            System.out.println("Load EJB 3"+ lookupName);
           
            return home;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }


    public static Context getInitialContext()
        throws javax.naming.NamingException {
        Context ctx = null;

        try {
            Properties prop = new Properties();
            prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
            prop.put(Context.SECURITY_PRINCIPAL, "");
            prop.put(Context.SECURITY_CREDENTIALS,"");
            prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");
            ctx = new InitialContext(prop);
        } catch (Exception e) {
            e.printStackTrace();
        }
        

        return ctx;
    }
}

---------------------------------------------------------------