Bookmark this page

Guided Exercise: Deploying Applications with Management Tools

Deploy two applications by using the management tools provided by JBoss EAP 7.

Resources
Files: /home/student/AD248/labs/deploying-standalone
Application URL: http://localhost:18080/example http://localhost:18080/version

Outcomes

You should be able to deploy an application using the management console and using the management CLI.

Before beginning the guided exercise, run the following command to prepare the environment, and to copy the files for the exercise:

[student@workstation ~]$ lab start deploying-standalone

Instructions

  1. Deploy using the management console

    1. Open a terminal window from the workstation machine, and run the following commands to start the Red Hat JBoss Enterprise Application Platform (JBoss EAP) server using the /home/student/AD248/labs/deploying-standalone/standalone-instance as the base directory:

      [student@workstation ~]$ cd /opt/jboss-eap-7.4/bin
      [student@workstation bin]$ ./standalone.sh \
      -Djboss.server.base.dir=/home/student/AD248/labs\
      /deploying-standalone/standalone-instance/

      Note

      The standalone.xml file from the base directory contains a port-offset set to 10000. Thus, the management console is available at port 19990, and the deployed applications are available at port 18080.

    2. Navigate to http://localhost:19990 to access the management console page, using admin as username and redhat123 as the password.

    3. Click Deployments in the navigation menu bar. You do not have anything deployed yet, so the list of deployments is empty.

    4. Click the plus sign icon, and select the Upload Deployment option.

    5. Click Choose a file or drag it here and select the kitchensink.war file, located in your /home/student/AD248/labs/deploying-standalone directory. Click Next.

    6. You can use the default values or you can change the name and runtime name of the deployment.

    7. Click Finish and then Close to complete the wizard. You should now see kitchensink.war in the list of deployments.

    8. Inspect the terminal window of your running JBoss EAP instance. You should see an output similar to the following:

      ...output omitted...
      03:21:09,978 INFO  [org.jboss.as.repository] (External Management Request Threads -- 1) WFLYDR0001: Content added at location /home/student/AD248/labs/deploying-standalone/standalone-instance/data/content/f9/418ea27525e0f3c02ea099405265246b22b55a/content
      03:21:10,034 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "kitchensink.war" (runtime-name: "kitchensink.war")
      ...output omitted...
      03:21:15,268 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 77) WFLYUT0021: Registered web context: '/kitchensink' for server 'default-server'
      03:21:15,365 INFO  [org.jboss.as.server] (External Management Request Threads -- 1) WFLYSRV0010: Deployed "kitchensink.war" (runtime-name : "kitchensink.war")
    9. Navigate to http://localhost:18080/kitchensink. The kitchensink.war application is an example of a Jakarta EE 8 web-enabled database application using JSF, CDI, EJB, JPA, and Bean Validation.

    10. Open the /home/student/AD248/labs/deploying-standalone/standalone-instance/configuration/standalone.xml file to inspect its contents. You should see a <deployments> section at the end of this file that contains your kitchensink.war deployment:

      <deployments>
        <deployment name="kitchensink.war" runtime-name="kitchensink.war">
          <content sha1="f9418ea27525e0f3c02ea099405265246b22b55a"/>
        </deployment>
      </deployments>
    11. Navigate to the /home/student/AD248/labs/deploying-standalone/standalone-instance/data/content directory.

      This directory contains child directories that are responsible for persisting all the applications that were deployed using the management tools provided by JBoss EAP. You can identify each deployment using the SHA1 hash code provided in the standalone.xml file. The first level of the directory contains a subdirectory named using the first and the second character from the hash code. This directory contains another subdirectory named using the rest of the SHA1 code, and finally a content binary file, which is the application WAR file.

      [student@workstation ~]$ cd /home/student/AD248/labs/deploying-standalone\
      /standalone-instance/data/content
      [student@workstation content]$ tree
      .
      └── f9
          └── 418ea27525e0f3c02ea099405265246b22b55a
              └── content
      ...output omitted...
  2. Disable the deployment by using the management console.

    1. You can disable a deployment to undeploy the application without removing it from the server. Go back to the Deployments page of the management console.

    2. Click kitchensink.war application. In the page that shows in the right, click Disable. The application status changes to STOPPED.

    3. Look in the terminal window of your running instance of JBoss EAP. You should see an output similar to the following:

      06:02:06,274 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 75) WFLYUT0022: Unregistered web context: '/kitchensink' from server 'default-server'
      06:02:06,405 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 75) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'kitchensink.war#primary'
      06:02:06,406 INFO  [org.hibernate.tool.schema.internal.SchemaDropperImpl$DelayedDropActionImpl] (ServerService Thread Pool -- 75) HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
      06:02:06,438 INFO  [org.hibernate.orm.beans] (ServerService Thread Pool -- 75) HHH10005004: Stopping BeanContainer : org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl@6cfb1114
      06:02:06,454 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 77) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'kitchensink.war#primary'
      06:02:06,466 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0010: Unbound data source [java:jboss/datasources/KitchensinkQuickstartDS]
      06:02:06,521 INFO  [org.infinispan.manager.DefaultCacheManager] (ServerService Thread Pool -- 77) Stopping cache manager null on null
      06:02:06,533 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0028: Stopped deployment kitchensink.war (runtime-name: kitchensink.war) in 283ms
      06:02:06,583 INFO  [org.jboss.as.server] (External Management Request Threads -- 1) WFLYSRV0009: Undeployed "kitchensink.war" (runtime-name: "kitchensink.war")

      The application, and all the services that the application server provides to it, stop.

    4. Reload the http://localhost:18080/kitchensink URL in your browser. You get an HTTP 404 error.

  3. Deploy the application by using the management CLI.

    1. Open a new terminal window and start the management CLI by running the jboss-cli.sh script in the bin directory of JBoss EAP.

      [student@workstation ~]$ cd /opt/jboss-eap-7.4/bin
      [student@workstation bin]$ ./jboss-cli.sh --connect --controller=localhost:19990
    2. You can deploy applications by using the deploy command, and passing the location of the file to deploy:

      [standalone@localhost:19990 /] deploy \
      /home/student/AD248/labs/deploying-standalone/temperature-converter.war
    3. Look in the terminal window of your running instance of JBoss EAP. You should see output similar to the following:

      06:09:28,737 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "temperature-converter.war" (runtime-name: "temperature-converter.war")
      06:09:28,848 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) WFLYWELD0003: Processing weld deployment temperature-converter.war
      06:09:28,866 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-1) WFLYEJB0473: JNDI bindings for session bean named 'TemperatureConvertEJB' in deployment unit 'deployment "temperature-converter.war"' are as follows:
      
      	java:global/temperature-converter/TemperatureConvertEJB!org.jboss.as.quickstarts.temperatureconverter.ejb.TemperatureConvertEJB
      	java:app/temperature-converter/TemperatureConvertEJB!org.jboss.as.quickstarts.temperatureconverter.ejb.TemperatureConvertEJB
      	java:module/TemperatureConvertEJB!org.jboss.as.quickstarts.temperatureconverter.ejb.TemperatureConvertEJB
      	java:global/temperature-converter/TemperatureConvertEJB
      	java:app/temperature-converter/TemperatureConvertEJB
      	java:module/TemperatureConvertEJB
      
      06:09:28,965 WARN  [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!
      06:09:29,126 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 80) Initializing Mojarra 2.3.14.SP06 for context '/temperature-converter'
      06:09:29,190 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 80) WFLYUT0021: Registered web context: '/temperature-converter' for server 'default-server'
      06:09:29,226 INFO  [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0010: Deployed "temperature-converter.war" (runtime-name : "temperature-converter.war")
    4. Navigate to http://localhost:18080/temperature-converter. The temperature-converter application displays a tool to convert from Fahrenheit temperatures scale to Celsius scale.

  4. Disable the deployment by using the management CLI.

    1. You can disable an application by using the management CLI tool. List the available applications by using the following commands:

      [standalone@localhost:19990 /] cd /deployment
      [standalone@localhost:19990 deployment] ls
      kitchensink.war temperature-converter.war
    2. Disable the deployment by using the undeploy operation:

      [standalone@localhost:19990 deployment] ./temperature-converter.war:undeploy
    3. Look in the terminal window of your running instance of JBoss EAP. You should see an output similar to the following:

      06:12:55,149 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 80) WFLYUT0022: Unregistered web context: '/temperature-converter' from server 'default-server'
      06:12:55,178 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0028: Stopped deployment temperature-converter.war (runtime-name: temperature-converter.war) in 32ms
      06:12:55,204 INFO  [org.jboss.as.repository] (management-handler-thread - 2) WFLYDR0002: Content removed from location /home/student/AD248/labs/deploying-standalone/standalone-instance/data/content/55/5df23b973ed9f76f7c817deec3bab6a13a7ea3/content
      06:12:55,204 INFO  [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0009: Undeployed "temperature-converter.war" (runtime-name: "temperature-converter.war")
    4. Reload the http://localhost:18080/temperature-converter URL in your browser. You get an HTTP 404 error.

    5. Use the redeploy operation to enable the deployment again:

      [standalone@localhost:19990 deployment] ./temperature-converter.war:redeploy
    6. Reload the http://localhost:18080/temperature-converter URL in your browser. The temperature-converter application shows.

  5. Clean up

    1. Remove the kitchensink.war application:

      [standalone@localhost:19990 /] /deployment=kitchensink.war:remove
    2. Remove the temperature-converter.war application:

      [standalone@localhost:19990 /] /deployment=temperature-converter.war:remove
    3. Exit the management CLI tool:

      [standalone@localhost:19990 /] exit
    4. Stop the instance of JBoss EAP by pressing Ctrl+C in the terminal window that is running the instance.

Finish

On the workstation machine, use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish deploying-standalone

Revision: ad248-7.4-18a9db2