Monday, March 21, 2016

How to deploy Applications (EAR) using scripts/linux (CLI) for JBoss EAP/Wildfly

Hi all,
I would like to show you how to deploy and undeploy EAR into JBoss or Wildfly...
Let's see:

- Standalone

#cd /opt/sample
# vim sample-jboss.sh

 IP = localhost
 if [ "x$JBOSS_HOME" = "x" ]; then
        JBOSS_HOME="/opt/jboss/jboss-eap-6.4"
        echo "JBOSS_HOME set up... "
fi

echo "Undeploy...sample.ear"
   if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --commands="undeploy sample.ear, quit"   then
      echo "Undeploy OK!"
   else
      echo "[ERROR]: Undeploy failed!"
   fi
   echo ""


 echo "Deploy...sample.ear"
   if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --commands="deploy sample.ear --force, deployment-info --name=sample.ear, quit"   then
      echo "Deploy OK!"
   else
      echo "[ERROR]: Deploy failed!"
   fi
   echo ""

:wq

# ./sample-jboss.sh

So, fill the username and password for JBoss Admin (Security RBAC or Property settings)


- Domain

IP = localhost
JBOSS_USER = admin

JBOSS_PWD = <password>

echo "Undeploy..."
   if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --user=$JBOSS_USER --password=$JBOSS_PWD --commands="undeploy sample.ear --all-relevant-server-groups, quit"   then
      echo "Undeploy OK!"
   else
      echo "[ERROR]: Failed!"

echo "Deploy..."
 if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --user=$JBOSS_USER --password=$JBOSS_PWD --commands="deploy sample.ear --server-groups=<group> --name=sample.ear, quit"   then
      echo "Deploy OK!"
   else
      echo "[ERROR]: Failed!"
   fi
   echo ""


#JBoss Info...(cli command)

echo "############### STATUS #################"
$JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --user=$JBOSS_USER --password=$JBOSS_PWD --commands="/server-group=*/deployment=*/:read-resource(recursive=false,proxies=true,include-runtime=true,include-defaults=true"

 Thanks all, see you next time...

Wednesday, March 16, 2016

JEE Maven Application for Backend Components

Hi All,

I would like to show how can you create a JEE application. A Simple code using Java concepts like JMS, Quartz, DeltaSpike, JGroups features and more...

So let's do it!!!

First of all, i would like to define the pre-requirements about the code:

- JEE 6, Java 7 or 8
- CDI
- JBoss EAP
- Oracle XE
- JGroups
- EJB

- HornetQ

The code (git): https://github.com/alvesfred/samples.git

1 - Deploy

I posted a folder (deploy) that contains  standalone-full-ha.xml. This file is responsable for all configurations into JBoss EAP.

2 - JMS

About JMS concepts is possible to see 3 artefacts:

- JMS Service (jms configurations to send a message)
- Business JMS Service (Business Service class)
- Message Listener (receives the messages)

3 - Quartz

A sample implementation class...using DeltaSpike annotations and Quartz features.

See you on the next time...