Application Implementation and Deployment
This chapter describes how to write Jakarta EE application files (EAR files) and deploy them on JEUS. It also explains how to deploy applications and handle related jobs by using tools provided by JEUS.
1. Application Implementation
This section describes how to write a Jakarta EE application, which includes the already created modules from the previous sections, using the 'jar' utility.
Before writing an EAR file, create modules that need to be included in the file. The modules can be EJB modules (JAR files), web application modules (war files), application client modules (JAR files), or resource adapter modules (rar files). For information about how to create each module, refer to their relevant guides.
Descriptions of myApp.ear, the application shown in this section, are as follows:
-
myApp.ear is an EAR file which includes the EJB module ejb.jar, the web application module web.war, and the application client module appclient.jar.
-
myApp.ear must be installed on the Master Server adminServer, and then deployed on the server named 'server1'.
The following is the process of creating an application.
-
Write modules to be included in the EAR file.
-
Create the META-INF directory, where the directory, which includes JAR, WAR, and RAR files, resides.
-
Create application.xml file, which includes the modules of the EAR file and copy it to the META-INF directory.
<application.xml><?xml version="1.0" encoding="UTF-8"?> <application version="9" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/application_9.xsd"> <description>Application description</description> <display-name>Sample application</display-name> <module> <ejb>ejb.jar</ejb> </module> <module> <web> <web-uri>web.war</web-uri> <context-root>hello</context-root> </web> </module> <module> <java>appclient.jar</java> </module> </application>
-
Run the following command using the jar utility to create the myApp.ear file.
> jar cf myApp.ear ejb.jar web.war appclient.jar META-INF
Use only upper cases for the name of the META-INF directory. If a lowercase is used, an error will occur.
2. Deployment Commands
Deployment tools provided in JEUS support the following jobs.
Item | Description |
---|---|
distribute |
Copies application files to the target servers or clusters and prepares to run the application. If the distribution job fails in one or more target servers or clusters, the entire job will fail, and application files will be undeployed from all successful servers. |
deploy |
Copies application files to the target servers or clusters and prepares to run the application. If the distribution job fails in one or more target servers or clusters, the entire job will fail, and application files will be undeployed from all successful servers. Even if the start job fails in one or more servers, it is regarded as successful, if there are one or more servers where the application can run. |
start |
Starts applications that have been distributed on the target servers. Even if the start job fails in one or more servers, it is regarded as successful, if there are one or more servers where the application can run. |
stop |
Suspends the running applications deployed on the target servers. The applications are not removed from the target servers, and can be started or redeployed using the application name. |
undeploy |
Stops running the applications deployed on the target servers. The applications are removed from the target servers. |
redeploy |
Updates and redeploys the applications, when currently running applications are modified. If one or more applications fail to be redeployed, all applications will be stopped. |
The following deployment jobs are available only in JEUS.
Task | Description |
---|---|
Add Application Target |
Adds specific servers or clusters as the targets of deployed or distributed applications. This expands the targets of the applications that are currently running. Targets can be multiple servers or clusters. If this job fails on one or more new targets, the applications will be undeployed from all the new targets, but not on the existing targets. |
Remove Application Target |
Removes specific servers or clusters from targets of deployed or distributed applications. It reduces the number of targets of the applications. Targets can be multiple servers or clusters. |
3. Controlling and Monitoring Applications
This chapter describes how to control and monitor applications.
3.1. Installing Applications on a Domain
The following is the process of installing an application on a domain.
Using the Console Tool
The install-application command installs an application into the domain and places it under INSTALL_HOME (DOMAIN_HOME/.applications). In this step, you need to specify the path to the application file to be installed. You can specify the application ID using the '-id' option.
If the application ID is not specified, JEUS automatically assigns an application ID. If the application file name is myApp.ear
, myApp_ear
becomes the application ID.
---------------------------------------------------------------- using install-application command for application install ---------------------------------------------------------------- [MASTER]domain1.adminServer>install-application -id myApp /usr/apphome/myApp.ear Successfully installed the application [myApp]. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+-------+----------+-----------+------------------------+ | Applicati|Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+-----------+-------+----------+-----------+------------------------+ | myApp | | INSTAL| | | ${INSTALL_HOME}/myApp/m| | | |LED | | |yApp.ear | +----------+-----------+-------+----------+-----------+------------------------+ ================================================================================
For more information about the uninstall-application command, see uninstall-application in JEUS Reference Guide.
3.2. Uninstalling Applications from a Domain
An application can be removed from a domain, if the application is no longer being used. Applications, in the INSTALLED or DEPLOYED states, can be uninstalled.
The following is the process of uninstalling an application from a domain.
Using the Console Tool
You can uninstall an application using the uninstall-application command. When running the command, you need to specify the application ID to uninstall.
[MASTER]domain1.adminServer>uninstall-application myApp uninstall the application for the application [myApp] succeeded. : Successfully deleted [myApp]. [MASTER]domain1.adminServer>application-info No applications exist in this domain. Application information for the domain [domain1]. ================================================================================ +------------+---------------+-------+------------+-------------+--------------+ | Application| Application | State | Server | Cluster | Application | | ID | Type | | Targets | Targets | Path | +------------+---------------+-------+------------+-------------+--------------+ (No data available) ================================================================================
3.3. Deploying Applications
An installed application can run using the deploy command. There are three ways to deploy applications.
Executing runtime deployment using a console tool assumes the following scenario.
-
MyApp.ear described in Application Implementation is used.
-
JEUS domain name is 'domain1,' and the name of the server where the application will be deployed is 'server1.'
For more information about the options available when executing the deploy-application command, see deploy-application in JEUS Reference Guide. |
JEUS provides three methods for runtime deployment through the console tool, according to the location where an application resides. Each method deploys an application in this order: deploy, stop, start, redeploy, and undeploy commands. After executing each command, applist is executed to check the status of the application in each step.
JEUS console tool can be used to connect to DAS to manage servers and clusters and deploy applications.
The following are console tool commands related to application deployment.
Command | Description |
---|---|
distribute-application |
Copies the application files to target servers or clusters, and prepares the application for service. |
deploy-application |
Distributes the application files to target servers or clusters, and starts the application. If an application is deployed successfully, it will be in the RUNNING state. If the application is distributed successfully, but cannot be started, it will remain in the DISTRIBUTED state. |
start-application |
Starts an application, that is in the DISTRIBUTED state. While this task is running, the application goes into the STARTING state. After the task has been completed successfully, the application goes into the RUNNING state. |
stop-application |
Stops an application in the RUNNING state. During this process, the application goes into the STOPPING state. When the task completes successfully, the application goes into the DISTRIBUTED state. |
redeploy-application |
Redeploys the application when a deployed application is modified. It executes each step in the same way as the deploy command. The status in each step also matches the status in each step of the deploy command. |
undeploy-application |
Stops running the applications deployed on the target servers. The applications are removed from the target servers. |
application-info |
Displays information about applications in a domain. |
add-application-target |
Adds a target for deployed applications. Servers and clusters can be the target. |
remove-application-target |
Removes a target for deployed applications. Servers and clusters can be the target. |
For a description of the console tool and detailed information about each command, see jeusadmin in JEUS Reference Guide. |
3.3.1. Deploying Applications Installed on a Domain
The following describes how to deploy an application installed on a domain.
Using the Console Tool
The install-application command installs an application into the domain and places it under the INSTALL_HOME (DOMAIN_HOME/.applications) directory. The application ID can be specified as an option.
When the ID is not specified, the application file name 'myApp_ear' becomes the application ID. After an application has been installed, it can be deployed on the target servers using the deploy-application command.
---------------------------------------------------------------- using deploy command for application with install application ---------------------------------------------------------------- [MASTER]domain1.adminServer>install-application -id myApp /usr/apphome/myApp.ear Successfully installed the application [myApp]. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+-------+----------+-----------+------------------------+ | Applicati|Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+-----------+-------+----------+-----------+------------------------+ | myApp | | INSTAL| | | ${INSTALL_HOME}/myApp/m| | | |LED | | |yApp.ear | +----------+-----------+-------+----------+-----------+------------------------+ ================================================================================ [MASTER]domain1.adminServer>deploy myApp -servers server1 deploy the application for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicati| Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myAp| | | | | | |p/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>stop-application myApp stop the application for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+--------+----------+----------+------------------------+ | Applicati|Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+-----------+--------+----------+----------+------------------------+ | myApp | EAR | DISTRIB| server1 | | ${INSTALL_HOME}/myApp/m| | | |UTED | | |yApp.ear | +----------+-----------+--------+----------+----------+------------------------+ ================================================================================ [MASTER]domain1.adminServer>start-application myApp start the application for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicati| Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myAp| | | | | | |p/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>redeploy-application myApp redeploy application on JEUS Master Server for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicati| Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myAp| | | | | | |p/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>undeploy myApp Undeploying [myApp] (This may take time due to graceful undeployment) .......... undeploy the application for the application [myApp] succeeded. successfully undeployed (elapsed = 415ms) [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+-------+----------+-----------+------------------------+ | Applicati|Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+-----------+-------+----------+-----------+------------------------+ | myApp | EAR | INSTAL| | | ${INSTALL_HOME}/myApp/m| | | |LED | | |yApp.ear | +----------+-----------+-------+----------+-----------+------------------------+ ================================================================================ [MASTER]domain1.adminServer>uninstall-application myApp uninstall the application for the application [myApp] succeeded. : Successfully deleted [myApp]. [MASTER]domain1.adminServer>application-info No applications exist in this domain. Application information for the domain [domain1]. ================================================================================ +------------+---------------+-------+------------+-------------+--------------+ | Application| Application | State | Server | Cluster | Application | | ID | Type | | Targets | Targets | Path | +------------+---------------+-------+------------+-------------+--------------+ (No data available) ================================================================================
3.3.2. Deploying Applications in an Application Repository
After adding an application repository, you can deploy the applications located in the repository. For information about how to add and delete application repositories, see Adding, Deleting, and Searching Application Repositories.
Using the Console Tool
The following is the process of deploying applications from an application repository using the console tool.
[MASTER]domain1.adminServer>add-application-repository /home/user1/apps Successfully performed the ADD operation for An application repository. Check the results using "add-application-repository or list-application-repositories" [MASTER]domain1.suok>list-application-repositories Application Repositories ================================================================================ +------------------------------------------------------------------------------+ | Path to Application Repository | +------------------------------------------------------------------------------+ | /home/user1/apps | +------------------------------------------------------------------------------+ ================================================================================ [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+-------+----------+-----------+------------------------+ | Applicati|Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+-----------+-------+----------+-----------+------------------------+ | exploded | | INSTAL| | | /home/user1/apps/explod| | | |LED | | |ed | +----------+-----------+-------+----------+-----------+------------------------+ ================================================================================ [MASTER]domain1.adminServer>deploy exploded -servers server1 deploy the application for the application [exploded.war] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicati| Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+------------+---------+----------+-----------+---------------------+ | exploded | WAR | RUNNING | server1 | | /home/user1/apps/exp| | | | | | |loded | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================
3.3.3. Deploying Applications by Specifying the Path
When a parent directory cannot be added as an application repository, the application can be deployed by specifying the path. For information about how to deploy an application, in a machine where the Master Server exists, using the absolute path, see Application Deployment by Specifying a Path.
Using the Console Tool
The following is the process of deploying an application using the console.
[MASTER]domain1.adminServer>deploy -path /home/user1/apps/myApp.ear -servers server1 deploy the application for the application [/home/user1/apps/myApp.ear] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +-----------+------------+---------+-----------+-----------+-------------------+ | Applicati |Application | State | Target | Target | Application Path | | on ID | Type | | Servers | Clusters | | +-----------+------------+---------+-----------+-----------+-------------------+ | myApp.ear | EAR | RUNNING | server1 | | /home/user1/apps/ | | | | | | |myApp.ear | +-----------+------------+---------+-----------+-----------+-------------------+ ================================================================================
3.4. Redeploying Applications
If you have modified an application, you can use the redeploy command to redeploy the application with the modifications applied.
Using the Console Tool
The following is the process of redeploying an application by using the console tool.
-
After modifying an application that has been installed in a domain, it needs to be newly installed. As the modified version replaces the previous version, you need to use the -f option when executing the install-application command.
When deploying the application by specifying the path, replace the previous application file in the specified path with the modified version.
[MASTER]domain1.adminServer>install-application -id myApp -f /home/user1/apps/myApp.ear Successfully installed the application [myApp].
-
Redeploy the application using the redeploy-application command. When executing the command, you must enter the ID of the application to redeploy.
[MASTER]domain1.adminServer>redeploy-application myApp redeploy application on JEUS Master Server for the application [myApp] succeeded.
For more information about the options available when executing the redeploy-application command, see redeploy-application in JEUS Reference Guide. |
3.5. Undeploying Applications
You can stop and undeploy an application in service by using the undeploy command. When undeploy is executed, the application is deleted from the domain.
Using the Console Tool
The following is the process of undeploying an application by using the console tool.
You can undeploy an application using the undeploy-application command. When entering the undeploy-application command, you must enter the application ID to undeploy.
[MASTER]domain1.adminServer>undeploy-application myApp Undeploying [myApp] (This may take time due to graceful undeployment) .......... undeploy the application for the application [myApp] succeeded. successfully undeployed (elapsed = 82ms) [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+-------+----------+-----------+------------------------+ | Applicat | Applicati | State | Target | Target | Application Path | | ion ID | on Type | | Servers | Clusters | | +----------+-----------+-------+----------+-----------+------------------------+ | myApp | EAR | INSTA | | | ${INSTALL_HOME}/myApp/ | | | |LLED | | |myApp.ear | +----------+-----------+-------+----------+-----------+------------------------+ ================================================================================ [MASTER]domain1.adminServer>
|
3.6. Starting Applications
Start an application to run, which is in the DISTRIBUTED status. An application can be in the DISTRIBUTED state, when it is deployed with the Only Distribute option. A running application goes into the DISTRIBUTED state, after it’s stopped by using the stop command.
Using the Console Tool
The following is the process to start an application in stopped state by using the console tool.
You can start an application by executing the start-application command. When executing the start-application command, you must enter the application ID to start.
[MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+--------+----------+----------+------------------------+ | Applicat | Applicati | State | Target | Target | Application Path | | ion ID | on Type | | Servers | Clusters | | +----------+-----------+--------+----------+----------+------------------------+ | myApp | EAR | DISTRI | server1 | | ${INSTALL_HOME}/myApp/ | | | |BUTED | | |myApp.ear | +----------+-----------+--------+----------+----------+------------------------+ ================================================================================ [MASTER]domain1.adminServer>start-application myApp start the application for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicat |Application | State | Target | Target | Application Path | | ion ID | Type | | Servers | Clusters | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myA | | | | | | |pp/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>
For more information about the options available when executing the start-application command, see start-application in JEUS Reference Guide. |
3.7. Suspending Applications
If you want to stop the service temporarily without undeploying the application, you can stop the application as follows.
Using the Console Tool
The following is the process of suspending an application service by using the console tool.
You can stop an application service using the stop-application command. When executing the stop-application command, you must enter the application ID to be stopped.
[MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicat |Application | State | Target | Target | Application Path | | ion ID | Type | | Servers | Clusters | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myA | | | | | | |pp/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>stop-application myApp stop the application for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+--------+----------+----------+------------------------+ | Applicat | Applicati | State | Target | Target | Application Path | | ion ID | on Type | | Servers | Clusters | | +----------+-----------+--------+----------+----------+------------------------+ | myApp | EAR | DISTRI | server1 | | ${INSTALL_HOME}/myApp/ | | | |BUTED | | |myApp.ear | +----------+-----------+--------+----------+----------+------------------------+ ================================================================================ [MASTER]domain1.adminServer>
For more information about the options available when executing the stop-application command, see stop-application in JEUS Reference Guide. |
3.8. Adding a Server as a Target of Running Applications
A server or cluster can be added to scale up service of currently running applications. Because an application that already exists in a domain cannot be deployed on a specific server, JEUS supports the add-target command to add a server as a target. The command can be used when the application is in RUNNING or DISTRIBUTED state.
To add a server as the application service target, an extra server is needed. For instructions on how to add an extra server, see Adding Servers in JEUS Server Guide. |
Using the Console Tool
The following is the process of adding a server as a target for a running application by using the console tool.
You can add a target for a running application using the add-application-target command. When running the add-application-target command, you must specify the application ID to add the target to and the list of servers (or clusters) to which you want to add the application.
[MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicat |Application | State | Target | Target | Application Path | | ion ID | Type | | Servers | Clusters | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myA | | | | | | |pp/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>add-application-target myApp -servers server2 add a target server or cluster to the application for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+---------+-----------+-----------+---------------------+ | Applicat | Applicati | State | Target | Target | Application Path | | ion ID | on Type | | Servers | Clusters | | +----------+-----------+---------+-----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1,s | | ${INSTALL_HOME}/myA | | | | |erver2 | |pp/myApp.ear | +----------+-----------+---------+-----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>
For more information about the options available when executing the add-application-target command, see add-application-target in JEUS Reference Guide. |
3.9. Removing a Target Server of Running Applications
A server or cluster can be removed from targets of currently running applications. Because an application, which already exists in a domain, cannot be undeployed on a specific server, JEUS supports the remove-target command to remove a server from the targets of the application. The command can be used when the application is in the RUNNING or the DISTRIBUTED state.
Using the Console Tool
The following is the process of removing a server from targets of running applications by using the console.
You can use the remove-application-target command to remove the target of a running application. When running the remove-application-target command, you must enter the application ID from which to remove the target and the list of target servers (or clusters) to remove.
[MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+-----------+---------+-----------+-----------+---------------------+ | Applicat | Applicati | State | Target | Target | Application Path | | ion ID | on Type | | Servers | Clusters | | +----------+-----------+---------+-----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1,s | | ${INSTALL_HOME}/myA | | | | |erver2 | |pp/myApp.ear | +----------+-----------+---------+-----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>remove-application-target myApp -servers server2 remove server or cluster target from the application for the application [myApp] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicat |Application | State | Target | Target | Application Path | | ion ID | Type | | Servers | Clusters | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myA | | | | | | |pp/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>
For more information about the options available when executing the remove-application-target command, see remove-application-target in JEUS Reference Guide. |
3.10. Checking Application Information
This section describes how to view application information.
3.10.1. Using the Console Tool
Information about myApp.ear application can be checked by using the application-info command.
The following is an example of checking application information with the console tool. For detailed explanations of each option, see application-info in JEUS Reference Guide.
[MASTER]domain1.adminServer> application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicati| Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myAp| | | | | | |p/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================ [MASTER]domain1.adminServer>application-info -id myApp -server server1 Application information for the server [server1] in the domain [domain1]. ================================================================================ +------------+-----------------+-------------+------+------------+-------------+ | Application| Application Name| Application | State| Server | Cluster | | ID | | Type | | Targets | Targets | +------------+-----------------+-------------+------+------------+-------------+ | myApp | myApp | ear | RUNNI| server1 | | | | | |NG | | | +------------+-----------------+-------------+------+------------+-------------+ ================================================================================ [MASTER]domain1.adminServer>application-info -id myApp -server server1 -detail Application name : myApp Application [myApp] =============================================================== +-------------+---------------------------------+-------------+ | Module Name | Unique Module Name | Module Type | +-------------+---------------------------------+-------------+ | ejb | myApp#ejb | EJB | | appclient | myApp#appclient | CAR | | web | myApp#web | WAR | +-------------+---------------------------------+-------------+ To view detailed information about EJBs or web modules in an EAR, use the "-module" or "-type" option. =============================================================== [MASTER]domain1.adminServer>application-info -id myApp -server server1 -detail -module ejb Application name : myApp General information about the EJB module [ejb]. ============================================================== +-------------+----------------------------------------------+ | Module Name | Unique Module Name | +-------------+----------------------------------------------+ | ejb | myApp#ejb | +-------------+----------------------------------------------+ ============================================================== Beans ================================================================================ +-----------+-------------------------+-------------------+--------------------+ | Bean Name | Type | Local Export Name | Remote Export Name | +-----------+-------------------------+-------------------+--------------------+ | HelloBean | StatelessSessionBean | | | +-----------+-------------------------+-------------------+--------------------+ ================================================================================ [MASTER]domain1.adminServer>application-info -id myApp -server server1 -detail -type war Application name : myApp There are no EJBs in this module. General information about the web module [web]. =============================================================== +-------------+--------------------------------+--------------+ | Module Name | Unique Module Name | Context Path | +-------------+--------------------------------+--------------+ | web | myApp#web | /hello | +-------------+--------------------------------+--------------+ =============================================================== Servlets ================================================================================ +---------+------------------+-------+-------+-----------+---------+-----------+ | Name | Class | State | Count | Attribute | RegType |URLPatterns| +---------+------------------+-------+-------+-----------+---------+-----------+ | HelloSer| dvt.deployment.se| READY | 0 | SYNC | WEB_XML | /HelloServ| |vlet |rvlet.HelloServlet| | | | |let | +---------+------------------+-------+-------+-----------+---------+-----------+ ================================================================================ Filters ================================================================================ +------+-------+--------------+-----------+----------------------+-------------+ | Name | Class | Attribute | RegType | URLPatterns | Servlets | +------+-------+--------------+-----------+----------------------+-------------+ (No data available) ================================================================================ Listeners ================================================ +------+------+--------------------------------+ | Name | Type | RegType | +------+------+--------------------------------+ (No data available) ================================================ EJBs ================================================================================ +-----------+------+-------------------------+---------------------------------+ | Bean Name | Type | Local Export Name | Remote Export Name | +-----------+------+-------------------------+---------------------------------+ (No data available) ================================================================================ [MASTER]domain1.suok>application-info -id myApp -server server1 -detail -module ejb -bean HelloBean bean HelloBean Application name : myApp Module name : ejb Bean name: HelloBean ================================================================================ +---------------+-----------+-------------------+--------------+---------------+ | Name | (Count) | WaterMark(High:Low| Bound(Upper:L| Time(Max:Min:T| | | | :Cur) | ower) | otal) | +---------------+-----------+-------------------+--------------+---------------+ | create | times(0) | | | | +---------------+-----------+-------------------+--------------+---------------+ | remove | times(0) | | | | +---------------+-----------+-------------------+--------------+---------------+ | timed-rb | transactio| | | | | |n(0) | | | | +---------------+-----------+-------------------+--------------+---------------+ | request | request(0)| | | | +---------------+-----------+-------------------+--------------+---------------+ | active-bean | | bean(0:0:0) | | | +---------------+-----------+-------------------+--------------+---------------+ | rolledback | transactio| | | | | |n(0) | | | | +---------------+-----------+-------------------+--------------+---------------+ | total-bean | | bean(0:0:0) | | | +---------------+-----------+-------------------+--------------+---------------+ | comitted | transactio| | | | | |n(0) | | | | +---------------+-----------+-------------------+--------------+---------------+ | MethodReadyCou| | bean(0:0:0) | | | |nt | | | | | +---------------+-----------+-------------------+--------------+---------------+ | active-thread | | thread(0:0:0) | | | +---------------+-----------+-------------------+--------------+---------------+ | total-remote-t| |thread(100:100:100)| | | |hread | | | | | +---------------+-----------+-------------------+--------------+---------------+ ================================================================================
Running the application-info command displays the following information about all the applications in a domain.
Item | Description |
---|---|
Application ID |
Application ID. This value must be unique in a domain. |
Application Type |
Application type. This value is one of the following:
|
state |
Status of an application in a domain. The value is one of the following:
For detailed information about each state, see Application Status. |
Server Target |
Target server where the applications are deployed. |
Cluster Target |
Target cluster where the applications are deployed. |
Application Path |
Path to the applications installed in the Master Server. |
4. Staging Mode Deploy
An application in the exploded module format can be deployed to MSs on other machines by compressing the file. This is called a deployment staging mode. To deploy, place the application file in an application repository, or specify the absolute path to the file on the machine where the Master Server resides. For detailed information about deployment in staging mode, see Staging Mode Deploy.
Using the Console Tool
The following is the process of deploying an application in the Staging mode. Use the deploy command along with the staging option in the console tool.
[MASTER]domain1.adminServer>deploy exploded -servers server1 -staging deploy the application for the application [exploded] succeeded. [MASTER]domain1.adminServer>application-info Application information for the domain [domain1]. ================================================================================ +----------+------------+---------+----------+-----------+---------------------+ | Applicati| Application| State | Server | Cluster | Application Path | | on ID | Type | | Targets | Targets | | +----------+------------+---------+----------+-----------+---------------------+ | exploded | WAR | RUNNING | server1 | | /home/user1/apps/exp| | | | | | |loded | +----------+------------+---------+----------+-----------+---------------------+ | myApp | EAR | RUNNING | server1 | | ${INSTALL_HOME}/myAp| | | | | | |p/myApp.ear | +----------+------------+---------+----------+-----------+---------------------+ ================================================================================
5. Deployment by Using a Deployment Plan
A deployment plan is an external configuration file of an application that can be used to modify the application DD at the time of deployment. JEUS defines deployment plan in XML format, and it can be applied to an EJB, web application, EAR standard DD, and JEUS DD. When deploying applications, if you specify to use a deployment plan, the deployment plan configurations and DD will be merged at deployment time to determine the final application configuration settings before starting deployment.
This section describes about deployment plan configurations and operation methods. This section also describes how to deploy applications using a deployment plan.
5.1. Configuring a Deployment Plan and Operation Methods
This section describes how to configure a deployment plan and its operation methods through an example.
Deployment Plan Settings
The following example shows how to implement a deployment plan.
<?xml version="1.0" encoding="UTF-8"?> <jeus-deployment-plan xmlns="http://www.tmaxsoft.com/xml/ns/jeus" xmlns:jeus="http://www.tmaxsoft.com/xml/ns/jeus" xmlns:jakartaee="https://jakarta.ee/xml/ns/jakartaee"> <descriptors> <!-- For standalone EJB --> <descriptor> <uri>META-INF/ejb-jar.xml</uri> <configurations> <configuration> <action>REPLACE</action> <xpath>//jakartaee:ejb-name[.='ByeBean']</xpath> <value> <![CDATA[<ejb-name>HiBean</ejb-name>]]> </value> </configuration> <configuration> <action>DELETE</action> <xpath>/child::jakartaee:ejb-jar/child::jakartaee:enterprise-beans/ child::jakartaee:session/child::jakartaee:local-home[.='HelloHomeLocal']</xpath> </configuration> <configuration> <action>APPEND_CHILD</action> <xpath>/child::jakartaee:ejb-jar/descendant::jakartaee:session[2]</xpath> <value> <![CDATA[<transaction-type>Bean</transaction-type>]]> </value> </configuration> <configuration> <action>INSERT_BEFORE</action> <xpath>/jakartaee:ejb-jar/jakartaee:enterprise-beans/jakartaee:session/ jakartaee:ejb-name[.='HelloBean']/../jakartaee:transaction-type</xpath> <value> <![CDATA[<session-type>Stateless</session-type>]]> </value> </configuration> </configurations> </descriptor> <descriptor> <uri>META-INF/jeus-ejb-dd.xml</uri> <configurations> <configuration> <action>REPLACE</action> <xpath>/jeus:jeus-ejb-dd/jeus:beanlist/jeus:jeus-bean/ jeus:export-name[.='ByeBean']</xpath> <value> <![CDATA[<export-name>HiBean</export-name>]]> </value> </configuration> <configuration> <action>DELETE</action> <xpath>/jeus:jeus-ejb-dd/jeus:beanlist/jeus:jeus-bean/ jeus:local-export-name[.='HelloBeanLocal']</xpath> </configuration> <configuration> <action>APPEND_CHILD</action> <xpath>/jeus:jeus-ejb-dd/jeus:beanlist/jeus:jeus-bean</xpath> <value> <![CDATA[<jeus-rmi>false</jeus-rmi>]]> </value> </configuration> <configuration> <action>INSERT_BEFORE</action> <xpath>/jeus:jeus-ejb-dd/jeus:beanlist/jeus:jeus-bean/ jeus:ejb-name[.='HiBean']/../jeus:jeus-rmi</xpath> <value> <![CDATA[<thread-max>100</thread-max>]]> </value> </configuration> </configurations> </descriptor> <!-- For standalone web application --> <descriptor> <uri>WEB-INF/web.xml</uri> <configurations> <configuration> <action>REPLACE</action> <xpath>/child::jakartaee:web-app/child::jakartaee:servlet-mapping/ child::jakartaee:servlet-name[.='HiServlet']</xpath> <value> <![CDATA[<servlet-name>HelloServlet</servlet-name>]]> </value> </configuration> <configuration> <action>DELETE</action> <xpath>//jakartaee:load-on-startup</xpath> </configuration> <configuration> <action>APPEND_CHILD</action> <xpath>/jakartaee:web-app/descendant::jakartaee:login-config</xpath> <value> <![CDATA[<auth-method>BASIC</auth-method>]]> </value> </configuration> <configuration> <action>INSERT_BEFORE</action> <xpath>/jakartaee:web-app/jakartaee:env-entry/ jakartaee:env-entry-value[.='value1']</xpath> <value> <![CDATA[<env-entry-type>java.lang.String</env-entry-type>]]> </value> </configuration> </configurations> </descriptor> <descriptor> <uri>WEB-INF/jeus-web-dd.xml</uri> <configurations> <configuration> <action>REPLACE</action> <xpath>//jeus:enable-jsp</xpath> <value> <![CDATA[<enable-jsp>true</enable-jsp>]]> </value> </configuration> <configuration> <action>DELETE</action> <xpath>/jeus:jeus-web-dd/child::jeus:max-instance-pool-size</xpath> </configuration> <configuration> <action>INSERT_BEFORE</action> <xpath>/jeus:jeus-web-dd/descendant::jeus:enable-jsp</xpath> <value> <![CDATA[<context-path>/hello</context-path>]]> </value> </configuration> <configuration> <action>APPEND_CHILD</action> <xpath>//jeus:jeus-web-dd</xpath> <value> <![CDATA[<webinf-first></enabled>false</enabled></webinf-first>]]> </value> </configuration> </configurations> </descriptor> <!-- For EAR --> <descriptor> <uri>META-INF/application.xml</uri> <configurations> <configuration> <action>REPLACE</action> <xpath>/jakartaee:application/jakartaee:library-directory</xpath> <value> <![CDATA[<library-directory>mylib</library-directory>]]> </value> </configuration> </configurations> </descriptor> <descriptor> <uri>ejb.jar/META-INF/ejb-jar.xml</uri> <configurations> <configuration> <action>REPLACE</action> <xpath>/jakartaee:ejb-jar/jakartaee:enterprise-beans/ jakartaee:session/jakartaee:ejb-class</xpath> <value> <![CDATA[<ejb-class>HelloBean</ejb-class>]]> </value> </configuration> </configurations> </descriptor> <descriptor> <uri>web.war/WEB-INF/web.xml</uri> <configurations> <configuration> <action>REPLACE</action> <xpath>/jakartaee:web-app/jakartaee:servlet-mapping/ jakartaee:servlet-name</xpath> <value> <![CDATA[<servlet-name>HelloServlet</servlet-name>]]> </value> </configuration> </configurations> </descriptor> </descriptors> </jeus-deployment-plan>
The following describes the tags under <descriptor>.
-
<descriptor>
The <descriptor> tag consists of multiple <configurations> child tags.
-
<configuration>
The <configuration> tag is a unit of configuration that applies to target DD. It consists of <action>, <xpath>, and <value> child tags.
Tag Description <action>
Specifies which configuration will be changed for a certain tag of DD.
The configuration values are as follows:
-
DELETE: Deletes the specified tag from DD.
-
REPLACE: Replaces the specified tag with a tag in DD.
-
APPEND_CHILD: Adds a tag as the last child in DD.
-
INSERT_BEFORE: Adds a tag as a previous sibling in DD.
<xpath>
Configures the specified DD tag using an xpath expression. In this case, all tags, which are placed in the <xpath> path, must be expressed as qualified names with XML namespace according to the <xpath> standard. Thus, you must declare XML Name Space in each DD with a namespace prefix in the deployment plan.
For example, if a tag in JEUS DD is set as <xpath>, all tags in the path <xpath> should be expressed as qualified names with JEUS XML namespace (http://www.tmaxsoft.com/xml/ns/jeus). Since JEUS XML namespace is mapped to the 'jeus' prefix in the deployment plan, you can form qualified names by attaching the 'jeus' prefix in front of all tag names that are placed in the <xpath> path.
<value>
The <value> tag is valid only when the <action> tag value is REPLACE, APPEND_CHILD, or INSERT_BEFORE.
The configuration values according to the <action> value are as follow:
-
REPLACE: Sets a new tag to replace the current <xpath> tag.
-
APPEND_CHILD: Sets a tag, which will be added as the last child to the <xpath> tag.
-
INSERT_BEFORE: Sets a tag, which will be added as a previous sibling of the <xpath> tag.
Since the tag set to <value> assumes the form of an XML fragment with depth, the <value> value is wrapped in CDATA section. Construct the XML fragment necessary for performing an action in the CDATA section.
-
-
Deployment Plan Operation Methods
This section describes deployment plan operations by tags with the previous example.
-
<descriptor>
A deployment plan consists of multiple <descriptor> tags.
Use the <uri> tag to specify the target DD, which becomes a target in units of <descriptor> tag. Using the application file as the root, specify <uri> value as a relative path to DD to determine the target DD.
-
For example, the standard DD of a standalone EJB module is always placed in META-INF/ejb-jar.xml and JEUS DD in META-INF/jeus-ejb-dd.xml from the application root. Therefore the first <descriptor> tag of the previous deployment plan is for the standard DD of a standalone EJB module obtained from the <uri> value. The second <descriptor> tag is for JEUS DD of a standalone EJB module obtained from the <uri> value. The same rule applies to standalone web applications or EAR.
-
If the <uri> value is 'ejb.jar/META-INF/ejb-jar.xml', the <descriptor> value is an EJB module (file name is ejb.jar), which belongs to EAR. If the <uri> value is 'web.war/WEB-INF/web.xml', the <descriptor> value is a WEB module (file name is web.war), which belongs to EAR.
-
One deployment plan can be used to deploy various applications. Only the <descriptor>'s, which match the <uri> value of application DD, are selected for deployment. Thus, other <descriptor>'s have absolutely no effect on deployment.
-
-
<configuration>
The following example uses the first <descriptor> configuration to describe how DD is changed according to the <descriptor> configuration.
-
As explained earlier, the first <descriptor> tag configures the standard DD of a standalone EJB module. The first action performed is replacing a specific tag and is expressed in the first <configuration> tag. It shows that the <ejb-name> tag with the value, 'ByeBean', is replaced with the <ejb-name> tag with the value, 'HiBean'.
-
The second <configuration> expresses the action of deleting a <local-home> tag with the value, 'HelloHomeLocal'.
-
The third <configuration> expresses the action of adding a <transaction> tag as the last child of the second <session> tag.
-
The fourth <configuration> expresses the action of adding a <session-type> tag as a previous sibling of a <session> tag, whose <ejb-name> tag value is 'HelloBean'.
-
5.2. Installing a Deployment Plan
Before deploying applications using deployment plan, the deployment plan should be installed on a domain. Only the deployment plans that are installed on a domain can be deployed like applications. When installing deployment plan, the identifier of the deployment plan can be set on a domain.
A deployment plan can be installed by using the console tool.
Using the Console Tool
In the console tool, execute the install-deployment-plan command to install the deployment plan.
[MASTER]domain1.adminServer>install-deployment-plan -path /home/user1/plans/jeus-deployment-plan.xml -name plan1 Installing the deployment plan [plan1] was successful.
For more information on how to use the install-deployment-plan command, see install-deployment-plan in JEUS Reference Guide. |
5.3. Verifying an Installed Deployment Plan
Users can check the installed deployment plan by using the console tool. Each deployment plan is distinguished by the deployment plan identifier that is assigned during the installation. You can also display the list of applications by deployment plan that is applied to the application, as well as the actual deployment file content.
Using the Console Tool
By using the deployment-plan-info command in the console tool, users can obtain the list of applications, to which deployment plans installed on a domain apply to. If a particular deployment plan is selected, its details are displayed.
-
Checking the deployment plan list
[MASTER]domain1.adminServer>deployment-plan-info The list of deployment plans installed in the domain and the applications to which each deployment plan applies =========================================================== +------------------------------------------+--------------+ | Deployment plan | Applications | +------------------------------------------+--------------+ | plan1 | | +------------------------------------------+--------------+ ===========================================================
-
Checking the details of a deployment plan
[MASTER]domain1.adminServer>deployment-plan-info -name plan1 <?xml version="1.0" encoding="UTF-8"?> <jeus-deployment-plan xmlns="http://www.tmaxsoft.com/xml/ns/jeus"> ... </jeus-deployment-plan>
For more information on how to use the deployment-plan-info command, see deployment-plan-info in the JEUS Reference Guide. |
5.4. Deployment by Using a Deployment Plan
Applications can be deployed using an installed deployment plan by using the console tool.
Using the Console Tool
In a console tool, applications can be deployed using a deployment plan by executing the deploy-application command.
[MASTER]domain1.adminServer>deploy-application webapp -all -plan plan1 deploy the application for the application [webapp] succeeded.
5.5. Verifying an Application-Applied Deployment Plan
Users can verify the deployment plan that was applied to an application using the console tool.
Using the Console Tool
In the console tool, a deployment plan that has been applied to an application can be checked by executing the application-info command.
[MASTER]domain1.adminServer>application-info -id webapp -detail Application information for the domain [domain1]. ================================================================================ +------+-------+-----+------+-------+--------------+----------+----------+-----+ | Appli| Applic|State|Server|Cluster| Running | Applicati| Applicati| Plan| |cation| ation | |Target|Targets| Servers | on Path | on Time |Name | | ID | Type | | s | | | | | | +------+-------+-----+------+-------+--------------+----------+----------+-----+ |webapp| WAR | RUNN| ALL | ALL | server1,serve| ${INSTALL| Tue May |plan1| | | |ING | | |r2,server3,adm|HOME}/web|28 | | | | | | | |inServer |app/deploy|22:45:13 | | | | | | | | |ment_plan|KST 2013 | | | | | | | | |web.war | | | +------+-------+-----+------+-------+--------------+----------+----------+-----+ ================================================================================
5.6. Uninstalling a Deployment Plan
Users can uninstall a deployment plan on a domain by using the console tool. Once uninstalled, the deployment plan is no longer valid and thus cannot be used for deployment.
Using the Console Tool
In the console tool, deployment plans can be uninstalled by executing the uninstall-deployment-plan command.
[MASTER]domain1.adminServer>uninstall-deployment-plan plan1 Uninstalling the deployment plan was successful.
For more information on how to use the uninstall-deployment-plan command, see uninstall-deployment-plan in JEUS Reference Guide. |