[jboss-dev-forums] [EJB3 Development] - Embeddable EJBContainer and JBoss 7.1.1.Final

Mohammad wrk do-not-reply at jboss.com
Mon Apr 23 18:46:02 EDT 2012


Mohammad wrk [https://community.jboss.org/people/mohammadwrk] created the discussion

"Embeddable EJBContainer and JBoss 7.1.1.Final"

To view the discussion, visit: https://community.jboss.org/message/731765#731765

--------------------------------------------------------------
Has anyone been able to get EJBContainer.createEJBContainer() to work with JBoss 7.1.1.Final?
Running the following code as a JUnit test results in NullPointerException!
public class EJBContainerTest {


          private static EJBContainer ejbContainer;
          private static Context context;

          @BeforeClass
          public static void beforeClass() {
                         System.setProperty("jboss.home", "/home/usr1/jboss-as-7.1.1.Final");
                         ejbContainer = EJBContainer.createEJBContainer();
                         context = ejbContainer.getContext();
          }

          @Test
          public void test() {
                         Assert.assertNotNull(context);
          }
}

Stack trace:

java.lang.NullPointerException
          at org.jboss.modules.Module.forClassLoader(Module.java:365)
          at org.jboss.modules.Module.forClassLoader(Module.java:365)
          at org.jboss.modules.Module.forClassLoader(Module.java:365)
          at org.jboss.modules.Module.getContextModuleLoader(Module.java:421)
          at org.jboss.as.embedded.ejb3.JBossStandaloneEJBContainerProvider.createEJBContainer(JBossStandaloneEJBContainerProvider.java:86)
          at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:93)
          at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:75)
          at org.arquillian.example.EJBContainerTest.beforeClass(EJBContainerTest.java:18)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/731765#731765]

Start a new discussion in EJB3 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2030]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120423/5dbabe04/attachment.html 


More information about the jboss-dev-forums mailing list