3 Replies Latest reply: Apr 10, 2013 12:21 PM by Gustavo Orair RSS

    Embeddable EJBContainer and JBoss 7.1.1.Final

    Mohammad wrk Newbie

      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)

        • 1. Re: Embeddable EJBContainer and JBoss 7.1.1.Final
          Mohammad wrk Newbie

          Adding System.setProperty("org.jboss.as.embedded.ejb3.BARREN", "true") to the code above fixes the NPE problem and embedded container starts successfully but fails to deploy classes with the error below. Looking into the source code looks like that JBoss deployes the folder as a jar archive (creates one on the fly) and then fails to read the same file!

           

          ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit.classes.STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit.classes.STRUCTURE: Failed to process phase STRUCTURE of deployment "classes"
              at org
          .jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119)
              at org
          .jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
              at org
          .jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
              at java
          .util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
              at java
          .util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
              at java
          .lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to mount deployment content
              at org
          .jboss.as.server.deployment.module.DeploymentRootMountProcessor.deploy(DeploymentRootMountProcessor.java:91)
              at org
          .jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113)
             
          ... 5 more
          Caused by: java.util.zip.ZipException: invalid CEN header (bad signature)
              at java
          .util.zip.ZipFile.open(Native Method) [rt.jar:1.6.0_26]
              at java
          .util.zip.ZipFile.<init>(ZipFile.java:127) [rt.jar:1.6.0_26]
              at java
          .util.jar.JarFile.<init>(JarFile.java:135) [rt.jar:1.6.0_26]
              at java
          .util.jar.JarFile.<init>(JarFile.java:99) [rt.jar:1.6.0_26]
              at org
          .jboss.vfs.spi.JavaZipFileSystem.<init>(JavaZipFileSystem.java:97)
              at org
          .jboss.vfs.spi.JavaZipFileSystem.<init>(JavaZipFileSystem.java:83)
              at org
          .jboss.vfs.VFS.mountZip(VFS.java:408)
              at org
          .jboss.vfs.VFS.mountZip(VFS.java:434)
              at org
          .jboss.as.server.deployment.DeploymentMountProvider$Factory$ServerDeploymentRepositoryImpl.mountDeploymentContent(DeploymentMountProvider.java:95)
              at org
          .jboss.as.server.deployment.module.DeploymentRootMountProcessor.deploy(DeploymentRootMountProcessor.java:87)
             
          ... 6 more

          16:49:12,128 INFO  [org.jboss.as.server] (pool-9-thread-1) JBAS015870: Deploy of deployment "classes" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.classes.STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.classes.STRUCTURE: Failed to process phase STRUCTURE of deployment \"classes\""}}
          16:49:12,129 INFO  [org.jboss.as.controller] (pool-9-thread-1) JBAS014774: Service status report
          JBAS014777
          :   Services which failed to start:      service jboss.deployment.unit.classes.STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit.classes.STRUCTURE: Failed to process phase STRUCTURE of deployment "classes"

          • 2. Re: Embeddable EJBContainer and JBoss 7.1.1.Final
            cnguyen85 Newbie

            I have the same problem.

             

            Have you find a solution ?

            • 3. Re: Embeddable EJBContainer and JBoss 7.1.1.Final
              Gustavo Orair Newbie

              I have the same problem here.

               

              May someone clarify this problem?

               

              I am using Concordion, so, I cannot use Arquillian for now.