wildflydatasource

Required services that are not installed:" => ["jboss.naming.context.java.global.jdbc.deneme2DS


DataSourceConfig.java

import jakarta.annotation.sql.DataSourceDefinition;

import jakarta.ejb.Singleton;


@Singleton

@DataSourceDefinition(

    name = "java:global/jdbc/deneme2DS",

    className = "org.h2.jdbcx.JdbcDataSource",

    url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1",

    user = "sa",

    password = "sa"

)

public class DataSourceConfig {

    // This class can be empty, as it only serves to define the DataSource

    // The DataSource will be automatically registered when this class is loaded

}

persistence.xml

<persistence xmlns="https://jakarta.ee/xml/ns/persistence"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"

version="3.0">

  <!-- Use a portable JNDI name for the datasource -->

  <jta-data-source>java:global/jdbc/deneme2DS</jta-data-source>

  <properties>


      <property

          name="jakarta.persistence.schema-generation.database.action"

          value="drop-and-create" />

      <property name="jakarta.persistence.sql-load-script-source"

          value="import.sql" />

      <!-- Properties for Hibernate <property name="hibernate.show_sql"

value="false"

          /> -->

  </properties>

here is the error log

20:26:07,298 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "deneme2-ear.ear")]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.global.jdbc.deneme2DS"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.persistenceunit."deneme2-ear.ear/deneme2-ejb.jar#primary".FIRST_PHASE is missing [jboss.naming.context.java.global.jdbc.deneme2DS]", "jboss.persistenceunit."deneme2-ear.ear/deneme2-ejb.jar#primary" is missing [jboss.naming.context.java.global.jdbc.deneme2DS]" ] }

Same setup works for Payara but not for Wildfly so i'm suspecting it is a bug on Wildfly side, posting here to make sure there isn't something i have missed.

I'm using payara/server-full and jboss/wildfly docker images.


Solution

  • Upgrading to Wildfly 31 solved the problem it was a bug on old version.