在Wildfly 12

时间:2018-05-30 08:40:51

标签: wildfly cdi liquibase

我正在尝试在Wildfly 12(JDK 10)上运行liquibase CDI集成。启动时出现以下错误

10:27:30,291 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => ".war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\".war\".WeldStartService" => "Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ResourceAccessor with qualifiers @LiquibaseType
  at injection point [BackedAnnotatedField] @Inject @LiquibaseType liquibase.integration.cdi.CDILiquibase.resourceAccessor
  at liquibase.integration.cdi.CDILiquibase.resourceAccessor(CDILiquibase.java:0)

我在这里找到了一个类似的问题:Running Liquibase with CDI on Wildfly 8但是给定的解决方案对我不起作用。

我的制作人代码与liquibase网站上的代码相同:http://www.liquibase.org/documentation/cdi.html     package de.xima.lag.system.database.liquibase;

import java.sql.SQLException;

import javax.annotation.Resource;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import javax.sql.DataSource;

import liquibase.integration.cdi.CDILiquibaseConfig;
import liquibase.integration.cdi.annotations.LiquibaseType;
import liquibase.resource.ClassLoaderResourceAccessor;
import liquibase.resource.ResourceAccessor;


@Dependent
public class LiquibaseProducer {

  @Resource
  private DataSource myDataSource;

  private static final String LIQUIBASE_MASTERFILE_PATH = "META-INF/liquibase/master.xml";

  @Produces
  @LiquibaseType
  public CDILiquibaseConfig createConfig() {
    CDILiquibaseConfig config = new CDILiquibaseConfig();
    config.setChangeLog(LIQUIBASE_MASTERFILE_PATH);
    return config;
  }

  @Produces
  @LiquibaseType
  public DataSource createDataSource() throws SQLException {
    return myDataSource;
  }

  @Produces
  @LiquibaseType
  public ResourceAccessor create() {
    return new ClassLoaderResourceAccessor(getClass().getClassLoader());
  }
}

我的maven pom看起来像:     ...             org.liquibase        liquibase核心        3.6.1     

<dependency>
   <groupId>org.liquibase</groupId>
   <artifactId>liquibase-cdi</artifactId>
   <version>3.6.1</version>
</dependency>
...

有没有人有想法?

更新:已将 liquibase-cdi 依赖项包含在项目中会导致此错误。所以我想这对生产者类来说不是问题吗?

1 个答案:

答案 0 :(得分:0)

Wildfly目前发布了一个新版本,所以我切换到Wildfly 13并且它有效。没有想法