Embeddable EJBContainer and JBoss 7.1.1.Final
mohammadwrk Apr 23, 2012 6:45 PMHas 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)