Wildfly 插件 - 数据源 - 未安装的必需服务

Wildfly Plugin - Datasource - Required services that are not installed

我正在尝试在 Wildfly Maven 插件中配置数据源...

我已经搜索了解决方案,但没有找到!

我的项目太基础了,我正在按照文档示例进行操作 (https://docs.jboss.org/wildfly/plugins/maven/latest)

我做了以下步骤:

1)我在 Pom.xml

中添加了 MySql 连接器依赖项
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>6.0.6</version>
</dependency>

2)Wildfly插件配置

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>1.2.1.Final</version>
        <configuration>
            <jboss-home>/opt/wildfly</jboss-home>
            <filename>${project.build.finalName}.war</filename>

            <executions>
                <execution>
                    <id>MySQL-Driver</id>
                    <phase>install</phase>
                        <goals>
                            <goal>deploy-artifact</goal>
                        </goals>
                        <configuration>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>6.0.6</version>
                            <name>mysql-connector-java-6.0.6</name>
                            <driver-name>mysql-connector-java-6.0.6</driver-name>
                        </configuration>
                </execution>
                <execution>
                    <id>DataSource</id>
                        <phase>install</phase>
                        <configuration>
                            <force>false</force>
                            <address>subsystem=datasources,data-source=java:/CondominioDS</address>
                            <resources>
                                <resource>
                                    <enableResource>true</enableResource>
                                            <properties>
                                        <jndi-name>java:/CondominioDS</jndi-name>
                                        <enable>true</enable>
                                        <connection-url>jdbc:mysql://localhost:3306/Condominio?useSSL=false</connection-url>
                                        <driver-class>com.mysql.cj.jdbc.Driver</driver-class>
                                        <driver-name>mysql-connector-java-6.0.6</driver-name>
                                        <user-name>root</user-name>
                                        <password>123</password>
                                    </properties>
                                </resource>
                            </resources>
                        <retryFailedDeploymentCount>1</retryFailedDeploymentCount>
                    </configuration>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                </execution>
                <execution>
                    <id>deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                </execution>
            </executions>
    </configuration>
</plugin>

3)Persistence.xml

的一部分
<persistence-unit name="Condominio" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>java:/CondominioDS</jta-data-source>

4) mvn 全新安装

5) mvn wildfly:start

6) mvn wildfly:deploy

我得到以下错误....

09:47:49,668 INFO  [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0001: Content added at location /opt/wildfly/standalone/data/content/06/1a91a0f2082869d2b08334631636973944d062/content

09:47:49,692 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "teste.war" (runtime-name: "teste.war")

09:47:50,941 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) WFLYJPA0002: Read persistence.xml for Condominio

09:47:51,120 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) WFLYWELD0003: Processing weld deployment teste.war

09:47:51,171 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.2.4.Final

09:47:51,340 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.cj.jdbc.Driver (version 6.0)

09:47:51,375 INFO  [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900: 2.3.5 (Final)

09:47:51,414 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = teste.war_com.mysql.cj.jdbc.Driver_6_0

09:47:51,546 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "teste.war")]) - failure description:

{
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.CondominioDS"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.persistenceunit.\"teste.war#Condominio\" is missing [jboss.naming.context.java.CondominioDS]",
        "jboss.persistenceunit.\"teste.war#Condominio\".__FIRST_PHASE__ is missing [jboss.naming.context.java.CondominioDS]"
    ]
}

09:47:51,547 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment "teste.war" was rolled back with the following failure message: 
{
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.CondominioDS"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.persistenceunit.\"teste.war#Condominio\" is missing [jboss.naming.context.java.CondominioDS]",
        "jboss.persistenceunit.\"teste.war#Condominio\".__FIRST_PHASE__ is missing [jboss.naming.context.java.CondominioDS]"
    ]
}

我的天啊!!!!

我发现了我的错误!

<configuration> </configuration>

标签在错误的位置关闭.....在执行后因此没有执行阶段和目标。

现在 "mvn install" 部署了工件,创建了 DS 并部署了应用程序.....@JamesR.Perkins