InitialContext.lookup("path") throws javax.naming.NamingException

156 views Asked by At

I am new to java and learning how to implement stateful ejb, I couldn't do that- (I wanted to maintain a list by adding and removing element in a arrayList) and unit testing is working fine, initializing the object throws the javax.naming.NamingException

Is there anything that i am missing.

 <%!
     private static ListElementRemoteForStateful itemIds;
     public void jspInit()
     {
          try
          {
            InitialContext ic = new InitialContext();
            // next line of code always throw
            // here EjbPrototype is the name of the project
            // StatefulEjb is the class name which resides in package ejb
            // I tested with java:global/EjbPrototype/StatefulEjb
            // I tested with java:global/EjbPrototype/ejb.StatefulEjb 
            // I tested with java:app/EjbPrototype/StatefulEjb 
            // I tested with java:module/EjbPrototype/StatefulEjb
            // I tested with java:comp/EjbPrototype/StatefulEjb but no luck
            itemIds = (ListElementRemoteForStateful)ic.lookup("java:global/EjbPrototype/StatefulEjb");

           }
           catch(Exception e)
           {
               System.out.println(e);
           }
    }
%>

I have following result produced by accepted answer of SOQ enter image description here

0

There are 0 answers