2 Replies Latest reply on Mar 2, 2006 8:51 AM by Alexander Grünewald

    EJB3 with plain RMI

    Alexander Grünewald Newbie

      Hello,

      I know that you experts will find this a stupid question, but i am asking me: Why can't I access an EJB3 Session Bean with just simple RMI. No additional libraries for JNDI and that stuff required. The client shouldn't know that it is accessing an EJB3 service. So the client would be as small as possible and independent of EJB3. Why can't an EJB3 client not simply look like that:

      import java.rmi.Naming;
      
      public class Client {
       public static void main(String[] args) {
      
       try {
       Hello service = (Hello) Naming.lookup("service/Hello");
       String response = service.sayHello();
       System.out.println("response: " + response);
       } catch (Exception e) {
       System.err.println("Client exception: " + e.toString());
       e.printStackTrace();
       }
       }
      }
      


      Best regards,
      Alexander