Solucionado (ver solução)
Solucionado
(ver solução)
11
respostas

Erro subindo o servidor

Eu estava conseguindo subir o servidor e fazer todos os testes até agora.... E nesse momento eu nem consigo acessar o index.html, todas as paginas dão erro 404. A princípio no console dá um erro do CDI. Alguém pode me explicar?

12:59:28,640 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."casadocodigo.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."casadocodigo.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1728)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named '' in deployment casadocodigo.war for injection point private javax.persistence.EntityManager br.com.casadocodigo.loja.daos.AutorDao.manager
...
12:59:28,647 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "casadocodigo.war")]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"casadocodigo.war\".WeldStartService" => "Failed to start service
    Caused by: java.lang.IllegalArgumentException: WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named '' in deployment casadocodigo.war for injection point private javax.persistence.EntityManager br.com.casadocodigo.loja.daos.AutorDao.manager"},
    "WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available." => {
        "Services that were unable to start:" => [
            "jboss.deployment.unit.\"casadocodigo.war\".CdiValidatorFactoryService",
...

São esses dois erros que aparecem...

11 respostas
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."casadocodigo.war".WeldStartService: Failed to start service
WFLYCTL0448: 16 additional services are down due to their dependencies being missing or failed
12:59:28,705 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
12:59:28,707 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
12:59:28,707 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
12:59:28,707 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 13.0.0.Final (WildFly Core 5.0.0.Final) started (with errors) in 5936ms - Started 444 of 655 services (20 services failed or missing dependencies, 331 services are lazy, passive or on-demand)

Oi Tiago!

Posta aqui o código do seu persistence.xml e do seu AutorDao pra gente dar uma olhada?

Abraço!

Opa!

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        version="2.1"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
    http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="casadocodigo-dev" transaction-type="JTA">
        <description>Dev persistence unit</description>
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <!-- java transaction api || JNDI -->
        <jta-data-source>java:jboss/datasources/casadocodigoDS</jta-data-source>
        <properties>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
        </properties>
    </persistence-unit>
</persistence>
package br.com.casadocodigo.loja.daos;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.com.casadocodigo.loja.models.Autor;

public class AutorDao {

    @PersistenceContext
    private EntityManager manager;


    public List<Autor> listar() {
        return manager.createQuery("select a from Autor a", Autor.class)
                .getResultList();
    }

}

Oi Tiago, mais uma pergunta, em que pasta está o seu persistence.xml?

Ela está na resources/META_INF

Comecei o projeto de novo, e quando crio os Daos e configuro o standalone-full ele dá esse IllegalArgumentException...

solução!

Oi Tiago!

O nome da pasta é META-INF com "-" (hífen). Se a sua estiver com "_" (underscore), tenta mudar e ver no que deu?

Abraço!

Opa Lucas! Então deve ser isso... Tem que avisar então que ta errado no exercício.. Tá como META_INF

Oi Tiago!

Corrigido. Obrigado pelo aviso.

abraço!

Valeu Lucas! Corrigi esse problema e ganhei outros hahaha Postei eu outro tópico. Abraço