Note that there are some explanatory texts on larger screens.

plurals
  1. POlookup fail "Root exception is javax.naming.NameNotFoundException"
    text
    copied!<p>i have created entity class from database then i have created session beans from entity class and and when i am trying to test that my data reach the entity class i have created a junit test on the session beans class but i got lookup fail "Root exception is <code>javax.naming.NameNotFoundException</code>: EmpTableFacade!Beans.EmpTableFacade not found even if i used EJB injection then i tried to test my code manually by creating class that use the session beans but the same exception here .</p> <p>i think that the error from Deploying staff but i don't know where i did it wrong this is session beans interface .</p> <pre><code> /* * 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&lt;EmpTable&gt; findAll(); List&lt;EmpTable&gt; 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&lt;EmpTable&gt; 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(); } } </code></pre> <p>and this is the exception</p> <pre><code>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) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload