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
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="primary">
<!-- Use a portable JNDI name for the datasource -->
<jta-data-source>java:global/jdbc/deneme2DS</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
here is the 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]"
]
}
where is the problem
jboss/wildfly
Docker image
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="primary">
<!-- 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>
</persistence-unit>
</persistence>
package deneme2.deneme2.config;
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
}
<?xml version="1.0" encoding="UTF-8"?>
<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">
<persistence-unit name="primary">
<!-- 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>
</persistence-unit>
</persistence>
--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/f5198db1-7ba8-4fab-9493-d6cb98fff4d5n%40googlegroups.com.
<?xml version="1.0" encoding="UTF-8"?>
<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">
<persistence-unit name="primary">
<!-- 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"
/> -->
<property name="wildfly.jpa.applicationdatasource" value="true"/>
</properties>
</persistence-unit>
</persistence>
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/5f136f00-aaae-497d-b996-265d9a418f8an%40googlegroups.com.
@DataSourceDefinition
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/430d361b-3e1c-4475-9888-738d5c451fd5n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/cd5b1e9d-d378-4644-867c-ceddac3111d8n%40googlegroups.com.
package deneme2.deneme2.config;
import jakarta.annotation.sql.DataSourceDefinition;
import jakarta.ejb.Singleton;
@Singleton
@DataSourceDefinition(
name = "java:app/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
}
<?xml version="1.0" encoding="UTF-8"?>
<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">
<persistence-unit name="primary">
<!-- Use a portable JNDI name for the datasource -->
<jta-data-source>java:app/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>
</persistence-unit>
</persistence>