1

EJBContainer.createEJBContainer() を JBoss 7.1.1.Final で動作させることができた人はいますか?

次のコードを JUnit テストとして実行すると、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);
}

}

スタックトレース:

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)
4

3 に答える 3

0

上記のコードに System.setProperty("org.jboss.as.embedded.ejb3.BARREN", "true") を追加すると、NPE の問題が修正され、組み込みコンテナーは正常に起動しますが、次のエラーでクラスのデプロイに失敗します。

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"
于 2012-04-25T00:07:26.077 に答える
0

JBoss クラス org.jboss.vfs.VirtualJarFileInputStream に古いバグがあります。Zip ファイルの有効なローカル ファイル ヘッダーを書き込むことができません。そのため、一時的な zip ファイルを作成するクラスのデプロイは JBoss では機能しません。

于 2015-11-09T10:31:25.043 に答える
0

これらのファイルを設定する必要があります。 .xml で、testNG を使用する場合は、src/test/resources ディレクトリに testng.xml も追加します

クラスに追加する必要があります:

System.setProperty("org.jboss.as.embedded.ejb3.BARREN", "true");  
System.setProperty("jboss.home", "/home/usr1/jboss-as-7.1.1.Final");  
System.setProperty("jboss.home.dir", "/home/usr1/jboss-as-7.1.1.Final");
于 2015-01-23T10:34:52.777 に答える