Wildfly – Connect to remote server

Some commands to use from jboss-cli script:

Deploy app

#Connect to remote server (default port is 9990)
jboss-cli.sh --connect controller=host:port

#deploy
jboss-cli.sh --connect --command="deploy target/demo-1.0-SNAPSHOT.war"

#undeploy
jboss-cli.sh --connect --command="undeploy $WAR_NAME"

# List deployments (cli command)
deployment-info

# Shutdown server
jboss-cli.sh --controller=localhost:9990 --connect --command=:shutdown

Bye

References

 

Red Hat Application Migration Toolkit

Java_logo

Red Hat published a free application toolkit to analyse the java enterprise applications based on old Jboss to migrate or upgrade to newer versions like wildfly.

This tool can review the complexity for the migration, the issues to attend, the dependencies (shared and circular) and other interesting stuffs to give you important details for the upgrade or migration that you will must consider.

There a tree ways to install (described by self) and you can download from here:

  • Command Line Interface
  • Web console (you can deploy a war in a existing jboss server)
  • Eclipse Plugin
  • Maven Plugin (it’s not listed but is usefully option)

I’ve tested this toolkit for migration purposes with a few old web applications based on Jboss 5, the objective is migrate that apps to wildfly. Seguir leyendo

Install Oracle Driver Jboss Wildfly 14

Create new module with this structure and files, into «$WILDFLY_HOME\modules\system\layers\base«:

+---com
|   \---oracle
|       \---main
|            module.xml
|            ojdbc7-12.1.0.2.jar

Into the module.xml, set a name of the module and put it into the same folder structure «com.oracle» with the jar file.

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle">
    <resources>
        <resource-root path="ojdbc7-12.1.0.2.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>
Seguir leyendo

JBoss EAP 6.2 Shell script as a service for SUSE


Just like that, explained by self  🙂

#! /bin/sh
### BEGIN INIT INFO
# Provides: JBOSS
# Required-Start:
# Required-Stop:
# Default-Start: 5
# Default-Stop:
# Description: Start Jboss Aplication Server 6.2
### END INIT INFO
export JBOSS_HOME=/usr/share/jboss/jboss-eap-6.2
start(){
echo "Starting JBoss EAP..."
# If using an SELinux system such as RHEL 4, use the command below
# instead of the "su":
# eval "runuser - jboss -c '/opt/jboss/current/bin/run.sh > /dev/null 2> /dev/null &'
# if the 'su -l ...' command fails (the -l flag is not recognized by my su cmd) try:
#Jboss EAP 6.2
su -l jboss -c '$JBOSS_HOME/bin/standalone.sh > /dev/null 2> /dev/null &'
}
stop(){
echo "Stopping JBoss..."
# If using an SELinux system such as RHEL 4, use the command below
# instead of the "su":
# eval "runuser - jboss -c '/opt/jboss/current/bin/shutdown.sh -S &'
# if the 'su -l ...' command fails try
#Jboss EAP 6.2
su -l jboss -c '$JBOSS_HOME/bin/jboss-cli.sh --connect command=:shutdown'
}
restart(){
su -l jboss -c '$JBOSS_HOME/bin/jboss-cli.sh --connect --command=:reload'
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: jboss {start|stop|restart}"
exit 1
esac
exit 0
view raw jboss7.sh hosted with ❤ by GitHub

References

Regads

Install Java JDK on Server (Suse)

La instalación del a jdk en servidores Unix puede generar a veces algunos problemas ya que generalmente no hay una guía exacta para realizar la instalación, pero desde mi punto de vista creo que también se debe a que en internet hay muchas formas de hacerlo y también es verdad que Unix lo permite, por lo tanto no hay una forma «correcta» de hacerlo.

Sin embargo hay una forma de mantener un orden dentro de todo este caos, por ejemplo hay servidores que a veces necesitan tener instaladas dos o más versiones de la jdk en el mismo server… y ¿como controlamos esto? este tipo de cuestiones son las que causan esos problemas  a los que me refiero porque muchos ajustamos variables de entorno y terminamos creando un dessatre, y bueno antes de mostrar la instalación quería transmitir esta pequeña perspectiva.

El siguiente comando es el que nos a ayudar en Suse a controlar esto:

update-alternatives

Nota: en Ubuntu el equivalente es el comando alternatives
Seguir leyendo

Suse add Jboss 5 Startup Script

Este es uno de esos días que me arrepiento por no guardar esos buenos tips que voy descubriendo, sé que en algún momento me pueden servir y hoy es uno de esos días ¬_¬…

Para agregar un script para ejecutar el jboss al iniciar el sistema en SUSE tenemos que seguir unos sencillos pasos:

  1. Crear archivo, generas un archivo de texto llamado jboss en la carpeta /etc/init.d con el siguiente contenido:
    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides: JBOSS
    # Required-Start:
    # Required-Stop:
    # Default-Start: 5
    # Default-Stop:
    # Description: Start Jboss Aplication Server 5.1 to allow and provide QA Environment the "Publicador Promociones"
    ### END INIT INFO
    export JBOSS_HOME=/opt/jboss-5.1.0.GA
    start(){
    echo "Starting jboss..."
    # If using an SELinux system such as RHEL 4, use the command below
    # instead of the "su":
    # eval "runuser - jboss -c '/opt/jboss/current/bin/run.sh > /dev/null 2> /dev/null &'
    # if the 'su -l ...' command fails (the -l flag is not recognized by my su cmd) try:
    $JBOSS_HOME/bin/run.sh -Djboss.as.deployment.ondemand=false -b 0.0.0.0 > /dev/null 2> /dev/null &
    #Su -l jboss -c '$JBOSS_HOME/bin/run.sh > /dev/null 2> /dev/null &'
    }
    stop(){
    echo "Stopping jboss..."
    # If using an SELinux system such as RHEL 4, use the command below
    # instead of the "su":
    # eval "runuser - jboss -c '/opt/jboss/current/bin/shutdown.sh -S &'
    # if the 'su -l ...' command fails try:
    $JBOSS_HOME/bin/shutdown.sh -S &
    #su -l jboss -c '$JBOSS_HOME/bin/shutdown.sh -S &'
    }
    restart(){
    stop
    # give stuff some time to stop before we restart
    sleep 60
    # protect against any services that can't stop before we restart (warning this kills all Java instances running as 'jboss' user)
    #su -l jboss -c 'killall java'
    # if the 'su -l ...' command fails try:
    # sudo -u jboss killall java
    start
    }
    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    restart
    ;;
    *)
    echo "Usage: jboss {start|stop|restart}"
    exit 1
    esac
    exit 0
    view raw jboss hosted with ❤ by GitHub
  2. Le otorgas permisos de ejecución:
    chmod +x jboss
  3. Agregas el script al sistema:
    insserv /etc/init.d/jboss
    ln -s /etc/init.d/jboss /sbin/rcjboss

Para configurar el inicio y el fin debes editar el contenido del script en la sección BEGIN INIT INFO.

Referencias

Saludos