Configure a standalone server and deploy the greeter application by using the management CLI tool.
| Resources | |
|---|---|
| File: |
/home/student/AD248/labs/deploying-review/greeter.war
|
| Directory: |
/home/student/AD248/labs/deploying-review/standalone-instance
|
| Application URLs: |
http://localhost:8081 - http://localhost:8081/greeter
|
Outcomes
You should be able to configure the standalone server and deploy an application using the management CLI.
Before beginning the guided exercise, run the following command to prepare the environment, and to copy the exercise files:
[student@workstation ~]$ lab start deploying-review
A new service is going to be installed in the operating system by the system administrator.
This service uses the 8080 port.
To avoid port conflicts you change the server instance to be available at the 8081 port.
Furthermore, the logging level is too verbose, and the system administrator requests you to lower the verbosity level.
The Red Hat JBoss Enterprise Application Platform (JBoss EAP) standalone instance is at the /home/student/AD248/labs/deploying-review/standalone-instance directory.
Instructions
Start a JBoss EAP standalone server using the /home/student/AD248/labs/deploying-review/standalone-instance path as the base directory.
Wait for the server to finish the start process before proceeding.
Verify the server is running by accessing the management console at http://localhost:9990.
Use admin as the username, and redhat123 as the password.
By default, the applications deployed on JBoss EAP are available on the 8080 port.
However, the 8080 port is in use by another service, and it conflicts with the JBoss EAP port responsible for providing access to web applications.
In this step, change only the web application port to be served at 8081.
This port is defined in a socket-binding named http.
This socket-binding is available in a socket-binding-group named standard-sockets.
Using the management CLI, discover the attribute responsible for defining the default port and change its value to 8081.
Open a new terminal window and connect to the management CLI using localhost as the server name, and 9990 as the port.
[student@workstation ~]$cd /opt/jboss-eap-7.4/bin[student@workstation bin]$./jboss-cli.sh -c
Navigate to the standard-sockets in the socket-binding-group DMR node tree:
[standalone@localhost:9990 /] cd /socket-binding-group=standard-socketsNavigate to the socket-binding named http:
[standalone@localhost:9990 socket-binding-group=standard-sockets]cd \socket-binding=http
Change the port attribute to 8081:
[standalone@localhost:9990 socket-binding=http]:write-attribute\(name=port,value=8081){ "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
Read the resource properties of the http socket binding:
[standalone@localhost:9990 socket-binding=http]:read-resource{ "outcome" => "success", "result" => { "client-mappings" => undefined, "fixed-port" => false, "interface" => undefined, "multicast-address" => undefined, "multicast-port" => undefined, "name" => "http","port" => 8081}, "response-headers" => {"process-state" => "reload-required"} }
You must reload the server to start listening on the 8081 port.
Return to the root DMR node of the JBoss EAP configuration, and use the reload operation:
[standalone@localhost:9990 socket-binding=http]cd /[standalone@localhost:9990 /]:reload{ "outcome" => "success", "result" => undefined }
Open a web browser and point it to http://localhost:8081 to test the new port.
Change the log level
The running standalone server is configured to display debug messages in the CONSOLE handler.
The logging output was huge and the system administrator requests you to decrease the amount of logging.
Change the level of this console handler to INFO by using the management CLI:
Navigate to the console-handler named CONSOLE in the logging subsystem:
[standalone@localhost:9990 /] cd /subsystem=logging/console-handler=CONSOLEChange the level to INFO:
[standalone@localhost:9990 console-handler=CONSOLE]:write-attribute\(name=level,value=INFO){"outcome" => "success"}
Read the resource properties of the CONSOLE
console handler:
[standalone@localhost:9990 console-handler=CONSOLE]:read-resource{ "outcome" => "success", "result" => { "autoflush" => true, "enabled" => true, "encoding" => undefined, "filter" => undefined, "filter-spec" => undefined, "formatter" => "%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n","level" => "INFO", "name" => "CONSOLE", "named-formatter" => "COLOR-PATTERN", "target" => "System.out" } }
Deploy the greeter application.
The greeter application demonstrates the use of CDI, JPA, JTA, EJB and JSF in JBoss EAP.
Deploy the application by using the management CLI.
The greeter.war application file is available in the /home/student/AD248/labs/deploying-review directory.
Return to the root DMR node of the JBoss EAP configuration, and then deploy the application by using the deploy command:
[standalone@localhost:9990 console-handler=CONSOLE]cd /[standalone@localhost:9990 /]deploy \/home/student/AD248/labs/deploying-review/greeter.war
Inspect the terminal window of your JBoss EAP running instance. You should see output similar to the following:
02:53:10,230 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027:Starting deployment of "greeter.war" (runtime-name: "greeter.war")02:53:10,762 INFO [org.jboss.as.jpa] (MSC service thread 1-1) WFLYJPA0002: Read persistence.xml for primary ...output omitted... 02:53:14,586 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 76) WFLYUT0021: Registered web context: '/greeter' for server 'default-server' 02:53:14,626 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010:Deployed "greeter.war" (runtime-name : "greeter.war")
Open a web browser and navigate to http://localhost:8081/greeter.
Stop the JBoss EAP instance by pressing Ctrl+C in the terminal window that is running JBoss EAP.
Exit from the CLI tool:
[standalone@localhost:9990 /] exitRun the following command to grade your work on this laboratory:
[student@workstation ~]$ lab grade deploying-review