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

Error

ja tentei um mote de coisa e não sei o certo onde esta o erro tudo que faço aparece "404 - Not Found"

coloquei o codigo no git hub se algem poder me da uma ajuda ou pelomenos um rumo para achar o erro.

https://github.com/matheusCalaca/aluraCasaDoCodigo/tree/estudos

16 respostas

Opa, verificou se a aplicação está sendo registrada no startup do servidor? O log do servidor é importante, pode ter dicas de onde está o erro.

olhei o log e não achei nada

[org.jboss.as.connector] (MSC service thread 1-8) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.4.Final)
[org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
[org.jboss.as.mail.extension] (MSC service thread 1-3) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
[org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
[org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
[org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = mysql
[org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path 'C:\Users\mathe\wildfly-10.1.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
[org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
[org.jboss.as.ejb3] (MSC service thread 1-3) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
[org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0012: Started server default-server.
[org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0018: Host default-host starting
[org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 4.0.21.Final
[org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
20:30:49,870 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-3) WFLYDM0111: Keystore C:\Users\mathe\wildfly-10.1.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
[org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\mathe\wildfly-10.1.0.Final\standalone\deployments
[org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) WFLYJCA0001: Bound data source [java:jboss/datasources/casadocodigoDS]
[org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-8) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.4.Final
[org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 61) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
[org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 61) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
[org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 60) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
[org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 60) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
[org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 62) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
[org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 62) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
[org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
[org.jboss.ws.common.management] (MSC service thread 1-8) JBWS022052: Starting JBossWS 5.1.5.Final (Apache CXF 3.1.6) 
[org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
[org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
[org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 6471ms - Started 332 of 578 services (393 services are lazy, passive or on-demand)

baixei e instalei o wildfly denovo porem mesmo asim o erro permanece, não tenho mais ideia do que pode ser

Engraçado que a aplicação não parece que está sendo deployada... Ela deveria aparecer ali no log... Algum detalhe de ambiente.

Boa noite, Matheus! Como vai?

Vc está utilizando o Eclipse? Lembrou de adicionar a sua aplicação para deploy no servidor de aplicação?

Boa noite, Matheus! Como vai?

E aí, conseguiu resolver o seu problema ou ele ainda persiste? Se resolveu, poderia compartilhar com a gente a solução?

Grande abraço!

ainda não resolvi o problema, ja reinstalei o eclipse, reinstaleio o wildfly a aplicação esta no deploy . vou tentar agora começar do 0 e refazer todos os exercicios para ver o que acontece.

antes de começar tudo do zero resolvi mexer mais um pouco, tenho algumas duvidas que pode ser a solução do problema.

1) estou utilizando o MYSQL 5.7.14, a foma de conexão permanece a mesma ? se não como e feito ?( de qualquer forma tentei fazer de outra forma, e surgi-o seguinte erro, segue o que fiz e o erro abaixo)

adicionei no pom.xml


            <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>6.0.6</version>
            </dependency>

mudei o jar e no "module.xml"

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-6.0.6.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
    </dependencies>
</module>

Error

 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) 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.run(ServiceControllerImpl.java:1904)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    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.LivroDao.manager
    at org.jboss.as.weld.services.bootstrap.WeldJpaInjectionServices.getScopedPUName(WeldJpaInjectionServices.java:114)
    at org.jboss.as.weld.services.bootstrap.WeldJpaInjectionServices.registerPersistenceContextInjectionPoint(WeldJpaInjectionServices.java:77)
    at org.jboss.weld.injection.ResourceInjectionFactory$PersistenceContextResourceInjectionProcessor.getResourceReferenceFactory(ResourceInjectionFactory.java:351)
    at org.jboss.weld.injection.ResourceInjectionFactory$PersistenceContextResourceInjectionProcessor.getResourceReferenceFactory(ResourceInjectionFactory.java:339)
    at org.jboss.weld.injection.ResourceInjectionFactory$ResourceInjectionProcessor.createFieldResourceInjection(ResourceInjectionFactory.java:217)
    at org.jboss.weld.injection.ResourceInjectionFactory$ResourceInjectionProcessor.createResourceInjections(ResourceInjectionFactory.java:189)
    at org.jboss.weld.injection.ResourceInjectionFactory.discoverType(ResourceInjectionFactory.java:449)

21:24:24,884 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" => "org.jboss.msc.service.StartException in service 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.LivroDao.manager"},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"casadocodigo.war\".WeldStartService"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
21:24:24,999 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "casadocodigo.war" (runtime-name : "casadocodigo.war")
21:24:25,016 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which 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

se alguem souber de alguma coisa,vou voltar a procurar uma solução amanha ja estou com a cabeça doendo kkkkkkk

Boa noite, Matheus! Como vai?

O erro parece estar acontecendo pq seu código não está conseguindo criar uma EntityManager, como visto no trecho a seguir:

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.LivroDao.manager

Cola aqui o conteúdo da sua classe LivroDao e do seu persistence.xml pra eu dar uma olhada.

LivroDao

package br.com.casadocodigo.loja.daos;

import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.com.casadocodigo.loja.model.Livro;

@Named
public class LivroDao {
    @PersistenceContext
    private EntityManager manager;

    public void salvar(Livro livro) {
        manager.persist(livro);
    }
}

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="casadocodigo-dev"
        transaction-type="JTA">
        <description>Dev persistence unit</description>

        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

        <jta-data-source>java:jboss/datasources/MySQLDS</jta-data-source>

        <properties>
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
            <!-- <property name="javax.persistence.schema-generation.database.action" -->
            <!-- value="drop-and-create" /> -->
            <!-- <property name="javax.persistence.sql-load-script-source" -->
            <!-- value="META-INF/sql/insert.sql" /> -->
        </properties>
    </persistence-unit>
</persistence>

Matheus, nesse tópico o autor estava com o mesmo problema que vc! Veja se a solução resolve o seu problema tbm e nos diz aqui!

Se não resolver, faltou pedir pra colar um código aqui! O do arquivo standalone-full.xml.

tentei refazer o persistenca um monte de vez e nada resolveu mesmo erro , não sei pq não cria o EntityManager, tentei mudar as dependecias coloque antiga tentei atualizar não vai para frente de forma alguma.

fiz varios testes no standalone-full.xml a ultima versão e essa.

            <datasources>
            <datasource jndi-name="java:jboss/datasources/ExampleDS"
                    pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <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:jboss/datasources/casadocodigoDS"
                    pool-name="casadocodigoDS">
                    <connection-url>jdbc:mysql://localhost:3306/casadocodigo_javaee
                    </connection-url>
                    <connection-property name="DatabaseName">
                        casadocodigo_javaee
                    </connection-property>
                    <driver>mysql</driver>
                    <pool>
                        <min-pool-size>10</min-pool-size>
                        <max-pool-size>20</max-pool-size>
                    </pool>
                    <security>
                        <user-name>root</user-name>
                    </security>
                </datasource>

                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource
                        </xa-datasource-class>
                    </driver>
                    <driver name="mysql" module="com.mysql">
                        <datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</datasource-class>
                    </driver>
                </drivers>
            </datasources>

se alguem tiver disponivel as vezes para combinar um horario para tentar conversar e acha onde estou errando?

solução!

apos sofre muito, refiz todo projeto e agora esta funcionando não sei o que estava errado não faço ideia