10
respostas

Não consigo abrir meu sub projeto após criar Enterprise Application Project.

Olá, fiz todos os procedimentos, e fiz o depois do arquivo. Não apresenta nenhum erro no console, está imprimindo no console normalmente a verificação do agendamento referente essa aula. Mais quando vou acesar minha aplicação através da WEB ele não encontra.

SEgue o Log.

WARNING: -logmodule is deprecated. Please use the system property 'java.util.logging.manager' or the 'java.util.logging.LogManager' service loader.
07:47:04,900 INFORMAÇÕES [org.jboss.modules] JBoss Modules version 1.1.1.GA
07:47:05,177 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
07:47:05,223 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting
07:47:06,127 INFO  [org.xnio] XNIO Version 3.0.3.GA
07:47:06,128 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
07:47:06,138 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
07:47:06,146 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.2.GA
07:47:06,183 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
07:47:06,189 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
07:47:06,226 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
07:47:06,259 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
07:47:06,262 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
07:47:06,273 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
07:47:06,280 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
07:47:06,283 INFO  [org.jboss.as.naming] (MSC service thread 1-5) JBAS011802: Starting Naming Service
07:47:06,288 INFO  [org.jboss.as.security] (MSC service thread 1-4) JBAS013100: Current PicketBox version=4.0.6.final
07:47:06,306 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-7) JBAS015400: Bound mail session [java:jboss/mail/Default]
07:47:06,308 INFO  [org.jboss.as.connector] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
07:47:06,377 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
07:47:06,391 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
07:47:06,558 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-8) JBoss Web Services - Stack CXF Server 4.0.1.GA
07:47:06,925 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-7) Starting Coyote HTTP/1.1 on http-localhost-127.0.0.1-8080
07:47:07,098 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\dayso\Documents\servidores\jboss-as-7.1.0.Final\standalone\deployments
07:47:07,106 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on localhost/127.0.0.1:4447
07:47:07,107 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on localhost/127.0.0.1:9999
07:47:07,119 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found livraria-a.ear in deployment directory. To trigger deployment create a file called livraria-a.ear.dodeploy
07:47:07,333 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
07:47:07,342 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/livrariaDS]
07:47:07,383 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "livraria-a.ear"
07:47:07,446 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "1_-_livraria-ejb.war"
07:47:07,447 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "3_-ejb-timerservice.jar"
07:47:09,305 INFO  [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for livraria
07:47:09,347 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment livraria-a.ear
07:47:09,401 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment 3_-ejb-timerservice.jar
07:47:09,404 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-5) JNDI bindings for session bean named Agendador in deployment unit subdeployment "3_-ejb-timerservice.jar" of deployment "livraria-a.ear" are as follows:

    java:global/livraria-a/3_-ejb-timerservice/Agendador!br.com.caelum.timer.Agendador
    java:app/3_-ejb-timerservice/Agendador!br.com.caelum.timer.Agendador
    java:module/Agendador!br.com.caelum.timer.Agendador
    java:global/livraria-a/3_-ejb-timerservice/Agendador
    java:app/3_-ejb-timerservice/Agendador
    java:module/Agendador

07:47:09,441 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment 1_-_livraria-ejb.war
07:47:09,442 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named UsuarioDao in deployment unit subdeployment "1_-_livraria-ejb.war" of deployment "livraria-a.ear" are as follows:

    java:global/livraria-a/1_-_livraria-ejb/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
    java:app/1_-_livraria-ejb/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
    java:module/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
    java:global/livraria-a/1_-_livraria-ejb/UsuarioDao
    java:app/1_-_livraria-ejb/UsuarioDao
    java:module/UsuarioDao

07:47:09,444 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named LivroDao in deployment unit subdeployment "1_-_livraria-ejb.war" of deployment "livraria-a.ear" are as follows:

    java:global/livraria-a/1_-_livraria-ejb/LivroDao!br.com.caelum.livraria.dao.LivroDao
    java:app/1_-_livraria-ejb/LivroDao!br.com.caelum.livraria.dao.LivroDao
    java:module/LivroDao!br.com.caelum.livraria.dao.LivroDao
    java:global/livraria-a/1_-_livraria-ejb/LivroDao
    java:app/1_-_livraria-ejb/LivroDao
    java:module/LivroDao

07:47:09,448 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named Banco in deployment unit subdeployment "1_-_livraria-ejb.war" of deployment "livraria-a.ear" are as follows:

    java:global/livraria-a/1_-_livraria-ejb/Banco!br.com.caelum.livraria.dao.Banco
    java:app/1_-_livraria-ejb/Banco!br.com.caelum.livraria.dao.Banco
    java:module/Banco!br.com.caelum.livraria.dao.Banco
    java:global/livraria-a/1_-_livraria-ejb/Banco
    java:app/1_-_livraria-ejb/Banco
    java:module/Banco

07:47:09,451 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named LivrariaWs in deployment unit subdeployment "1_-_livraria-ejb.war" of deployment "livraria-a.ear" are as follows:


07:47:09,453 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named AutorDao in deployment unit subdeployment "1_-_livraria-ejb.war" of deployment "livraria-a.ear" are as follows:

    java:global/livraria-a/1_-_livraria-ejb/AutorDao!br.com.caelum.livraria.dao.AutorDao
    java:app/1_-_livraria-ejb/AutorDao!br.com.caelum.livraria.dao.AutorDao
    java:module/AutorDao!br.com.caelum.livraria.dao.AutorDao
    java:global/livraria-a/1_-_livraria-ejb/AutorDao
    java:app/1_-_livraria-ejb/AutorDao
    java:module/AutorDao

07:47:09,456 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named AutorService in deployment unit subdeployment "1_-_livraria-ejb.war" of deployment "livraria-a.ear" are as follows:

    java:global/livraria-a/1_-_livraria-ejb/AutorService!br.com.caelum.livraria.bean.AutorService
    java:app/1_-_livraria-ejb/AutorService!br.com.caelum.livraria.bean.AutorService
    java:module/AutorService!br.com.caelum.livraria.bean.AutorService
    java:global/livraria-a/1_-_livraria-ejb/AutorService
    java:app/1_-_livraria-ejb/AutorService
    java:module/AutorService

07:47:09,472 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: livraria-a.ear
07:47:09,805 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900 1.1.5 (AS71)
07:47:10,212 INFO  [org.jboss.wsf.stack.cxf.metadata.MetadataBuilder] (MSC service thread 1-2) Add Service
 id=LivrariaWs
 address=http://localhost:8080/1_-_livraria-ejb/LivrariaWs
 implementor=br.com.caelum.livraria.webservice.LivrariaWs
 invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker
 serviceName={http://webservice.livraria.caelum.com.br/}LivrariaWsService
 portName={http://webservice.livraria.caelum.com.br/}LivrariaWsPort
 wsdlLocation=null
 mtomEnabled=false
 properties=[org.jboss.as.webservices.metadata.modelEjbComponentViewName -> service jboss.deployment.subunit."livraria-a.ear"."1_-_livraria-ejb.war".component.LivrariaWs.VIEW."br.com.caelum.livraria.webservice.LivrariaWs".SERVICE_ENDPOINT]
07:47:10,443 INFORMAÇÕES [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-2) Creating Service {http://webservice.livraria.caelum.com.br/}LivrariaWsService from class br.com.caelum.livraria.webservice.LivrariaWs
07:47:10,956 INFORMAÇÕES [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-2) Setting the server's publish address to be http://localhost:8080/1_-_livraria-ejb/LivrariaWs
07:47:11,087 INFO  [org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher] (MSC service thread 1-2) WSDL published to: file:/C:/Users/dayso/Documents/servidores/jboss-as-7.1.0.Final/standalone/data/wsdl/livraria-a.ear/1_-_livraria-ejb.war/LivrariaWsService.wsdl
07:47:11,095 INFO  [org.jboss.as.webservices] (MSC service thread 1-4) JBAS015539: Starting service jboss.ws.port-component-link
07:47:11,108 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011402: Starting Persistence Unit Service 'livraria-a.ear/1_-_livraria-ejb.war#livraria'
07:47:11,242 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-1) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
07:47:11,247 INFO  [org.hibernate.Version] (MSC service thread 1-1) HHH000412: Hibernate Core {4.0.1.Final}
07:47:11,248 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH000206: hibernate.properties not found
07:47:11,249 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH000021: Bytecode provider name : javassist
07:47:11,265 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-1) HHH000204: Processing PersistenceUnitInfo [
    name: livraria
    ...]
07:47:11,536 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-1) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
07:47:11,581 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-1) HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
07:47:11,598 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-1) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
07:47:11,602 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-1) HHH000397: Using ASTQueryTranslatorFactory
07:47:11,632 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-1) Hibernate Validator 4.2.0.Final
07:47:11,868 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-1) HHH000228: Running hbm2ddl schema update
07:47:11,868 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-1) HHH000102: Fetching database metadata
07:47:11,872 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-1) HHH000396: Updating schema
07:47:11,883 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: livrariaejb.autor
07:47:11,884 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000037: Columns: [id, nome]
07:47:11,884 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000108: Foreign keys: []
07:47:11,885 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000126: Indexes: [primary]
07:47:11,891 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: livrariaejb.livro
07:47:11,891 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000037: Columns: [id, titulo, autor_id]
07:47:11,892 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000108: Foreign keys: [fk4607e76f971cf8]
07:47:11,892 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000126: Indexes: [primary, fk4607e76f971cf8]
07:47:11,896 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: livrariaejb.usuario
07:47:11,897 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000037: Columns: [id, login, senha]
07:47:11,897 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000108: Foreign keys: []
07:47:11,898 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000126: Indexes: [primary]
07:47:11,898 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-1) HHH000232: Schema update complete
07:47:11,919 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016008: Starting weld service for deployment livraria-a.ear
07:47:12,398 INFO  [stdout] (EJB default - 1) verificando serviço externo periodicamente

07:47:12,401 INFO  [stdout] (MSC service thread 1-5) Banco acabou de ser Construido

07:47:12,403 INFO  [org.jboss.as.webservices] (MSC service thread 1-2) JBAS015539: Starting service jboss.ws.endpoint."livraria-a.ear"."1_-_livraria-ejb.war".LivrariaWs
07:47:12,410 INFO  [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-2) register: jboss.ws:context=1_-_livraria-ejb,endpoint=LivrariaWs
07:47:12,452 INFORMAÇÕES [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) Inicializando Mojarra 2.1.5 (SNAPSHOT 20111202) para o contexto '/1_-_livraria-ejb'
07:47:14,022 INFORMAÇÕES [org.primefaces.webapp.PostConstructApplicationEventListener] (MSC service thread 1-1) Running on PrimeFaces 4.0
07:47:14,066 INFO  [org.jboss.web] (MSC service thread 1-1) JBAS018210: Registering web context: /1_-_livraria-ejb
07:47:14,068 INFO  [org.jboss.as] (MSC service thread 1-1) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 9553ms - Started 317 of 395 services (76 services are passive or on-demand)
07:47:14,117 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "livraria-a.ear"
07:47:20,003 INFO  [stdout] (EJB default - 2) verificando serviço externo periodicamente

07:47:30,002 INFO  [stdout] (EJB default - 3) verificando serviço externo periodicamente

07:47:40,001 INFO  [stdout] (EJB default - 4) verificando serviço externo periodicamente

07:47:50,001 INFO  [stdout] (EJB default - 5) verificando serviço externo periodicamente

07:48:00,010 INFO  [stdout] (EJB default - 6) verificando serviço externo periodicamente

07:48:10,029 INFO  [stdout] (EJB default - 7) verificando serviço externo periodicamente

07:48:20,002 INFO  [stdout] (EJB default - 8) verificando serviço externo periodicamente

07:48:30,008 INFO  [stdout] (EJB default - 9) verificando serviço externo periodicamente

07:48:40,003 INFO  [stdout] (EJB default - 10) verificando serviço externo periodicamente

07:48:50,001 INFO  [stdout] (EJB default - 1) verificando serviço externo periodicamente

07:49:00,001 INFO  [stdout] (EJB default - 2) verificando serviço externo periodicamente

07:49:10,001 INFO  [stdout] (EJB default - 3) verificando serviço externo periodicamente

07:49:20,006 INFO  [stdout] (EJB default - 4) verificando serviço externo periodicamente

07:49:30,002 INFO  [stdout] (EJB default - 5) verificando serviço externo periodicamente

07:49:40,012 INFO  [stdout] (EJB default - 6) verificando serviço externo periodicamente
10 respostas

cadê o código dos serviços envolvidos ?

obrigado pelo ajuda, só uma duvida, qual código dos serviços envolvidos você fala?

Não entendi sua dificuldade, o agendamento roda junto com a aplicação web, só que em segundo plano, detalhe mais seu problema fazendo favor.

Pronto, vamos lá.

Referente a ultima aula, foi criado um projeto novo até aí ok, no qual seria esta classe. *Foi criado um projeto extra para poder unir dois projeto que seria o Agendamento e o livraria. Ao fazer o Deploy da aplicação ficou rodando no meu console esta saida que esta nesta classe, o projeto JSF não consegui encontrar na url. Ou seja, só funcionou apenas uma classe.

@Singleton
@Startup 
public class Agendador {
    @Schedule(hour="*",minute="*",second="*/10",persistent=false) 
    void agendador(){
        System.out.println("verificando serviço externo periodicamente");
    }
}

Então o seu projeto ejb funciona normal, e nenhuma página do projeto web funciona?

isso. Codigo acima roda perfeitamente, mais o projeto não roda.

Poste uma classe bean e uma dao

Classe Bean

package br.com.caelum.livraria.bean;

import java.util.List;

import javax.enterprise.inject.Model;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;

import br.com.caelum.livraria.dao.AutorDao;
import br.com.caelum.livraria.dao.LivroDao;
import br.com.caelum.livraria.modelo.Autor;
import br.com.caelum.livraria.modelo.Livro;

@Model
@RequestScoped
public class LivroBean {

    private Livro livro = new Livro();
    private Integer autorId;
    @Inject
    private LivroDao livroDao;
    @Inject
    private AutorDao autorDao;

    public void cadastra() {

        Autor autor = this.autorDao.buscaPelaId(this.autorId);
        this.livro.setAutor(autor);

        this.livroDao.salva(livro);

        this.livro = new Livro();
    }

    public List<Autor> getAutores() {
        return autorDao.todosAutores();
    }

    public Livro getLivro() {
        return livro;
    }

    public void setAutorId(Integer autorId) {
        this.autorId = autorId;
    }

    public Integer getAutorId() {
        return autorId;
    }

    public List<Livro> getLivros() {
        return this.livroDao.todosLivros();
    }
}

Classe DAO

package br.com.caelum.livraria.dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.com.caelum.livraria.modelo.Livro;

@Stateless
public class LivroDao {

    @PersistenceContext(name = "livraria")
    EntityManager manager;

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

    public List<Livro> todosLivros() {
        return manager.createQuery("select f from Livro f", Livro.class).getResultList();
    }

    public List<Livro> livroPeloNome(String nome) {
        List<Livro> livros = manager.createQuery("select l from Livro l where l.titulo like :pTitulo", Livro.class)
                .setParameter("pTitulo", nome).getResultList();

        return livros;
    }
}

Seu projeto está com algum erro ou warning ?

Dayson,

Pelo log você incluiu dois projetos no .ear chamados de: - 1-_livraria-ejb.war - 3-ejb-timerservice.jar

Realmente são esses dois projetos? O projeto que contem as paginas web é este .war mesmo? Esta me parecendo que você incluiu no .ear o projeto incorreto.

Até mais