O projeto está funcionando normalmente, porém, não está mostrando na lista de session bean a classe br.com.caelum.livraria.dao.Banco, também não está executando o @PostConstruct. Não funciona com a anotação @Stateless, nem com @Singleton. Já verifiquei que todos os lugares onde a classe é chamada está sendo inicializada com @Inject, já dei clean no jboss, build clean, mas nada resolveu o problema.
//...
import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
//...
@Singleton
@Startup
public class Banco {
//...
@PostConstruct
void aposCriacao() {
System.out.println("[INFO] O Banco acabou de ser criado.");
}
//...
}
Log do wildfly:
19:40:50,553 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) WFLYWELD0003: Processing weld deployment livraria.war
19:40:50,743 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-8) HV000001: Hibernate Validator 5.2.4.Final
19:40:50,990 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) WFLYEJB0473: JNDI bindings for session bean named 'LivroDao' in deployment unit 'deployment "livraria.war"' are as follows:
java:global/livraria/LivroDao!br.com.caelum.livraria.dao.LivroDao
java:app/livraria/LivroDao!br.com.caelum.livraria.dao.LivroDao
java:module/LivroDao!br.com.caelum.livraria.dao.LivroDao
java:global/livraria/LivroDao
java:app/livraria/LivroDao
java:module/LivroDao
19:40:50,991 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) WFLYEJB0473: JNDI bindings for session bean named 'AutorDao' in deployment unit 'deployment "livraria.war"' are as follows:
java:global/livraria/AutorDao!br.com.caelum.livraria.dao.AutorDao
java:app/livraria/AutorDao!br.com.caelum.livraria.dao.AutorDao
java:module/AutorDao!br.com.caelum.livraria.dao.AutorDao
java:global/livraria/AutorDao
java:app/livraria/AutorDao
java:module/AutorDao
19:40:50,991 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) WFLYEJB0473: JNDI bindings for session bean named 'UsuarioDao' in deployment unit 'deployment "livraria.war"' are as follows:
java:global/livraria/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
java:app/livraria/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
java:module/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
java:global/livraria/UsuarioDao
java:app/livraria/UsuarioDao
java:module/UsuarioDao
19:40:51,744 INFO [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.
19:40:51,745 INFO [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.
19:40:52,060 INFO [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 2.4.5 (Final)
19:40:52,331 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 60) WFLYCLINF0002: Started client-mappings cache from ejb container
19:40:52,893 INFO [org.jboss.weld.Bootstrap] (MSC service thread 1-6) WELD-000169: Jandex cannot distinguish inner and static nested classes! Update Jandex to 2.0.3.Final version or newer to improve scanning performance.
19:40:53,935 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 64) Inicializando Mojarra 2.2.13.SP1 20160303-1204 para o contexto '/livraria'
19:40:55,667 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 64) Running on PrimeFaces 4.0
19:40:55,711 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 64) WFLYUT0021: Registered web context: /livraria
19:40:55,748 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "livraria.war" (runtime-name : "livraria.war")
19:40:55,966 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
19:40:55,966 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
19:40:55,967 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 12019ms - Started 497 of 733 services (404 services are lazy, passive or on-demand)
19:45:07,820 INFO [stdout] (default task-6) AutorDao foi criado