【问题标题】:Wildfly Required services that are not installed:\Wildfly 所需的未安装服务:\
【发布时间】:2018-02-05 15:13:06
【问题描述】:

我尝试部署 JPA REST 应用程序并尝试在 Wildfly 10 上部署时遇到以下错误。

错误:

"{
    \"WFLYCTL0412: Required services that are not installed:\" => [
        \"jboss.naming.context.java.app.\\\"internal-1.0\\\".newDevConnection\",
        \"jboss.naming.context.java.jboss.datasources.ExampleDS\"
    ],
    \"WFLYCTL0180: Services with missing/unavailable dependencies\" => [
        \"jboss.naming.context.java.module.\\\"internal-1.0\\\".\\\"internal-1.0\\\".DefaultDataSource is missing [jboss.naming.context.java.jboss.datasources.ExampleDS]\",
        \"jboss.persistenceunit.\\\"internal-1.0.war#com.e24_MavenProjectTest_war_1.0-SNAPSHOTPU\\\" is missing [jboss.naming.context.java.app.\\\"internal-1.0\\\".newDevConnection]\",
        \"jboss.persistenceunit.\\\"internal-1.0.war#com.e24_MavenProjectTest_war_1.0-SNAPSHOTPU\\\".__FIRST_PHASE__ is missing [jboss.naming.context.java.app.\\\"internal-1.0\\\".newDevConnection]\"
    ]
}"

persistance.xml

<persistence-unit name="app-pu" transaction-type="JTA">
    <jta-data-source>java:/newDevConnection</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties/>
</persistence-unit>

standalone.xml 中的数据源

<datasources>
        <datasource jndi-name="java:/newDevConnection" pool-name="secret" enabled="true" use-java-context="true">
            <connection-url>jdbc:mysql://secret...</connection-url>
            <driver>mysql</driver>
            <security>
                <user-name>secret</user-name>
                <password>secret</password>
            </security>
        </datasource>
 <drivers>
        <driver name="com.mysql" module="mysql.mysql-connector-java">
          <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
        </driver>
        <driver name="mysql" module="org.mysql">
            <driver-class>com.mysql.jdbc.Driver</driver-class>
        </driver>
     </drivers>
</datasources>

编辑:mysql jdbc driver 位于project/WEB-INF/lib 文件夹中

“xa-datasource”和“non-xa-datasource”有什么区别?

我在正确的轨道上吗?在此先感谢/马库斯

【问题讨论】:

    标签: java jpa jboss datasource wildfly


    【解决方案1】:

    从错误消息看来,您删除了其他服务所需的 exampleDS。所以将该部分放回数据源。

    XA-Datasource 支持事务。

    【讨论】:

    • 为什么有人会在名为“ExampleDS”的东西上创建平台依赖项?
    • 经典红帽
    【解决方案2】:

    我知道它已经一岁了,但如果其他人遇到这个问题,我会发布我为这个问题所做的工作。这让我永远成为了新的 JBOSS 管理员。

    简而言之,ExampleDS 在配置文件中包含一个默认部分,这是您的错误的来源。我通常使用域配置文件,所以我将展示我的示例,但独立版是一样的,只需将配置文件名称放在前面。 Default-Bindings 是 ee 子系统中的部分。

    <default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
    

    默认的datasource="java:jboss/datasources/ExampleDS 是问题的根源。

    您可以删除默认数据源并将其设置为未定义。

    /profile=Profile_NameHere/subsystem=datasources/data- 
     source=ExampleDS:remove()
    /profile=Profile_NameHere/subsystem=ee/service=default-bindings:write- 
     attribute(name=datasource,value=undefined)
    

    您可以将自己的 DataSource 设置为默认值。

    /profile=Profile_NameHere/subsystem=ee/service=default-bindings:write- 
     attribute(name=datasource,value=java\:\/jboss\/datasources/name)
    

    【讨论】:

    • 我可以避免创建一个standalone.xml 吗?我没有,我知道没有它也可以工作,知道吗? :)
    • @RomainB。 - 这是来自 JBOSS CLI 界面的命令。我发现这是更新默认绑定的最简单方法。至于没有独立或 domain.xml 吗?不确定如果没有standalone.xml 或 domain.xml 文件,系统将如何工作。我知道您可以将其重命名为具有自定义配置的另一个自定义文件(我过去曾这样做过)。但是该框的standalone.xml 和domain.xml 是默认值。
    • @RomainB 您可能有这些版本,但可能没有意识到。提到的配置文件位于独立/配置和域/配置下。那里还有其他配置文件,用于最小配置、完整配置、高可用配置等。
    猜你喜欢
    • 1970-01-01
    • 2017-03-14
    • 1970-01-01
    • 2017-02-03
    • 2017-12-01
    • 2020-09-14
    • 1970-01-01
    • 2020-07-31
    • 2019-05-01
    相关资源
    最近更新 更多