How to create JBoss EAR project with JPA, EJB and CDI elements

3.2k views Asked by At

I'm trying to create EAR project with EJB, JPA and Web elements. I have connection to database and think that it works fine. But I am not able to @inject beans from EJB project.

Here's my configuration: In EAR project EarContent/META-INF/application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" id="Application_ID" version="7">
  <display-name>Fantasy</display-name>
  <module>
    <ejb>FantasyEjb.jar</ejb>
  </module>
  <module>
    <web>
      <web-uri>FantasyWeb.war</web-uri>
      <context-root>FantasyWeb</context-root>
    </web>
  </module>
</application>

In EAR project EarContent/WEB-INF/jboss-deployment-structure.xml:

<?xml version="1.0"?>
<jboss-deployment-structure>
   <deployment>
        <exclusions>
          <module name="javax.faces.api" />
          <module name="com.sun.jsf-impl" />
        </exclusions>
        <dependencies>
          <module name="org.apache.log4j" />
          <module name="org.dom4j" />
          <module name="org.apache.commons.logging" />
          <module name="org.apache.commons.collections" />
          <module name="javax.faces.api" />
          <module name="com.sun.jsf-impl" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

In JPA project file 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="JPADB">
        <jta-data-source>java:jboss/datasources/AGHDS</jta-data-source>
        <properties>
            <property name="showSql" value="true"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
            <property name="hibernate.hbm2ddl.auto" value="create-drop" />
        </properties>
    </persistence-unit>
</persistence>

In EJB project ejbModule/META-INF/ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd">
    <display-name>FantasyEjb</display-name>
</ejb-jar>

In WEB project WebContent/WEB-INF/beans.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
    bean-discovery-mode="all">
</beans>

Now I have a bean in EJB project TestBean.java:

package com.fantasy.beans;

import java.io.Serializable;
import java.util.List;

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

import com.fantasy.db.model.Elfs;

@Stateless
public class TestBean implements Serializable{

    private static final long serialVersionUID = 1L;

    @PersistenceContext(unitName = "JPADB")
    private EntityManager em;

    public List<Elfs> query() {
        Query query = em.createQuery("FROM com.fantasy.db.model.Elfs");

        @SuppressWarnings("unchecked")
        List <Elfs> list =  query.getResultList();
        return list; 
    }
}

And in WEB project I have class Producer.java which would like to use in JSF page:

package com.fantasy.web;

import java.io.Serializable;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;

import com.fantasy.beans.TestBean;
import com.fantasy.db.model.Elfs;

@Named(value = "blogEntryBean")
@RequestScoped
public class Producer implements Serializable {

    private static final long serialVersionUID = 1L;

    @Inject
    TestBean bean;

    private List<Elfs> beans;

    @Produces
    @Named
    public List<Elfs> getBeans() {
        return beans;
    }

    public void setBeans(List<Elfs> beans) {
        this.beans = beans;
    }

    @PostConstruct
    public void retrieveAllSeatsOrderedByName() {
        beans = bean.query();


    }
}

The problem is in annoation @inject. Doesn't show errors without it- but I need to synchronize it with my ejb. I think I might missing some dependencies but I don't know how to fix it.

Log:

01:14:02,294 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000227: Running hbm2ddl schema export
01:14:02,390 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000230: Schema export complete
01:14:03,033 SEVERE [javax.enterprise.resource.webcontainer.jsf.flow] (MSC service thread 1-3) Unable to obtain CDI 1.1 utilities for Mojarra
01:14:03,044 SEVERE [javax.enterprise.resource.webcontainer.jsf.application.view] (MSC service thread 1-3) Unable to obtain CDI 1.1 utilities for Moja
rra
01:14:03,173 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."Fantasy.ear".WeldSt
artService: org.jboss.msc.service.StartException in service jboss.deployment.unit."Fantasy.ear".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TestBean with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject com.fantasy.web.Producer.bean
  at com.fantasy.web.Producer.bean(Producer.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:372)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:293)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:167)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:531)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_67]
    ... 3 more

01:14:03,183 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("depl
oyment" => "Fantasy.ear")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"Fantasy.ear\".WeldStartService" => "org
.jboss.msc.service.StartException in service jboss.deployment.unit.\"Fantasy.ear\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TestBean with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject com.fantasy.web.Producer.bean
  at com.fantasy.web.Producer.bean(Producer.java:0)
"}}
01:14:03,253 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "Fantasy.ear" (runtime-name : "Fantasy.ear")
01:14:03,257 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."Fantasy.ear".WeldStartService: org.jboss.msc.service.StartException 
in service jboss.deployment.unit."Fantasy.ear".WeldStartService: Failed to start service

01:14:03,355 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
01:14:03,356 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
01:14:03,356 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.2.0.Final "Tweek" started (with errors) in 7986ms - Started 385 of 47
3 services (22 services failed or missing dependencies, 108 services are lazy, passive or on-demand)
01:14:03,500 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 51) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'Fantasy.ear#JPAD
B'
01:14:03,501 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 51) HHH000227: Running hbm2ddl schema export
01:14:03,544 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 51) HHH000230: Schema export complete
01:14:03,546 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016009: Stopping weld service for deployment Fantasy.ear
01:14:03,580 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 51) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'Fantasy.ear#JPAD
B'
01:14:03,587 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015974: Stopped subdeployment (runtime-name: FantasyEjb.jar) in 99ms
01:14:03,587 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015974: Stopped subdeployment (runtime-name: FantasyWeb.war) in 99ms
01:14:03,589 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment Fantasy.ear (runtime-name: Fantasy.ear) in
 101ms
01:14:03,699 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "Fantasy.ear" (runtime-name: "Fantasy.ear")
01:14:03,704 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.deployment.subunit."Fantasy.ear"."FantasyEjb.jar".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."
Fantasy.ear".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."com.sun.faces.config.ConfigureListener".CREATE (missing) dependents: 
[service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."com.sun.faces.config.ConfigureListener".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [
service jboss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService, service jboss.undertow.deployment.default-ser
ver.default-host./FantasyWeb, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator (missing) de
pendents: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."com.sun.faces.config.ConfigureListener".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacesServlet".CREATE (missing) dependents: [servic
e jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacesServlet".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacesServlet".START (missing) dependents: [service
 jboss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService, service jboss.undertow.deployment.default-server.def
ault-host./FantasyWeb, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacesServlet".WeldInstantiator (missing) dependent
s: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacesServlet".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacetTag".CREATE (missing) dependents: [service jb
oss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacetTag".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jbo
ss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService, service jboss.undertow.deployment.default-server.default
-host./FantasyWeb, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacetTag".WeldInstantiator (missing) dependents: [
service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacetTag".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".CREATE (missing) depe
ndents: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) depen
dents: [service jboss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService, service jboss.undertow.deployment.def
ault-server.default-host./FantasyWeb, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator (mis
sing) dependents: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".CREATE (missing) dependents
: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents:
 [service jboss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService, service jboss.undertow.deployment.default-s
erver.default-host./FantasyWeb, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator (missing) 
dependents: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldInitialListener".CREATE (missing) dependen
ts: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldInitialListener".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldInitialListener".START (missing) dependent
s: [service jboss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService, service jboss.undertow.deployment.default
-server.default-host./FantasyWeb, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator (missing
) dependents: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldInitialListener".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldTerminalListener".CREATE (missing) depende
nts: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldTerminalListener".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldTerminalListener".START (missing) dependen
ts: [service jboss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService, service jboss.undertow.deployment.defaul
t-server.default-host./FantasyWeb, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator (missin
g) dependents: [service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldTerminalListener".START] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."
Fantasy.ear".deploymentCompleteService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.de
fault-server.default-host./FantasyWeb.UndertowDeploymentInfoService] 
      service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".jndiDependencyService (missing) dependents: [service jboss.deployment.subunit."F
antasy.ear"."FantasyWeb.war".component."javax.faces.webapp.FacesServlet".START, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".compon
ent."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.
servlet.WeldInitialListener".START, service jboss.deployment.subunit."Fantasy.ear"."FantasyWeb.war".component."org.jboss.weld.servlet.WeldTerminalList
ener".START, JBAS014799: ... and 4 more ] 
      service jboss.deployment.unit."Fantasy.ear".WeldBootstrapService (missing) dependents: [service jboss.deployment.unit."Fantasy.ear".CdiValidator
FactoryService] 
      service jboss.deployment.unit."Fantasy.ear".WeldStartService (missing) dependents: [service jboss.deployment.unit."Fantasy.ear".CdiValidatorFact
oryService] 
      service jboss.persistenceunit."Fantasy.ear#JPADB" (missing) dependents: [service jboss.deployment.unit."Fantasy.ear".deploymentCompleteService] 
      service jboss.undertow.deployment.default-server.default-host./FantasyWeb (missing) dependents: [service jboss.deployment.subunit."Fantasy.ear".
"FantasyWeb.war".deploymentCompleteService] 
      service jboss.undertow.deployment.default-server.default-host./FantasyWeb.UndertowDeploymentInfoService (missing) dependents: [service jboss.und
ertow.deployment.default-server.default-host./FantasyWeb] 
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."Fantasy.ear".WeldStartService

01:14:08,291 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found Fantasy.ear in deployment directory. To 
trigger deployment create a file called Fantasy.ear.dodeploy
2

There are 2 answers

0
Robby Cornelissen On

In Java EE 6 (on JBoss AS 7.2), I usually worked around this problem by creating producers for the EJBs in a resources class as follows:

public class Resources {
        @Produces
        @EJB
        private TestBean testBean;
}

This will allow you to @Inject them further down the line. There might be more elegant solutions available in Java EE 7, however.

3
Steve C On

I copied and pasted your code into a multi-module project and built it (using Maven).

Upon deployment into WildFly 8.2.0.Final, I get:

22:38:17,236 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "FantasyEar.ear" (runtime-name: "FantasyEar.ear")
22:38:17,291 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-10) JBAS015973: Starting subdeployment (runtime-name: "FantasyEjb.jar")
22:38:17,291 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015973: Starting subdeployment (runtime-name: "FantasyWeb.war")
22:38:17,328 INFO  [org.jboss.as.jpa] (MSC service thread 1-14) JBAS011401: Read persistence.xml for JPADB
22:38:17,400 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 50) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'FantasyEar.ear#JPADB'
22:38:17,407 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 50) HHH000204: Processing PersistenceUnitInfo [
    name: JPADB
    ...]
22:38:17,450 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 50) HHH000412: Hibernate Core {4.3.7.Final}
22:38:17,451 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000206: hibernate.properties not found
22:38:17,452 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000021: Bytecode provider name : javassist
22:38:17,496 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016002: Processing weld deployment FantasyEar.ear
22:38:17,537 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.1.3.Final
22:38:17,616 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016002: Processing weld deployment FantasyWeb.war
22:38:17,617 INFO  [org.jboss.weld.deployer] (MSC service thread 1-15) JBAS016002: Processing weld deployment FantasyEjb.jar
22:38:17,621 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-15) JNDI bindings for session bean named TestBean in deployment unit subdeployment "FantasyEjb.jar" of deployment "FantasyEar.ear" are as follows:

    java:global/FantasyEar/FantasyEjb/TestBean!com.fantasy.beans.TestBean
    java:app/FantasyEjb/TestBean!com.fantasy.beans.TestBean
    java:module/TestBean!com.fantasy.beans.TestBean
    java:global/FantasyEar/FantasyEjb/TestBean
    java:app/FantasyEjb/TestBean
    java:module/TestBean

22:38:17,668 INFO  [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016005: Starting Services for CDI deployment: FantasyEar.ear
22:38:17,690 INFO  [org.jboss.weld.Version] (MSC service thread 1-8) WELD-000900: 2.2.6 (Final)
22:38:17,700 INFO  [org.jboss.weld.deployer] (MSC service thread 1-13) JBAS016008: Starting weld service for deployment FantasyEar.ear
22:38:17,858 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 50) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'FantasyEar.ear#JPADB'
22:38:17,906 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 50) HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
22:38:18,198 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 50) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
22:38:18,203 WARN  [org.hibernate.dialect.H2Dialect] (ServerService Thread Pool -- 50) HHH000431: Unable to determine H2 database version, certain features may not work
22:38:18,267 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 50) HHH000397: Using ASTQueryTranslatorFactory
22:38:18,466 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000227: Running hbm2ddl schema export
22:38:18,471 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000389: Unsuccessful: drop sequence hibernate_sequence
22:38:18,471 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:
drop sequence hibernate_sequence [90036-173]
22:38:18,472 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000230: Schema export complete
22:38:18,962 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-7) Initializing Mojarra 2.2.8-jbossorg-1 20140822-1131 for context '/FantasyWeb'
22:38:19,295 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017534: Registered web context: /FantasyWeb
22:38:19,335 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "FantasyEar.ear" (runtime-name : "FantasyEar.ear")

The only thing I left out was the jboss-deployment-structure.xml file. Additionally, I made sure that every deployment descriptor was current for Java EE 7.

http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd

And no beans.xml anywhere!

The Fantasy.ear file is less than 9kb in size. If your's is significantly larger than this then you have jars that you don't need in it somewhere. The log message Unable to obtain CDI 1.1 utilities for Mojarra makes me think that you're deploying your own JSF libraries.

For prosperity, working source can be found at https://github.com/sfcoy/fantasy-demo.