Problems in project reconfiguration

0

When I start wildfly I get the following error:

13:56:39,872 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."pokemax.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."pokemax.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "pokemax.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0406: No EJB found with interface of type 'br.com.pokemax.service.GeracaoServiceImpl' for binding br.com.pokemax.controller.GeracaoController/service
    at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:90)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:211)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:182)
    at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:186)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:143)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
    ... 5 more

13:56:39,880 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "pokemax.war")]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"pokemax.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"pokemax.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"pokemax.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0406: No EJB found with interface of type 'br.com.pokemax.service.GeracaoServiceImpl' for binding br.com.pokemax.controller.GeracaoController/service"},
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.deployment.unit.\"pokemax.war\".beanmanager",
        "jboss.deployment.unit.\"pokemax.war\".INSTALL"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.deployment.unit.\"pokemax.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"pokemax.war\".beanmanager]",
        "jboss.deployment.unit.\"pokemax.war\".batch.environment is missing [jboss.deployment.unit.\"pokemax.war\".beanmanager]"
    ]
}

My classes are:

Controller:

package br.com.pokemax.controller;

import java.io.Serializable;
import java.util.Collection;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.pokemax.modelo.Geracao;
import br.com.pokemax.service.GeracaoServiceImpl;
import br.com.pokemax.util.MensagensUtil;
import lombok.Getter;
import lombok.Setter;

@ViewScoped
@ManagedBean
public class GeracaoController implements Serializable {

    private static final long serialVersionUID = 1L;

    @Getter
    @Setter
    private Geracao geracao = new Geracao();

    @EJB
    private GeracaoServiceImpl service;

    @Getter
    @Setter
    private Collection<Geracao> lista;

    @PostConstruct
    public void inicio() {

    }

    public void gravar() {
                service.adicionar(geracao);
                MensagensUtil.msg("Info", "cadastro.sucesso", new Object[] { MensagensUtil.get("geracao") });
    }

}

Interface:

package br.com.pokemax.service;

import javax.ejb.Local;

import br.com.pokemax.modelo.Geracao;

@Local
public interface GeracaoService {

    public void adicionar(Geracao geracao);

}

Service:

package br.com.pokemax.service;

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

import br.com.pokemax.modelo.Geracao;

@Stateless
public class GeracaoServiceImpl implements GeracaoService {

    @PersistenceContext(name = "pokemax")
    private EntityManager em;

    @Override
    public void adicionar(Geracao geracao) {
        this.em.persist(geracao);    
    }
}

My persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
             version="2.1">
    <persistence-unit name="pokemax">
    <jta-data-source>java:jboss/datasources/pokemax</jta-data-source>
        <properties>
        <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost/pokemax?useTimezone=true&amp;serverTimezone=UTC" />
            <property name="hibernate.connection.driver" value="com.mysql.jdbc.Driver" />
            <property name="hibernate.connection.username" value="pokemax" />
            <property name="hibernate.connection.password" value="pokemax" />
            <property name="hibernate.show_sql" value="true" />
            <!-- <property name="hibernate.format_sql" value="true" />
            <property name="connection.pool_size" value="5" /> -->
        </properties>
    </persistence-unit>
</persistence>

Does anyone know where the error is?

    
asked by anonymous 29.12.2016 / 17:04

1 answer

1

Tried to swap @EJB with @Inject?

Controller:

@EJB
private GeracaoServiceImpl service;

by

@Inject
private GeracaoServiceImpl service;

If you need to use @EJB take a look at this answer, maybe it will help you link

    
29.12.2016 / 18:14