Deploying the EAR module

In this section, we will build and deploy the application EAR module to the WildFly 8.x server. The pom.xml for the jboss-ejb3 Maven project specifies three modules: jboss-ejb3-ejb, jboss-ejb3-web, and jboss-ejb3-ear:

<modules>
  <module>jboss-ejb3-ejb</module>
  <module>jboss-ejb3-web</module>
  <module>jboss-ejb3-ear</module>
</modules>

Specify the JBoss AS version as 8.1.0.Final:

<version.jboss.as>8.1.0.Final</version.jboss.as>

The pom.xml for the jboss-ejb3 project specifies dependency on the jboss-ejb3-web and jboss-ejb3-ejb artifacts:

<dependency>
  <groupId>org.jboss.ejb3</groupId>
  <artifactId>jboss-ejb3-ejb</artifactId>
  <version>${project.version}</version>
  <type>ejb</type>
</dependency>
<dependency>
  <groupId>org.jboss.ejb3</groupId>
  <artifactId>jboss-ejb3-web</artifactId>
  <version>${project.version}</version>
  <type>war</type>
  <scope>compile</scope>
</dependency>

Next, we will build and deploy the EAR module to WildFly 8.x while the server is running. Right-click on pom.xml for the jboss-ejb3 Maven project and select Run As | Maven install, as shown in the following screenshot:

Deploying the EAR module

As the output from the pom.xml indicates all the three modules: ejb, web, and ear get built. The ear module gets copied to the deployments directory in WildFly 8.x:

Deploying the EAR module

Start the WildFly 8.x server if not already started. The jboss-ejb3.ear file gets deployed to the WildFly 8.x server and the jboss-ejb3-web context gets registered. The jboss-ejb3.ear.deployed file gets generated in the deployments directory, as shown in the following screenshot:

Deploying the EAR module

The EntityManager em persistence unit gets registered and the JNDI bindings for the CatalogSessionBeanFacade session bean gets generated:

Starting Persistence Unit (phase 1 of 2) Service 'jboss-ejb3-ear.ear/jboss-e
jb3-ejb.jar#em'
12:30:32,047 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Th
read Pool -- 50) HHH000204: Processing PersistenceUnitInfo [
  name: em
...]

The MySQL database tables for the entities get created, as shown in the following screenshot:

Deploying the EAR module

To log in to the WildFly 8 administration console, open http://localhost:8080 in any web browser. Click on the Administration Console link. Specify User Name and Password and click on Log In. Select the Runtime tab. The jboss-ejb3.ear application is listed as deployed in the Deployments | Manage Deployments section:

Deploying the EAR module
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset