I make a program for this example . It seems that I added a file with a description of the datasource to the deployments jar folder with the driver, but when I deploy to the server (via debugging in IntelliJ IDEA) I get an error:

22:06:55,275 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment "webapp-example-1-1.0-SNAPSHOT.war" was rolled back with the following failure message: { "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.exampleDS"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.persistenceunit.\"webapp-example-1-1.0-SNAPSHOT.war#examplePU\" is missing [jboss.naming.context.java.jboss.exampleDS]", "jboss.persistenceunit.\"webapp-example-1-1.0-SNAPSHOT.war#examplePU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.exampleDS]" ] } 

Here is my datasource description file:

 <?xml varsion="1.0"?> <datasources schemaLocation="http://docs.jboss.org/ironjacamar/schema/datasources_1_1.xsd"> <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="PostgreSQLPool"> <connection-url>jdbc:postgresql://localhost:5432/example</connection-url> <driver>postgresql-42.2.5.jar</driver> <driver-class>org.postgresql.Driver</driver-class> <pool> <max-pool-size>30</max-pool-size> </pool> <security> <user-name>postgres</user-name> <password>1</password> </security> <validation> <check-valid-connection-sql>select 1</check-valid-connection-sql> </validation> </datasources> 

Project scope:

enter image description here

Persistence.xml file:

 <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> <persistence-unit name="examplePU"> <jta-data-source>java:jboss/exampleDS</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="false" /> </properties> </persistence-unit> </persistence> 

Why do these errors occur, and how to remove them?

    0