【问题标题】:Arquillian can't load LoadableExtension for Websphere Embedded ContainerArquillian 无法为 Websphere 嵌入式容器加载 LoadableExtension
【发布时间】:2016-10-28 11:11:38
【问题描述】:

我无法使 ArquillianWebsphere Embedded EJBContainer 一起顺利工作。 因为我不能使用 arquillian-was-embedded-8 Jar 文件(公司 Maven 存储库和 Jenkins 中缺少)。

我尝试在我的 Junit 测试中加载 WebSphereExtension (LoadableExtension),但没有成功。有人可以指出正确的解决方案吗?

我的第二个问题是,即使我在我的 IDE 中本地加载这个 jar 文件,我的 接口(在我的 EJB 上)也有问题。在此处查看相同的问题: [arquillian-was-embedded-8 runs but can't inject EJB. NullPointerException 我怎样才能避免这种情况?

我的 Maven 依赖项:

 <dependency>
           <groupId>com.ibm.websphere</groupId>
           <artifactId>com.ibm.ws.ejb.embeddableContainer</artifactId>
           <version>8.0.0.11</version>
       <scope>test</scope>
    </dependency>       
<dependency>
           <groupId>com.ibm.websphere</groupId>
           <artifactId>endorsed_apis</artifactId>
           <version>8.0.0.11</version>
       <scope>test</scope>
    </dependency>       
<dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.1.4.Final</version>
            <type>pom</type>
            <scope>import</scope>
     </dependency>       
     <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-build</artifactId>
            <version>1.1.4.Final</version>
            <type>pom</type>
            <scope>import</scope>
     </dependency>       
 <dependency>
        <groupId>org.jboss.arquillian.container</groupId>
        <artifactId>arquillian-container-spi</artifactId>
    <version>1.1.4.Final</version>           
        <scope>test</scope>
     </dependency>                 
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
    <version>1.1.4.Final</version>          
        <scope>test</scope>
    </dependency> 

Java 6、Junit 4.12、IDE Luna 4.4.2

提前谢谢你,我将不胜感激

【问题讨论】:

    标签: ejb websphere jboss-arquillian


    【解决方案1】:

    我找到了解决方案。如果我使用它,我不需要构建工件 在 src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension (这是一个文件名) 内容 --> /path/to/WebSphereExtension

    我这样解决的第二个问题:

    @EJB(mappedName = "java:global/test/MyEjbTest!com.home.coem.Processor")

    处理器测试1;

    Processor 是接口名称,MyEjbTest 是实现 bean!

    希望对大家有所帮助

    【讨论】:

    • WebSphere Application Server 从不使用mappedName。如果它有效果,我会怀疑您是否真的在使用 WebSphere 可嵌入容器。
    • 嗨,Brett,在 LoadableExtension 类中,您有一个可以覆盖的注册方法在这里您可以调用 WebSphereEmbeddedContainer。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多