El desarrollo de aplicaciones web implica la creación de componentes JavaEE:
- Clientes de aplicación y applets (en el cliente).
- Java Servlet, JavaServer Faces (JSF), and JavaServer Pages (JSP).
- Enterprise JavaBeans (EJB) (o enterprise beans).
Los componentes, una vez desarrollados, se despliegan y ejecutan en contenedores especializados. Cuando se crea una aplicación JavaEE, ésta tiene que empaquetarse y desplegarse antes de tenerla disponible para su uso. El proceso de ensamblado de los componentes requiere especificar el soporte del servidor JavaEE:
- Seguridad: usuarios autorizados.
- Modelo de gestión de transacciones: relaciones entre métodos que constituyen una transacción (tratados como una unidad).
- Java Naming and Directory Interface (JNDI): acceso a servicios de nombres y directorio.
- Conectividad remota: permite que los clientes invoquen métodos en los EJBs como si estuvieran en la misma máquina virtual.
Composición de módulos en aplicaciones:
El proceso de despliegue de aplicaciones en JBoss EAP 6 se realiza de diferentes formas:
- Consola de gestión: esta consola web permite al usuario el despliegue gracias a una interface de usuario.
- CLI: herramienta en línea de comandos.
- Scanner.
- Maven.
En este post vamos a analizar cómo realizar esta operación con CLI, la herramienta en línea de comandos.
¿Qué es CLI?
CLI es un ejemplo de herramienta que usa la API nativa. Se encuentra disponible para instancias en modo standalone y domain, permitiendo a los usuarios conectar a las instancias y realizar operaciones de gestión.
Para ejecutar la herrmienta debemos trabajar con el ejecutable jboss-cli en su diferentes variantes:
$ EAP_HOME/bin/jboss-cli.sh C:\>EAP_HOME\bin\jboss-cli.bat
Por ejemplo:
kentia:jboss-eap-6.2 ematiz$ ./bin/jboss-cli.sh You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands. [disconnected /]
Despliegue de aplicaciones con CLI
El comando deploy es el responsable de desencadenar el proceso de despligue:
SYNOPSIS
deploy (file_path [--script=script_name] [--name=deployment_name]
[--runtime-name=deployment_runtime_name]
[--force | --disabled] [--unmanaged])
| --name=deployment_name
[--server-groups=group_name (,group_name)* | --all-server-groups]
[--headers={operation_header (;operation_header)*}]
DESCRIPTION
Deploys the application designated by the file_path or enables an already
existing but disabled in the repository deployment designated by the name
argument. If executed w/o arguments, will list all the existing deployments.
ARGUMENTS
file_path - the path to the application to deploy. Required in case the
deployment doesn't exist in the repository.
The path can be either absolute or relative to the current
directory.
--name - the unique name of the deployment. If the file path
argument is specified the name argument is optional with
the file name been the default value. If the file path
argument isn't specified then the command is supposed to
enable an already existing but disabled deployment, and in
this case the name argument is required.
--runtime-name - optional, the runtime name for the deployment. This will
form the basis for such things as default Java EE
...El proceso de despliegue es muy simple y a la vez muy potente, como ejemplo:
$ deploy /path/to/test-application.war --all-server-groups $ deploy /path/to/test-application.war --server-groups=server_group_1,server_group_2
Repliegue de aplicaciones en JBoss EAP 6.2
Para replegar una aplicación se utilizará el comando undeploy. El procedimiento y los parámetros son muy similares a los del comando deploy. Se muestra a continuación un resumen :
SYNOPSIS
undeploy name [--server-groups=group_name (,group_name)* |
--all-relevant-server-groups] [--keep-content]
[--headers={operation_header (;operation_header)*}]
DESCRIPTION
Undeploys the deployment with the given name and, depending on the
arguments, removes its content from the repository.
If the deployment name isn't specified, prints the list of all the existing
deployments.
ARGUMENTS
name - the name of the deployment to undeploy.
--server-groups - comma separated list of server group names the undeploy
command should apply to. Either server-groups or
all-relevant-server-groups is required in the domain mode.
This argument is not applicable in the standalone mode.
--all-relevant-server-groups - indicates that undeploy should apply to all
the server groups in which the deployment is
enabled. Either server-groups or all-relevant-server-groups
is required in domain mode. This argument is not applicable
in the standalone mode.
--keep-content - by default undeploy, besides disabling the deployment, also
removes its content from the repository. The presence of
...