1 Reply Latest reply on Oct 4, 2006 7:49 AM by wolfgangknauf

    JNDI problem

    cktheman

      Hello,
      I have a problem in my very fist Hello World example.
      I deployed a trivial Stateless Session Bean, here is the code of the bean and the test JSP:

      package test;
      import javax.ejb.*;
      @Remote
      public interface UserRemote
      {
      public int get();
      }
      ----------------------------------
      package test;
      import javax.ejb.*;
      @Stateless
      public class User
      implements UserRemote
      {
      public int get()
      {
      return 8;
      }
      }
      ---------------------------------
      <%@page import="java.util.*, test.*, javax.naming.*" %>

      <%
      InitialContext ctx = new InitialContext();
      out.println("" + ctx + "");
      out.println(ctx.lookup("User") + "");
      %>


      The problem is that ctx.lookup returns a NamingContext and NOT an User (!!!). Here is the JSP output:

      javax.naming.InitialContext@453dd5
      --------------------------------------------------------------------------------
      org.jnp.interfaces.NamingContext@1dea382

      Where am I wrong?
      thanks for any help
      Mario