Utilizando a ideia do banco somente como um objeto estava normal, porém a montagem do ambiente para utilizar o MySQL não deu certo. Inseri o servidor Wildfly 16 e ao iniciar o servidor com as configurações propostas na seção, aparece os seguintes erros:
16:54:22,237 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2
16:54:22,240 INFO [org.wildfly.extension.microprofile.metrics.smallrye] (ServerService Thread Pool -- 60) WFLYMETRICS0001: Activating Eclipse MicroProfile Metrics Subsystem
16:54:22,242 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 42) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "com.mysql")
]) - failure description: "WFLYJCA0114: Failed to load datasource class: com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
16:54:32,413 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 74) WFLYUT0021: Registered web context: '/livraria' for server 'default-server'
16:54:32,434 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "livrariaDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.com_mysql"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.livrariaDS is missing [jboss.jdbc-driver.com_mysql]",
"jboss.driver-demander.java:/livrariaDS is missing [jboss.jdbc-driver.com_mysql]"
]
}
16:54:32,466 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "livrariaDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.jdbc-driver.com_mysql",
"jboss.jdbc-driver.com_mysql"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.livrariaDS is missing [jboss.jdbc-driver.com_mysql]",
"jboss.driver-demander.java:/livrariaDS is missing [jboss.jdbc-driver.com_mysql]",
"org.wildfly.data-source.livrariaDS is missing [jboss.jdbc-driver.com_mysql]"
]
}
16:54:32,476 INFO [org.jboss.as.server] (ServerService Thread Pool -- 43) WFLYSRV0010: Deployed "livraria.war" (runtime-name : "livraria.war")
16:54:32,478 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.com_mysql (missing) dependents: [service jboss.driver-demander.java:/livrariaDS, service org.wildfly.data-source.livrariaDS]
WFLYCTL0448: 2 additional services are down due to their dependencies being missing or failed
wildfly-16.0.0.Final\modules\system\layers\base\com\mysql\main\module.xml :
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-8.0.16.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Arquivo: wildfly-16.0.0.Final\modules\system\layers\base\com\mysql\main\mysql-connector-java-8.0.16.jar
standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:5.0">
<datasources>
<datasource jndi-name="java:/livrariaDS" pool-name="livrariaDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost/livraria?useTimezone=true&serverTimezone=UTC</connection-url>
<driver>com.mysql</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>admin</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
O que falta para poder montar o ambiente para continuar as aulas?