3 Replies Latest reply on Aug 6, 2009 5:37 AM by folal

    test on ejb3 with junit by eclipse

    folal

      Dear all,

      I want to write JUnit Tests for my EJB3.0 SessionBeans. How do I access the
      application server?

      InitialContext ctx = new InitialContext(); bean = (BeanInterface) ctx.lookup("...");

      does not work since the initial context cannot be resolved
      (javax.naming.NoInitialContextException: Need to specify class name in
      environment or system property, or as an applet parameter, or in an application
      resource file: java.naming.factory.initial).

      Obvoiusly, for the same reason, dependency injection doesn't work either: @EJB BeanInterface bean;

      What do I have to do?

      Best regards
      Alan