Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se

Solucionado (ver solução)

Erro ao tentar subir o servidor wildfly 16 após configurar o standalone.xml

https://cursos.alura.com.br/course/ejb/task/4837

Estava usando o wildfly 8, mas vi que no post "https://cursos.alura.com.br/forum/topico-erro-ao-subir-o-servidor-87245", um aluno conseguiu usar o wildfly 16 e parti para usar ele tambem.

Não sei o que de repente faltou, mas estou com o erro abaixo:

10:01:02,382 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 16.0.0.Final (WildFly Core 8.0.0.Final) starting
10:01:02,966 INFO  [org.wildfly.security] (ServerService Thread Pool -- 26) ELY00001: WildFly Elytron version 1.8.0.Final
10:01:03,205 INFO  [org.jboss.as.controller] (Controller Boot Thread) OPVDX002: falha ao formatar erro de validação: null
10:01:03,205 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:143)
    at org.jboss.as.server.ServerService.boot(ServerService.java:385)
    at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:374)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '1' (code 49) (expected a name start character)
 at [row,col {unknown-source}]: [172,43]
    at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:650)
    at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:204)
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:122)
    at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69)
    at org.jboss.as.server.parsing.StandaloneXml_10.parseServerProfile(StandaloneXml_10.java:607)
    at org.jboss.as.server.parsing.StandaloneXml_10.readServerElement(StandaloneXml_10.java:240)
    at org.jboss.as.server.parsing.StandaloneXml_10.readElement(StandaloneXml_10.java:137)
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:126)
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:52)
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:122)
    at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:76)
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:126)
    ... 3 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '1' (code 49) (expected a name start character)
 at [row,col {unknown-source}]: [172,43]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:653)
    at com.ctc.wstx.sr.StreamScanner.parseFullName(StreamScanner.java:1933)
    at com.ctc.wstx.sr.StreamScanner.parseEntityName(StreamScanner.java:2058)
    at com.ctc.wstx.sr.StreamScanner.fullyResolveEntity(StreamScanner.java:1525)
    at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4783)
    at com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4226)
    at com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamReader.java:699)
    at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.getElementText(XMLExtendedStreamReaderImpl.java:144)
    at org.jboss.as.connector.util.AbstractParser.rawElementText(AbstractParser.java:61)
    at org.jboss.as.connector.subsystems.datasources.DsParser.parseDsSecurity_5_0(DsParser.java:1401)
    at org.jboss.as.connector.subsystems.datasources.DsParser.parseDataSource_4_0(DsParser.java:2010)
    at org.jboss.as.connector.subsystems.datasources.DsParser.parseDataSources(DsParser.java:229)
    at org.jboss.as.connector.subsystems.datasources.DsParser.parse(DsParser.java:189)
    at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:643)
    ... 14 more

10:01:03,205 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
10:01:03,205 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0050: WildFly Full 16.0.0.Final (WildFly Core 8.0.0.Final) stopped in 4ms

Já tentei várias configurações seguindo esse post e tentando subir o servidor na sequencia e tambem o post: "https://cursos.alura.com.br/forum/topico-montar-o-ambiente-para-utilizar-o-mysql-84273" e tambem o post "https://cursos.alura.com.br/forum/topico-wflyctl0085-failed-to-parse-configuration-23607" e o erro fica quase sempre o mesmo.

Alguém tem uma luz? De repente, se o Matheus Sousa pudesse disponibilizar o projeto dele com o wildfly 16, já que ele informou que conseguiu no post "https://cursos.alura.com.br/forum/topico-erro-ao-subir-o-servidor-87245". Obrigado.

4 respostas

Seguem os arquivos:

standalone.xml:

<datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <datasource jndi-name="java:/livrariaDS" pool-name="livrariaDS"
                    enabled="true" use-java-context="true">

                    <connection-url>jdbc:mysql://localhost:3306/livraria</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">
                        <driver-class>com.mysql.cj.jdbc.Driver</driver-class>
                        <xa-datasource-class>com.mysql.cj.jdbc.MysqlXADataSource</xa-datasource-class>

                    </driver>



                </drivers>
            </datasources>

module.xml:

<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.5" name="com.mysql">
  <resources>
    <resource-root path="mysql-connector-java-8.0.16.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

Tentei alterar na linha ""para module:1.8 e para module:1.0", mas sem sucesso.

Tentei com e sem a linha "" tambem.

Estou com o mesmo problema, amigo. Ninguém consegue ajudar ou dar suporte.

Pedem para fazer downgrade do java e usar as mesma versões do curso. Ai complica né,

att

solução

Maike, consegui subir o Wildfly 16. Seguem os arquivos configurados:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">

    <persistence-unit name="livraria">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <jta-data-source>java:/livrariaDS</jta-data-source>
        <class>br.com.caelum.livraria.modelo.Autor</class>
        <class>br.com.caelum.livraria.modelo.Livro</class>
        <class>br.com.caelum.livraria.modelo.Usuario</class>
        <properties>        
            <property name="hibernate.dialect"
                value="org.hibernate.dialect.MySQL5InnoDBDialect" />
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="true" />

        </properties>
    </persistence-unit>
</persistence>

module.xml:

<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.1" name="com.mysql">
  <resources>
    <resource-root path="mysql-connector-java-8.0.16.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

parte do standalone.xml:

<datasource jndi-name="java:/livrariaDS" pool-name="livrariaDS"
                    enabled="true" use-java-context="true">

                    <connection-url>jdbc:mysql://localhost:3306/livraria?useTimezone=true&amp;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>senha</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">
                        <driver-class>com.mysql.cj.jdbc.Driver</driver-class>
                        <xa-datasource-class>com.mysql.cj.jdbc.MysqlXADataSource</xa-datasource-class>

                    </driver>



                </drivers>

Descobri no outro curso de JPA que a senha do banco Mysql pode ter o caracter &, mas complica para usar com hibernate, jpa. daih, mudei a senha para _ e com essas configurações , funcionou.

11:30:16,340 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 43) WFLYSRV0010: Deployed "alura-java-ejb-o-poder-da-java-ee.war" (runtime-name : "alura-java-ejb-o-poder-da-java-ee.war")
11:30:16,377 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
11:30:16,379 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
11:30:16,379 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
11:30:16,379 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 16.0.0.Final (WildFly Core 8.0.0.Final) started in 6745ms - Started 521 of 709 services (330 services are lazy, passive or on-demand)

Maike, qualquer duvida, posta aqui ainda hoje, q tento te ajudar, se n, vou marcar como solução o comentario acima p ajudar o pessoal. Valeu.