This discussion is archived
1 Reply Latest reply: Jul 18, 2012 5:52 AM by RenévanWijk RSS

Embedded EJB Container // No EJBContainer provider available

Justin James Newbie
Currently Being Moderated
Hello Friends

Environment :

Can you please share with me the EJBContainer.PROVIDER value while using weblogic12c.
I created an EJB3.1 stateless session bean, now I'm trying to use embedded ejb container for JUnit test class within the same EJB project.

I'm already followed this link -
but no luck.While running JUnit test class, getting following exception you can find at the bottom this post.

I'm using these packages from javax.ejb_3.1.0.jar
import javax.ejb.embeddable.EJBContainer;
import javax.ejb.spi.EJBContainerProvider;

Note : The same test project is running well in glassfish server.

Thanks in advance,
Have more fun with Java.

Exception :
javax.ejb.EJBException: No EJBContainer provider available for requested provider: 
        javax.ejb.spi.EJBContainerProvider: no provider names had been found.
     at javax.ejb.embeddable.EJBContainer.reportError(
     at javax.ejb.embeddable.EJBContainer.createEJBContainer(
     at com.justin.math.ejb.test.CalculatorEJBJUTest.init(
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
     at java.lang.reflect.Method.invoke(
     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
     at org.junit.runners.model.FrameworkMethod.invokeExplosively(
     at org.junit.internal.runners.statements.RunBefores.evaluate(
     at org.junit.internal.runners.statements.RunAfters.evaluate(
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
Test Class :
package com.justin.math.ejb.test;

import static org.junit.Assert.*;

import java.util.Properties;
import javax.ejb.embeddable.EJBContainer;
//import javax.ejb.spi.EJBContainerProvider;
import javax.naming.NamingException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import com.justin.math.ejb.CalculatorEJB;

public class CalculatorEJBJUTest {
     static EJBContainer ejbContainer; 
     static CalculatorEJB calculatorEJB;
     public static void init() {          
          String globalJndiName = "java:global/classes/CalculatorEJB";
          //String localJndiName = "java:module/CalculatorEJB";
          Properties properties = new Properties();
          try {
               properties.setProperty(EJBContainer.MODULES, "CalculatorEJB");
               properties.setProperty(EJBContainer.PROVIDER, "javax.ejb.spi.EJBContainerProvider");
                        //Also tried without setting properties in WLS12c. Glassfish was fine without properties.
               ejbContainer = EJBContainer.createEJBContainer(properties);
                        //Just trying both global and local jndi names
               //calculatorEJB = (CalculatorEJB) ejbContainer.getContext().lookup(localJndiName);
               calculatorEJB = (CalculatorEJB) ejbContainer.getContext().lookup(globalJndiName);
          } catch (NamingException e) {
     public static void release() {
          if(ejbContainer != null)
     public void testAdd() {
          int result = calculatorEJB.add(1, 2);
          assertEquals(3, result);
     public void testMultiply() {
          int result = calculatorEJB.multiply(1, 2);
          assertEquals(2, result);
  • 1. Re: Embedded EJB Container // No EJBContainer provider available
    RenévanWijk Oracle ACE
    Currently Being Moderated
    Some info can be found here:,
    also note here the EJB 3.1 Lite Functionality Supported in the Embedded EJB Container.

    This link (which you found) tells:

    Running Embedded Applications
    The embedded container, the enterprise bean components, and the client all are executed in the same virtual machine using the same classpath. As a result, developers can run an application that uses the embedded container just like a typical Java SE application as follows:

    java -classpath mySessionBean.jar:containerProviderRuntime.jar:myClient.jar
    In the above example, mySessionBean.jar is an EJB JAR containing a local stateless session bean, containerProviderRuntime.jar is a JAR file supplied by the enterprise bean provider that contains the needed runtime classes for the embedded container, and myClient.jar is a JAR file containing a Java SE application that calls the business methods in the session bean through the embedded container.

    The containerproviderruntime.jar in WebLogic is called wlclient.jar (which contains a /javax/ejb/embeddable/EJBContainer.class).
    The wlclient.jar is located in the MIDDLEWARE_HOME/wlserver_12.1/server/lib directory.

    The weblogic.jar contains a provider implementation:
    public class Test {
        public static void main(String[] args) {
            Map properties = new HashMap();
            File module = new File("C:\\temp\\WebLogicServer\\voorbeelden\\LoadTest6\\out\\artifacts\\Model\\Model.jar");
            properties.put(EJBContainer.MODULES, module);
            properties.put(EJBContainer.PROVIDER, "weblogic.ejb.embeddable.EJBContainerProvider");
            EJBContainer container = EJBContainer.createEJBContainer(properties);
            Context context = container.getContext();
            try {
                Company company = (Company) context.lookup("java:global/ejb/Company");
            } catch (NamingException e) {
    It is better to create a fullclient jar ( - instead of looking for the classes you will constantly be missing.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points