title: Why is my EntityManager not properly injected?
body: <p>I tried to build a project with manages Employees using JPA and Beans and JSF. I started trying to manipulated an existing user which I manually created in the database. (before I tried to read the data from the database, this worked well) I tried this in various ways, by getting different errors, so I assume that I do somethinbg completely wrong. My Server is Wildfly 8 and database is postgresql.</p>
  
  <pre><code>15:09:43,410 ERROR [io.undertow.request] (default task-14) UT005023: Exception handling request to /time/modifyuser.jsf: javax.servlet.ServletException: Bei der Ressourcen-Einspeisung auf dem verwalteten Bean employeeManagerTool ist ein Fehler aufgetreten.
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    //...
  Caused by: javax.naming.NamingException: JBAS011878: Failed to lookup env/tbp.WAM.Tools.EmployeeManagerTool/entityManager [Root exception is java.lang.NullPointerException]
      //...
  Caused by: java.lang.NullPointerException
      at org.jboss.as.jpa.container.ExtendedPersistenceDeepInheritance.findExtendedPersistenceContext(ExtendedPersistenceDeepInheritance.java:49) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
      at org.jboss.as.jpa.injectors.PersistenceContextInjectionSource$PersistenceContextJndiInjectable.getReference(PersistenceContextInjectionSource.java:168) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:131)
      ... 93 more
  </code></pre>
  
  <p>So here is my Bean:</p>
  
  <pre><code>    @Stateless(name = "EmployeeManagerTool")
              public class EmployeeManagerTool implements EmployeeManagerToolLocal {
  
                  @PersistenceContext(type=PersistenceContextType.EXTENDED)
                  private EntityManager entityManager;
  
                  public EmployeeManagerTool() {
                  }
  
                  public void modifyEmployee() {
                      Employee employee = entityManager.find(Employee.class, 1);
                      employee.setFirstName("NNF");
                      employee.setLastName("NNL");
                      entityManager.persist(employee);
                  }
  //just trying to alter the first entry, there is one with id=1
      // other CRUD methods
          }
  </code></pre>
  
  <p>My Entity looks like this:</p>
  
  <pre><code>@Entity
  @Table(name = "tbl_Employee")
  public class Employee implements Serializable {
  private String firstName;
      private String lastName;
      private String username;
      private String password;
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private int id;
  
      @Version
      private int version;
  
      public Employee() {}
  //some getter and setter...
  }
  </code></pre>
  
  <p>My JSF file:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"&gt;
  
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  &lt;title&gt;ejb-in-ear&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;h:form&gt;
      &lt;h:commandButton value="Save User" action="#{employeeManagerTool.modifyEmployee()}"/&gt;
  &lt;/h:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My persistence.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
      &lt;persistence-unit name="timebudget" transaction-type="JTA"&gt;
          &lt;!-- using hibernate as JPA provider --&gt;
          &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
  
          &lt;!-- Datenquelle ist PostGres --&gt;
          &lt;jta-data-source&gt;java:jboss/datasources/TBPDS&lt;/jta-data-source&gt;
  
          &lt;properties&gt;
              &lt;!-- Konfiguration für den PostGreSQL-Dialekt --&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /&gt;
  
              &lt;!-- hibernate Einstellungen --&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;  
              &lt;property name="hibernate.show_sql" value="false" /&gt;
              &lt;property name="hibernate.format_sql" value="false" /&gt;
              &lt;property name="hibernate.use_sql_comments" value="false" /&gt;
              &lt;property name="hibernate.archive.autodetection" value="class" /&gt;           
          &lt;/properties&gt;
  
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Pleaaase, help me. I'm stuck at this for the whole weekend. I don't get what I'm doing wrong...</p>
  
  <p>Standalone.xml: </p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  
  &lt;server xmlns="urn:jboss:domain:2.2"&gt;
  
      &lt;extensions&gt;
          &lt;extension module="org.jboss.as.clustering.infinispan"/&gt;
          &lt;extension module="org.jboss.as.connector"/&gt;
          &lt;extension module="org.jboss.as.deployment-scanner"/&gt;
          &lt;extension module="org.jboss.as.ee"/&gt;
          &lt;extension module="org.jboss.as.ejb3"/&gt;
          &lt;extension module="org.jboss.as.jaxrs"/&gt;
          &lt;extension module="org.jboss.as.jdr"/&gt;
          &lt;extension module="org.jboss.as.jmx"/&gt;
          &lt;extension module="org.jboss.as.jpa"/&gt;
          &lt;extension module="org.jboss.as.jsf"/&gt;
          &lt;extension module="org.jboss.as.logging"/&gt;
          &lt;extension module="org.jboss.as.mail"/&gt;
          &lt;extension module="org.jboss.as.naming"/&gt;
          &lt;extension module="org.jboss.as.pojo"/&gt;
          &lt;extension module="org.jboss.as.remoting"/&gt;
          &lt;extension module="org.jboss.as.sar"/&gt;
          &lt;extension module="org.jboss.as.security"/&gt;
          &lt;extension module="org.jboss.as.transactions"/&gt;
          &lt;extension module="org.jboss.as.webservices"/&gt;
          &lt;extension module="org.jboss.as.weld"/&gt;
          &lt;extension module="org.wildfly.extension.batch"/&gt;
          &lt;extension module="org.wildfly.extension.io"/&gt;
          &lt;extension module="org.wildfly.extension.undertow"/&gt;
      &lt;/extensions&gt;
  
  
      &lt;management&gt;
          &lt;security-realms&gt;
              &lt;security-realm name="ManagementRealm"&gt;
                  &lt;authentication&gt;
                      &lt;local default-user="$local" skip-group-loading="true"/&gt;
                      &lt;properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/&gt;
                  &lt;/authentication&gt;
                  &lt;authorization map-groups-to-roles="false"&gt;
                      &lt;properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/&gt;
                  &lt;/authorization&gt;
              &lt;/security-realm&gt;
              &lt;security-realm name="ApplicationRealm"&gt;
                  &lt;authentication&gt;
                      &lt;local default-user="$local" allowed-users="*" skip-group-loading="true"/&gt;
                      &lt;properties path="application-users.properties" relative-to="jboss.server.config.dir"/&gt;
                  &lt;/authentication&gt;
                  &lt;authorization&gt;
                      &lt;properties path="application-roles.properties" relative-to="jboss.server.config.dir"/&gt;
                  &lt;/authorization&gt;
              &lt;/security-realm&gt;
          &lt;/security-realms&gt;
          &lt;audit-log&gt;
              &lt;formatters&gt;
                  &lt;json-formatter name="json-formatter"/&gt;
              &lt;/formatters&gt;
              &lt;handlers&gt;
                  &lt;file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/&gt;
              &lt;/handlers&gt;
              &lt;logger log-boot="true" log-read-only="false" enabled="false"&gt;
                  &lt;handlers&gt;
                      &lt;handler name="file"/&gt;
                  &lt;/handlers&gt;
              &lt;/logger&gt;
          &lt;/audit-log&gt;
          &lt;management-interfaces&gt;
              &lt;http-interface security-realm="ManagementRealm" http-upgrade-enabled="true"&gt;
                  &lt;socket-binding http="management-http"/&gt;
              &lt;/http-interface&gt;
          &lt;/management-interfaces&gt;
          &lt;access-control provider="simple"&gt;
              &lt;role-mapping&gt;
                  &lt;role name="SuperUser"&gt;
                      &lt;include&gt;
                          &lt;user name="$local"/&gt;
                      &lt;/include&gt;
                  &lt;/role&gt;
              &lt;/role-mapping&gt;
          &lt;/access-control&gt;
      &lt;/management&gt;
  
      &lt;profile&gt;
          &lt;subsystem xmlns="urn:jboss:domain:logging:2.0"&gt;
              &lt;console-handler name="CONSOLE"&gt;
                  &lt;level name="INFO"/&gt;
                  &lt;formatter&gt;
                      &lt;named-formatter name="COLOR-PATTERN"/&gt;
                  &lt;/formatter&gt;
              &lt;/console-handler&gt;
              &lt;periodic-rotating-file-handler name="FILE" autoflush="true"&gt;
                  &lt;formatter&gt;
                      &lt;named-formatter name="PATTERN"/&gt;
                  &lt;/formatter&gt;
                  &lt;file relative-to="jboss.server.log.dir" path="server.log"/&gt;
                  &lt;suffix value=".yyyy-MM-dd"/&gt;
                  &lt;append value="true"/&gt;
              &lt;/periodic-rotating-file-handler&gt;
              &lt;logger category="com.arjuna"&gt;
                  &lt;level name="WARN"/&gt;
              &lt;/logger&gt;
              &lt;logger category="org.apache.tomcat.util.modeler"&gt;
                  &lt;level name="WARN"/&gt;
              &lt;/logger&gt;
              &lt;logger category="org.jboss.as.config"&gt;
                  &lt;level name="DEBUG"/&gt;
              &lt;/logger&gt;
              &lt;logger category="sun.rmi"&gt;
                  &lt;level name="WARN"/&gt;
              &lt;/logger&gt;
              &lt;logger category="jacorb"&gt;
                  &lt;level name="WARN"/&gt;
              &lt;/logger&gt;
              &lt;logger category="jacorb.config"&gt;
                  &lt;level name="ERROR"/&gt;
              &lt;/logger&gt;
              &lt;root-logger&gt;
                  &lt;level name="INFO"/&gt;
                  &lt;handlers&gt;
                      &lt;handler name="CONSOLE"/&gt;
                      &lt;handler name="FILE"/&gt;
                  &lt;/handlers&gt;
              &lt;/root-logger&gt;
              &lt;formatter name="PATTERN"&gt;
                  &lt;pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/&gt;
              &lt;/formatter&gt;
              &lt;formatter name="COLOR-PATTERN"&gt;
                  &lt;pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/&gt;
              &lt;/formatter&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:batch:1.0"&gt;
              &lt;job-repository&gt;
                  &lt;in-memory/&gt;
              &lt;/job-repository&gt;
              &lt;thread-pool&gt;
                  &lt;max-threads count="10"/&gt;
                  &lt;keepalive-time time="30" unit="seconds"/&gt;
              &lt;/thread-pool&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:datasources:2.0"&gt;
              &lt;datasources&gt;
                  &lt;datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true"&gt;
                      &lt;connection-url&gt;jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE&lt;/connection-url&gt;
                      &lt;driver&gt;h2&lt;/driver&gt;
                      &lt;security&gt;
                          &lt;user-name&gt;sa&lt;/user-name&gt;
                          &lt;password&gt;sa&lt;/password&gt;
                      &lt;/security&gt;
                  &lt;/datasource&gt;
                  &lt;datasource jta="true" jndi-name="java:jboss/datasources/TBPDS" pool-name="TBPDS" enabled="true" use-ccm="true"&gt;
                      &lt;connection-url&gt;jdbc:postgresql://localhost:5432/bank&lt;/connection-url&gt;
                      &lt;driver-class&gt;org.postgresql.Driver&lt;/driver-class&gt;
                      &lt;driver&gt;postgresql-9.4-1201.jdbc4.jar&lt;/driver&gt;
                      &lt;security&gt;
                          &lt;user-name&gt;bank&lt;/user-name&gt;
                          &lt;password&gt;bank&lt;/password&gt;
                      &lt;/security&gt;
                      &lt;validation&gt;
                          &lt;validate-on-match&gt;false&lt;/validate-on-match&gt;
                          &lt;background-validation&gt;false&lt;/background-validation&gt;
                      &lt;/validation&gt;
                      &lt;timeout&gt;
                          &lt;set-tx-query-timeout&gt;false&lt;/set-tx-query-timeout&gt;
                          &lt;blocking-timeout-millis&gt;0&lt;/blocking-timeout-millis&gt;
                          &lt;idle-timeout-minutes&gt;0&lt;/idle-timeout-minutes&gt;
                          &lt;query-timeout&gt;0&lt;/query-timeout&gt;
                          &lt;use-try-lock&gt;0&lt;/use-try-lock&gt;
                          &lt;allocation-retry&gt;0&lt;/allocation-retry&gt;
                          &lt;allocation-retry-wait-millis&gt;0&lt;/allocation-retry-wait-millis&gt;
                      &lt;/timeout&gt;
                      &lt;statement&gt;
                          &lt;share-prepared-statements&gt;false&lt;/share-prepared-statements&gt;
                      &lt;/statement&gt;
                  &lt;/datasource&gt;
                  &lt;drivers&gt;
                      &lt;driver name="h2" module="com.h2database.h2"&gt;
                          &lt;xa-datasource-class&gt;org.h2.jdbcx.JdbcDataSource&lt;/xa-datasource-class&gt;
                      &lt;/driver&gt;
                  &lt;/drivers&gt;
              &lt;/datasources&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0"&gt;
              &lt;deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:ee:2.0"&gt;
              &lt;spec-descriptor-property-replacement&gt;false&lt;/spec-descriptor-property-replacement&gt;
              &lt;concurrent&gt;
                  &lt;context-services&gt;
                      &lt;context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/&gt;
                  &lt;/context-services&gt;
                  &lt;managed-thread-factories&gt;
                      &lt;managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/&gt;
                  &lt;/managed-thread-factories&gt;
                  &lt;managed-executor-services&gt;
                      &lt;managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-threshold="60000" core-threads="5" max-threads="25" keepalive-time="5000"/&gt;
                  &lt;/managed-executor-services&gt;
                  &lt;managed-scheduled-executor-services&gt;
                      &lt;managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" core-threads="2" keepalive-time="3000"/&gt;
                  &lt;/managed-scheduled-executor-services&gt;
              &lt;/concurrent&gt;
              &lt;default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection-factory="java:jboss/DefaultJMSConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:ejb3:2.0"&gt;
              &lt;session-bean&gt;
                  &lt;stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/&gt;
                  &lt;singleton default-access-timeout="5000"/&gt;
              &lt;/session-bean&gt;
              &lt;pools&gt;
                  &lt;bean-instance-pools&gt;
                      &lt;strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/&gt;
                      &lt;strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/&gt;
                  &lt;/bean-instance-pools&gt;
              &lt;/pools&gt;
              &lt;caches&gt;
                  &lt;cache name="simple"/&gt;
                  &lt;cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/&gt;
              &lt;/caches&gt;
              &lt;passivation-stores&gt;
                  &lt;passivation-store name="infinispan" cache-container="ejb" max-size="10000"/&gt;
              &lt;/passivation-stores&gt;
              &lt;async thread-pool-name="default"/&gt;
              &lt;timer-service thread-pool-name="default" default-data-store="default-file-store"&gt;
                  &lt;data-stores&gt;
                      &lt;file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/&gt;
                  &lt;/data-stores&gt;
              &lt;/timer-service&gt;
              &lt;remote connector-ref="http-remoting-connector" thread-pool-name="default"/&gt;
              &lt;thread-pools&gt;
                  &lt;thread-pool name="default"&gt;
                      &lt;max-threads count="10"/&gt;
                      &lt;keepalive-time time="100" unit="milliseconds"/&gt;
                  &lt;/thread-pool&gt;
              &lt;/thread-pools&gt;
              &lt;default-security-domain value="other"/&gt;
              &lt;default-missing-method-permissions-deny-access value="true"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:io:1.1"&gt;
              &lt;worker name="default"/&gt;
              &lt;buffer-pool name="default"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:infinispan:2.0"&gt;
              &lt;cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan"&gt;
                  &lt;local-cache name="passivation" batching="true"&gt;
                      &lt;file-store passivation="true" purge="false"/&gt;
                  &lt;/local-cache&gt;
                  &lt;local-cache name="persistent" batching="true"&gt;
                      &lt;file-store passivation="false" purge="false"/&gt;
                  &lt;/local-cache&gt;
              &lt;/cache-container&gt;
              &lt;cache-container name="ejb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan" aliases="sfsb"&gt;
                  &lt;local-cache name="passivation" batching="true"&gt;
                      &lt;file-store passivation="true" purge="false"/&gt;
                  &lt;/local-cache&gt;
                  &lt;local-cache name="persistent" batching="true"&gt;
                      &lt;file-store passivation="false" purge="false"/&gt;
                  &lt;/local-cache&gt;
              &lt;/cache-container&gt;
              &lt;cache-container name="hibernate" default-cache="local-query" module="org.hibernate"&gt;
                  &lt;local-cache name="entity"&gt;
                      &lt;transaction mode="NON_XA"/&gt;
                      &lt;eviction strategy="LRU" max-entries="10000"/&gt;
                      &lt;expiration max-idle="100000"/&gt;
                  &lt;/local-cache&gt;
                  &lt;local-cache name="local-query"&gt;
                      &lt;transaction mode="NONE"/&gt;
                      &lt;eviction strategy="LRU" max-entries="10000"/&gt;
                      &lt;expiration max-idle="100000"/&gt;
                  &lt;/local-cache&gt;
                  &lt;local-cache name="timestamps"&gt;
                      &lt;transaction mode="NONE"/&gt;
                      &lt;eviction strategy="NONE"/&gt;
                  &lt;/local-cache&gt;
              &lt;/cache-container&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/&gt;
          &lt;subsystem xmlns="urn:jboss:domain:jca:2.0"&gt;
              &lt;archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/&gt;
              &lt;bean-validation enabled="true"/&gt;
              &lt;default-workmanager&gt;
                  &lt;short-running-threads&gt;
                      &lt;core-threads count="50"/&gt;
                      &lt;queue-length count="50"/&gt;
                      &lt;max-threads count="50"/&gt;
                      &lt;keepalive-time time="10" unit="seconds"/&gt;
                  &lt;/short-running-threads&gt;
                  &lt;long-running-threads&gt;
                      &lt;core-threads count="50"/&gt;
                      &lt;queue-length count="50"/&gt;
                      &lt;max-threads count="50"/&gt;
                      &lt;keepalive-time time="10" unit="seconds"/&gt;
                  &lt;/long-running-threads&gt;
              &lt;/default-workmanager&gt;
              &lt;cached-connection-manager/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:jdr:1.0"/&gt;
          &lt;subsystem xmlns="urn:jboss:domain:jmx:1.3"&gt;
              &lt;expose-resolved-model/&gt;
              &lt;expose-expression-model/&gt;
              &lt;remoting-connector/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:jpa:1.1"&gt;
              &lt;jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:jsf:1.0"/&gt;
          &lt;subsystem xmlns="urn:jboss:domain:mail:2.0"&gt;
              &lt;mail-session name="default" jndi-name="java:jboss/mail/Default"&gt;
                  &lt;smtp-server outbound-socket-binding-ref="mail-smtp"/&gt;
              &lt;/mail-session&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:naming:2.0"&gt;
              &lt;remote-naming/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:pojo:1.0"/&gt;
          &lt;subsystem xmlns="urn:jboss:domain:remoting:2.0"&gt;
              &lt;endpoint worker="default"/&gt;
              &lt;http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:resource-adapters:2.0"/&gt;
          &lt;subsystem xmlns="urn:jboss:domain:sar:1.0"/&gt;
          &lt;subsystem xmlns="urn:jboss:domain:security:1.2"&gt;
              &lt;security-domains&gt;
                  &lt;security-domain name="other" cache-type="default"&gt;
                      &lt;authentication&gt;
                          &lt;login-module code="Remoting" flag="optional"&gt;
                              &lt;module-option name="password-stacking" value="useFirstPass"/&gt;
                          &lt;/login-module&gt;
                          &lt;login-module code="RealmDirect" flag="required"&gt;
                              &lt;module-option name="password-stacking" value="useFirstPass"/&gt;
                          &lt;/login-module&gt;
                      &lt;/authentication&gt;
                  &lt;/security-domain&gt;
                  &lt;security-domain name="jboss-web-policy" cache-type="default"&gt;
                      &lt;authorization&gt;
                          &lt;policy-module code="Delegating" flag="required"/&gt;
                      &lt;/authorization&gt;
                  &lt;/security-domain&gt;
                  &lt;security-domain name="jboss-ejb-policy" cache-type="default"&gt;
                      &lt;authorization&gt;
                          &lt;policy-module code="Delegating" flag="required"/&gt;
                      &lt;/authorization&gt;
                  &lt;/security-domain&gt;
              &lt;/security-domains&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:transactions:2.0"&gt;
              &lt;core-environment&gt;
                  &lt;process-id&gt;
                      &lt;uuid/&gt;
                  &lt;/process-id&gt;
              &lt;/core-environment&gt;
              &lt;recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:undertow:1.2"&gt;
              &lt;buffer-cache name="default"/&gt;
              &lt;server name="default-server"&gt;
                  &lt;http-listener name="default" socket-binding="http"/&gt;
                  &lt;host name="default-host" alias="localhost"&gt;
                      &lt;location name="/" handler="welcome-content"/&gt;
                      &lt;filter-ref name="server-header"/&gt;
                      &lt;filter-ref name="x-powered-by-header"/&gt;
                  &lt;/host&gt;
              &lt;/server&gt;
              &lt;servlet-container name="default"&gt;
                  &lt;jsp-config/&gt;
                  &lt;websockets/&gt;
              &lt;/servlet-container&gt;
              &lt;handlers&gt;
                  &lt;file name="welcome-content" path="${jboss.home.dir}/welcome-content"/&gt;
              &lt;/handlers&gt;
              &lt;filters&gt;
                  &lt;response-header name="server-header" header-name="Server" header-value="WildFly/8"/&gt;
                  &lt;response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/&gt;
              &lt;/filters&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:webservices:1.2"&gt;
              &lt;wsdl-host&gt;${jboss.bind.address:127.0.0.1}&lt;/wsdl-host&gt;
              &lt;endpoint-config name="Standard-Endpoint-Config"/&gt;
              &lt;endpoint-config name="Recording-Endpoint-Config"&gt;
                  &lt;pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM"&gt;
                      &lt;handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/&gt;
                  &lt;/pre-handler-chain&gt;
              &lt;/endpoint-config&gt;
              &lt;client-config name="Standard-Client-Config"/&gt;
          &lt;/subsystem&gt;
          &lt;subsystem xmlns="urn:jboss:domain:weld:2.0"/&gt;
      &lt;/profile&gt;
  
      &lt;interfaces&gt;
          &lt;interface name="management"&gt;
              &lt;inet-address value="${jboss.bind.address.management:127.0.0.1}"/&gt;
          &lt;/interface&gt;
          &lt;interface name="public"&gt;
              &lt;inet-address value="${jboss.bind.address:127.0.0.1}"/&gt;
          &lt;/interface&gt;
          &lt;interface name="unsecure"&gt;
              &lt;inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/&gt;
          &lt;/interface&gt;
      &lt;/interfaces&gt;
  
      &lt;socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"&gt;
          &lt;socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/&gt;
          &lt;socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/&gt;
          &lt;socket-binding name="ajp" port="${jboss.ajp.port:8009}"/&gt;
          &lt;socket-binding name="http" port="${jboss.http.port:8080}"/&gt;
          &lt;socket-binding name="https" port="${jboss.https.port:8443}"/&gt;
          &lt;socket-binding name="txn-recovery-environment" port="4712"/&gt;
          &lt;socket-binding name="txn-status-manager" port="4713"/&gt;
          &lt;outbound-socket-binding name="mail-smtp"&gt;
              &lt;remote-destination host="localhost" port="25"/&gt;
          &lt;/outbound-socket-binding&gt;
      &lt;/socket-binding-group&gt;
  
      &lt;deployments&gt;
          &lt;deployment name="postgresql" runtime-name="postgresql-9.4-1201.jdbc4.jar"&gt;
              &lt;content sha1="b46544ef0eaf0405504089dcc71f36e3f190ef09"/&gt;
          &lt;/deployment&gt;
          &lt;deployment name="wildfly-ejb-in-ear-ear.ear" runtime-name="wildfly-ejb-in-ear-ear.ear"&gt;
              &lt;content sha1="eee0b026b1fac8c09a35bc0ef318a237d8d47c6e"/&gt;
          &lt;/deployment&gt;
      &lt;/deployments&gt;
  &lt;/server&gt;
  </code></pre>