当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Glassfish embedded JNDI module scope lookup

问题描述:

I am trying to write JUnit tests by using an embedded glassfish server and EJB3.

I am using maven and my project has 3 modules, and in each of them I want to perform tests.

The module I am currently trying to write tests for is called Backend.

The problem is, that I require a "java:module/" scope for my jndi lookups in the test environment, but when I execute the test only "java:global/classes/" seems to exists.

Does anyone know how I can also execute module scope lookups in an embedded glassfish server?

Some further infos:

  • Modul structure:

    • EJB Module (called Backend)
    • WAR Module (called Frontend)
    • JAR Module (utility things)
  • POM test dependencies:

    <dependency>

    <groupId>org.glassfish.main.extras</groupId>

    <artifactId>glassfish-embedded-all</artifactId>

    <version>3.1.2</version>

    <scope>test</scope>

    </dependency>

    <dependency>

    <groupId>junit</groupId>

    <artifactId>junit</artifactId>

    <version>4.10</version>

    <scope>test</scope>

    <type>jar</type>

    </dependency>

网友答案:

Ok, I solved this by using Arquillian and deploying my EAR archive as an EnterpriseArchive.

分享给朋友:
您可能感兴趣的文章:
随机阅读: