0 Replies Latest reply on Jul 6, 2013 3:18 AM by Sharma Ragav

    Test EJB3 using Junit 4 in Glassfish 3.1.1

    Sharma Ragav Newbie

      Hi,

      I am using Glassfisg 3.1.1 server and test EJB3 class using junit4.

      Below are the code written in setUp() in test class.

       

      Getting below exception:

      javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.

      at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:216)

      at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:146)

      at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)


      @Before
      public void setUp() throws Exception {
        System.out.println("Inside setUp");
          InitialContext context = null;
        Properties prop = new Properties();
        prop.put("org.glassfish.ejb.embedded.glassfish.instance.root",
              "");
        prop.put(EJBContainer.MODULES, new File("/classes/"));

        EJBContainer container =EJBContainer.createEJBContainer();
        settingEJB = (SettingsBean) container.getContext().lookup("java:global/SettingsEJB");
      }

       

      Added glassfish-embedded-static-shell.jar in classpath.

      Anything missed?