JBoss Community

Test EJB3 using Junit 4 in Glassfish 3.1.1

created by Sharma Ragav in EJB3 - View the full discussion

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?

Reply to this message by going to Community

Start a new discussion in EJB3 at Community