lookup fail “Root exception is javax.die Benennung.NameNotFoundException"

habe ich erstellt entity-Klasse aus einer Datenbank die ich erstellt habe, session beans von entity-Klasse,
und wenn ich versuche zu testen, ob meine Daten erreichen, die entity-Klasse, die ich erstellt habe, einen junit-test auf die session beans Klasse, aber ich habe lookup fail "Root Ausnahme ist javax.naming.NameNotFoundException: EmpTableFacade!Bohnen.EmpTableFacade nicht gefunden, auch wenn ich EJB-injection
dann versuchte ich zu testen, mein code manuell erstellen-Klasse, die die Verwendung von session beans aber die gleiche Ausnahme hier .

ich denke, dass der Fehler durch die Bereitstellung von Personal, aber ich weiß nicht wo ich es falsch
dies ist session beans-Schnittstelle .

 /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

    package Beans;

    import java.util.List;
    import javax.ejb.Local;

    /**
     *
     * @author HADDAD
     */
    @Local
    public interface EmpTableFacadeLocal {

        void create(EmpTable empTable);

        void edit(EmpTable empTable);

        void remove(EmpTable empTable);

        EmpTable find(Object id);

        List<EmpTable> findAll();

        List<EmpTable> findRange(int[] range);

        int count();

    }



 and this is the test class

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

    package Controller;

    import Beans.EmpTable;
    import Beans.EmpTableFacade;
    import java.util.List;
    import java.util.Properties;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;

    /**
     *
     * @author HADDAD
     */
    public class Functionality {
        List<EmpTable> l;
        Context c=null;
        {
            try {
                Properties props = new Properties();
                props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");

                props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
                //glassfish default port value will be 3700,
                props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
                //props.load(new  FileInputStream("jndi.properties"));
                c = new InitialContext(props);
            } catch (NamingException ex) {
                Logger.getLogger(Functionality.class.getName()).log(Level.SEVERE, null, ex);
            }
            }
        public void retrive() throws NamingException
        {


            EmpTableFacade empTableFacade=(EmpTableFacade)
                    c.lookup("java:global/employee/employee-ejb/EmpTableFacade!Beans.EmpTableFacade");
           l= empTableFacade.findAll();
           System.out.println(l.get(0).getName().toString());
        }
        public static void main(String[] args) throws NamingException
        {
            Functionality f=new Functionality();
            f.retrive();

        }
    }

- und dies ist die Ausnahme

Exception in thread "main" javax.naming.NamingException: Lookup failed for 'java:global/employee/employee-ejb/EmpTableFacade!Beans.EmpTableFacade' in SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, org.omg.CORBA.ORBInitialHost=localhost, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: EmpTableFacade!Beans.EmpTableFacade not found]
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at Controller.Functionality.retrive(Functionality.java:45)
    at Controller.Functionality.main(Functionality.java:52)

InformationsquelleAutor Antwan | 2013-12-25

Schreibe einen Kommentar