【问题标题】:Maven dependency entry for wildfly ejb standalone clientWildfly ejb 独立客户端的 Maven 依赖项
【发布时间】:2015-10-27 11:14:35
【问题描述】:

我正在为部署到 jboss wildfly 9.0.1.Final 的 ejb 应用程序编写独立客户端。我查看过的文档表明 wildfly 目录中有一个自述文件 (readme-ejb-jms.txt)。该文件包含以下对 Maven 依赖项的建议:

<dependencies>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-ejb-client-bom</artifactId>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-jms-client-bom</artifactId>
        <type>pom</type>
    </dependency>
</dependencies>

如果我使用它,我会收到一个错误,说需要版本,所以我修改了依赖项,如下所示:

    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-ejb-client-bom</artifactId>
        <version>9.0.1.Final</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-jms-client-bom</artifactId>
        <version>9.0.1.Final</version>
        <type>pom</type>
    </dependency>

当我使用上述方法运行 mvn clean install 时,出现此错误:

The following artifacts could not be resolved: 
org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final, 
org.jboss.as:jboss-as-jms-client-bom:pom:9.0.1.Final: 
Failure to find org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final 

mvn clean install 的完整输出如下所示:

C:\_WORKSPACE\workspace\_myapp\myappjbosswildflyclient>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myappjbosswildflyclient 4.3.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final is missing, no dependency information available
[WARNING] The POM for org.jboss.as:jboss-as-jms-client-bom:pom:9.0.1.Final is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.957s
[INFO] Finished at: Tue Aug 04 17:17:04 EDT 2015
[INFO] Final Memory: 5M/118M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myappjbosswildflyclient: Could not resolve dependencies for project mycompany-myapp:myappjbosswildflyclient:jar:4.3.0-SNAPSHOT: The following artifacts could not be resolved: org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final, org.jboss.as:jboss-as-jms-client-bom:pom:9.0.1.Final: Failure to find org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final in http://downl
oad.java.net/maven/2 was cached in the local repository, resolution will not be reattempted until the update interval of java.net2 has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
C:\_WORKSPACE\workspace\_myapp\myappjbosswildflyclient>

我应该为这些依赖项使用什么?

【问题讨论】:

标签: java maven jboss ejb wildfly


【解决方案1】:

您的依赖项必须是 POM 类型。

<type>pom</type>

【讨论】:

    【解决方案2】:

    这对我来说很好用:

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-ejb-client-bom</artifactId>
        <type>pom</type>
        <version>9.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-jms-client-bom</artifactId>
        <type>pom</type>
        <version>9.0.1.Final</version>
    </dependency>
    

    【讨论】:

    • 我使用上述方法得到以下错误(我在 java 1.7.0-51 上)[ERROR] error: error reading C:\Users\jgresh\.m2\repository\org\jboss\jboss-ejb-client\2.1.1.Final\jboss-ejb-client-2.1.1.Final.jar; invalid CEN header (bad signature)...
    • 我在我的 .m2 存储库中删除了我的 jboss 目录,这个版本现在可以工作了。感谢您的帮助!
    【解决方案3】:

    我找到了这篇文章并遵循了它提供的建议:

    https://developer.jboss.org/thread/237382

    我的依赖项如下所示:

        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-ejb-client-bom</artifactId>
            <type>pom</type>
            <version>8.0.0.Final</version>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-jms-client-bom</artifactId>
            <type>pom</type>
            <version>8.0.0.Final</version>
            <scope>import</scope>
        </dependency>
    

    我现在能够构建项目并为 ejb 查找创建初始上下文。

    我尝试将 9.0.1.Final 和 9.0.0.Final 用于没有运气的版本。

    我对版本不匹配以及随分发提供的 README-EJB-JMS.txt 文件中记录的依赖项不起作用这一事实感到非常不舒服。

    【讨论】:

      【解决方案4】:

      您似乎无权访问 maven 存储库,或者在检索依赖项 jar 时可能已断开连接。您可以手动删除本地 repo 并重试构建

      【讨论】:

      • 手动删除 .m2 中的 jboss 文件夹是解决方案的一部分。
      猜你喜欢
      • 2015-01-02
      • 2016-08-11
      • 2011-08-06
      • 1970-01-01
      • 1970-01-01
      • 2013-04-30
      • 2013-02-24
      • 2015-12-27
      • 2020-10-13
      相关资源
      最近更新 更多