尝试进行集成测试时,部署失败:“ WFLYCTL0412:未安装的必需服务:”

时间:2019-05-24 20:13:14

标签: integration-testing wildfly persistence.xml thorntail

mvn clean install出现此错误:

(main) Caused by: org.wildfly.swarm.container.DeploymentException: THORN0004: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.adds"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => {
    ["jboss.persistenceunit.\"ad-service-0.2.0-SNAPSHOT.war#AdPU\".__FIRST_PHASE__ is missing 
    [jboss.naming.context.java.jboss.datasources.adds]","jboss.persistenceunit.\"ad-service-0.2.0-SNAPSHOT.war#AdPU\" is missing [jboss.naming.context.java.jboss.datasources.adds]"]
}

我想这意味着他找不到我的数据库AdPUTest

这是我的persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"
    xmlns="http://xmlns.jcp.org/xml/ns/persistence"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="AdPUTest"
        transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>domain.model.Ad</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
            <property name="javax.persistence.jdbc.url"
                value="jdbc:h2:mem:AdDB;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE" />
            <property name="javax.persistence.jdbc.user" value="ad" />
            <property name="javax.persistence.jdbc.password" value="ad" />

            <property name="hibernate.hbm2ddl.auto" value="create-drop" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.dialect"
                value="org.hibernate.dialect.H2Dialect" />
            <property name="hibernate.id.new_generator_mappings" value="true" />
            <property name="hibernate.hbm2ddl.charset_name" value="UTF-8"/> 
            <property name="javax.persistence.sql-load-script-source" value="META-INF/instruments_test_data.sql"/>
        </properties>
    </persistence-unit>
</persistence>

我添加了这些<property name="hibernate. xxx,但仍然无法使用。.

有什么想法吗?

0 个答案:

没有答案