How to install your Raspberry Pi OS (Raspbian) in 4 minutes

This tutorial will take you through the steps to install Raspbian, the official OS optimized for Raspberry Pi.



  • Rapsberry Pi (any model)
  • SD card (for Pi version 1), or micro SD card (for Pi version 2 & 3)
  • SD Card reader (for your Mac/PC from which you will format the SD card)
  • A Mac / PC / Linux computer.

Download, unzip and burn the image

Download the Raspbian image

Raspbian is declined in two version. Raspbian Jessie Lite comes as a minimal image based on Debian Jessie without graphical environment. So it is a light version (~308.5MB) and it is a good candidate if you intend to install a server. (Direct download to Raspbian Jessie Lite)
The second variant is Raspbian Jessie with PIXEL. Much heavier (~1.57GB) but comes with some extra features such as X-server and its component. (Direct download to Raspbian Jessie with PIXEL)Screen Shot 2017-04-02 at 17.27.27

Note that, at any time, you can install a desired package with apt-get, and go from the minimal image to the full Raspbian Jessie with Pixel if needed.
PIXEL is not a name but an acronym. It stands for Pi Improved Xwindows Environment, Lightweight, which makes fully sense in that context.

Unzip the image

On Linux, Unix and MacOS platform there is no problem to unzip the image. But if you have a Windows operating system, the specialized forums recommend you to use 7zip to decompress the file.

For this tutorial, I will uncompress the Raspbian Jessie Lite variant and will get:
Screen Shot 2017-04-03 at 21.18.19

Alternative way (for BSD or macOS): you can unzip and burn the image in one statement:

unzip -p 2017-03-02-raspbian-jessie-lite | dd of=/dev/sdb bs=1M

Time to use strong acid to cut the metal!

Etcher (meaning) is a fantastic tool (developed with electron) to easily burn images to SD cards & USB drives. You can download it from here: link

After the installation, select the image, connect the drive (SD card), and burn it. It’s easy and simple.

Screen Shot 2017-04-03 at 21.36.35!! Do not forget to safely eject your SD card !!

When it’s done, you are welcome to plug into your RPi and enjoy your newly born OS.

Alternative tool: I can also recommend you UNetbootin to burn images to USB drives or SD cards. 


How to install your Raspberry Pi OS (Raspbian) in 4 minutes

Forget about Bash Shell, Zsh+Oh-My-Zsh is sexier!

For any developer, the terminal is THE most important daily tool. And Even if Bash and Zsh are both excellent Shells, we all have our preferences.

In my opinion, a product itself is nothing comparing to an ecosystem or a community. And this is why I love Zsh: this tool is great for my needs.

Four reasons to use Zsh over Bash:

  1. Autocorrection – try to type gir -m ‘my commit message’ in a Bash or in a Zsh to see the autocorrection in action.
  2. If you are on MacOS, your bash is old! Type a bash –version in your terminal to compare with the actual stable version 4.4.5
  3. Command completion – git and cd command completion are more powerful on Zsh than Bash.
  4. The greatest of the path replacement

Enough talk, let’s cut to the chase!


  • Internet connection
  • Homebrew
  • Admin rights

Install Zsh and Zsh-Completions

To check if you already have a version, type:

which zsh

I have already a version of Zsh on my MacOS but it isn’t the newest. So I decide to update this system-provided version using Homebrew and Zsh-Completions

brew install zsh zsh-completions

Change the default Shell to Zsh

To add or change the user database information and in particulary change the user shell, type this command:

chsh -s /usr/local/bin/zsh

Install Oh-My-Zsh

Now it’s time to get additional functionality with Oh-My-Zsh framework on top of Zsh. To do this, you will need to go back to your home directory and install Oh-My-Zsh:

cd ~
curl -L | sh

After a restart to load the Zsh shell, you can already notice the change:


[Optionally] Apply another theme and configure your .zshrc

Open the .zshrc file with your favorite text editor, for example

vim ~/.zshrc

and apply for example the theme ‘agnoster‘: at the line 9 (in my version), change it with:


save it.

Go to Powerline-Fonts, download it, unzipped, and install it:


To have some eye friendly colour combinations, we have to install Solarized Light and Solarized Dark themes. Go to, under the Download section get the lastest .zip file. Then:

unzip ~/Downloads/solarized

Go under Downloads/solarized/ and with the ‘alt’ key pressed (to bypass the macOS defenses) click on the Solarized Dark ansi.terminal and Solarized Light ansi.terminal

In the terminal preferences (Settings -> Profiles), click on Solarized Dark and then the Default button.

Screen Shot 2017-02-24 at 22.40.36.png

Finally, you should see your terminal ending like:

Screen Shot 2017-02-24 at 22.55.22.png

[Optionally] Add some plugins to your Oh-My-Zsh

You also can add some plugins to simplify your daily life. In my .zshrc file, I have replaced plugins=(git) with the following:

plugins=(git colored-man colorize github brew osx zsh-syntax-highlighting sublime xcode)


Forget about Bash Shell, Zsh+Oh-My-Zsh is sexier!

REST – the architectural style of the Web

There are numerous ways to bind a system to another such as sockets, named pipes, RPC, CORBA, RMI, Web services and shared memory to name a few of them. But why the Representational State Transfer (REST) has such an impact as architectural style for designing scalable distributed applications?

REST is an easy to use revolution

The best concept often comes with the simplest way to solve the problem. Although REST is not a standard, it is widespread due to its simplicity and ease to use and it is still a simpler alternative to SOAP, WSDL-based Web services.

Millions of people use the Web daily and thousands of us have studied what the Web is. But have we used the full potential of the World Wide Web just by jumping from one document to another through URLs over the network named Internet? Think wider!

Loose coupling

When two systems are so tight to each other, that they are not separable, then you have a monolith. This is the worst scenario of a good architecture principle which says that two systems must be independent as possible to be deployed, maintained, modified and removed with ease. This is why components communicate through interfaces and are so isolated from the others.

A web browser is loose coupled with a server since it is based on standard interfaces to communicate with a wide panel of servers, which provide a HTTP service.


Interoperability is the possibility that different systems can communicate through a determined common standard. In the Web ecosystem the standard are HTTP, URIs, XML, HTML, and so on. Most of the technologies on the Web communicate through HTTP such as SOAP, COM, CORBA and RMI. Quasi all systems support HTTP as application protocol and URIs as identifier mechanism.


A lot of technologies solicit a massive reuse of other technologies to keep the software engineering as low as possible. A reuse of existing components is a common pattern to maximise the benefit on business and growth.

In the REST world, there is just ONE interface. Each client can use this only interface to communicate with the REST service.


The user of an application does not care about the complexity of a system. What matters is the response time. So the system has to answer in a small time box. The intern architecture and the implementation will determine if the overall system will be efficient, such as computing on a multitude of clusters. REST and HTTP have not a large influence on distributed systems.

REST helps this web infrastructure’s maturity such as cache mechanism and proxies.


As the REST approach is completely stateless, meaning same request yields same result (idempotency) the question on where to hold the state or alter objects comes in place.[more to come]


[more to come]


[more to come]

REST – the architectural style of the Web

How to add a datasource to Wildfly

This tutorial explains 3 methods how to add a datasource to the application server Wildfly from Redhat. If you don’t have Wildfly installed on your machine, you can follow my other posts:


Even if these steps are driver-agnostic, the example will use MySQL Connector (in other words, the JDBC Driver for MySQL) and Wildfly 10.0.0-Final.

For the next steps, you will need:

  • Wildfly installed and started
  • MySQL, MariaDB, PostgreSQL or any datasource compatible with Wildfly
  • The RDMS started and a database created (e.g. database: tutorial)

Notice that all these 3 methods have those steps in common:

  1. Add the JDBC Driver (a.k.a. Connector)
  2. Configure you datasource

Method 1: Add datasource via Admin-Console (the easy method)

1. Add the JDBC Driver

  1. Open the console from the browser (http://localhost:9990/console for a local server)Screen Shot 2016-07-23 at 16.21.50
  2. Then in Deployments, to add to open the wizardScreen Shot 2016-07-23 at 16.25.10
  3. After having clicked next, upload your Connector (i.e. JDBC Driver)Screen Shot 2016-07-23 at 16.26.50Here is the MySQL page to download the driver: MySQL Connector URL
  4. After uploading it, you may want to change the connector name. My recommendation is to name your connector with the provider-name, type and the project’s name that will use it, since your application server my have some projects with different versions of the same connector provider. Screen Shot 2016-07-23 at 16.34.17Note that the name is how the deployment is known to the users and must be unique. The runtime name is how is known to the server. This way you may have multiple names but refering to the same runtime name.
    Do not forget to enable your new deployment! (It should be enabled by default)
  5. Press finish to deploy your connector to your application server.

2. Configure you datasource

  1. Add a new datasource by clicking on ‘Start’ on the right of ‘Create a Datasource’. This will define a datasource to be used by deployed applications.
    Screen Shot 2016-07-23 at 16.48.22
  2. Then select ‘Subsystems’ and ‘Datasources’ and either Non-XA or XA depending of your project type. This tutorial needs a Non-XA datasource. Then click ‘Add’.
    Screen Shot 2016-07-23 at 16.53.52
  3. Then click ‘Add’, choose your datasource (MySQL Datasource for this tutorial) and click next.
    Screen Shot 2016-07-23 at 16.55.30
  4. Give to the attributes name and a JNDI name to your datasource. The JNDI name is like a name in a directory service allowing your programs to discover the data and object. Both name and JNDI name have to be unique. Then click ‘next’.
    Screen Shot 2016-07-23 at 17.00.40
  5. Then select your JDBC Driver you have deployed before. To do that, click on ‘Detected Driver’ and select it and click ‘next’
    Screen Shot 2016-07-23 at 17.27.23
  6. Then add the attributes you will need to connect to your RDMS server.
    Screen Shot 2016-07-23 at 17.53.37
  7. On the next screen, you can easily test your connection. In case of failure, the details will guide you to the solution.
    Screen Shot 2016-07-23 at 18.03.07

Pros / Cons

+ Easy to configure
+ No coding
– Need to use the management console, could be a security issue for a company
– Need to reboot your server to add a datasource.

Method 2: Add datasource via standalone.xml

The file that configures your server is named ‘standalone.xml’ and it is located in your wildfly installation directory under:


Important: The management console is updating the standalone.xml. Hence all we have done in method 1 is actually an abstraction of what we will do here.

1. Add the JDBC Driver

  1. With help of your window manager, go under
  2. Then create a subdirectory for your JDBC Driver representing the package structure of your Connector. So create the subfolder:
  3. Copy your JDBC Driver into the directory you have just created.
  4. Create a XML file in the directory named module.xml.
  5. $ pwd
    $ cd modules/system/layers/base/com/mysql/
    $ touch module.xml
  6. Then copy this into the module.xml you created:
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.3" name="com.mysql">
        <resource-root path="mysql-connector-java-5.1.39-bin.jar"/>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
  7. Edit the standalone.xml file located:
  8. Find the <drivers> element (after the <datasource> element). Then add this snippet:
     <driver name="mysql" module="com.mysql">
  9. That’s it, the driver has been added to Wildfly. Now let’s configure the datasource.

2. Configure you datasource

  1. Just above the driver snippet, add this datasoure snippet:
    <datasource jta="true" jndi-name="java:/MySqlDS" pool-name="MySqlDS" enabled="true" use-ccm="true">
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>

    Make sure that the name of the driver (between the <driver> element are the name given to your driver). You can also configure the username, password and database name.

  2. Restart Wildfly and verify by checking the connection to the database through the mangement console:
    Screen Shot 2016-07-23 at 18.03.07

Pros / Cons

+ Standanlone.xml file can be part of your deployment, which is handy.
– Critical if multiple application run on the same server.
– Need to reboot your server to add a datasource.

Method 3: Add datasource via CLI

CLI stands for Command Line Interface and is a command line management tool for JBoss Application Server. It allows a developer / operator to execute management operations and includes these features:


  • connect to the specific controller or server instance;
  • view the available managed components, their attributes and operations;
  • deploy and undeploy standard packages at runtime in standalone and domain modes;

The two main advantages of the CLI is:

  • You can automate your interactation with Wildfly through a script.
  • You can run this on a running Wildfly server.

The CLI is located at:


1. Add the JDBC Driver

  1. Start the command line interface with the following command:
    ./ --connect controller=
  2. Then install the JDBC jar by loading it into a module.
    module add --name=com.mysql --resources=~/Downloads/mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar --dependencies=javax.api,javax.transaction.api

    Important: pay attention to where to add a space, and where not to add a space, this is scripting 😉

2. Configure you datasource

  1. Add the driver to the data-sources subsystem.

    It returns {“outcome” => “success”} in case of success.

  2. Create the datasource that uses the JDBC driver we just installed.
    data-source add --jndi-name=java:/MySqlDS --name=MySqlPool --connection-url=jdbc:mysql://localhost:3306/mysqldb --driver-name=mysql --user-name=root
  3. Test your connection and that’s it.Screen Shot 2016-07-23 at 18.03.07

    Pros / Cons

    + Best option from a dev-ops perspective. A script can be run before deploying an application and the script can be part of your deployment as well.
    + Plays very well with technologies like Docker.
    + Configuration can be changed at runtime! So no reboot required.


byteslounge: container vs application managed entity manager

mastertheboss: configuring a datasource with postgresql and wildfly

Thanks to

  • David Kühner for the technical review

How to add a datasource to Wildfly

How to install MariaDB on Mac

Like the Wildfly Application Server installation, we will install MariaDB through Homebrew, the package management software.

Compiling MariaDB

Open a terminal and type

macbookpro$ brew update
macbookpro$ brew search mariadb

mariadb                                   mariadb-connector-c                                                                                                   
homebrew/versions/mariadb100              Caskroom/cask/navicat-for-mariadb                                                                                     
macbookpro$ brew install mariadb
==> Installing dependencies for mariadb: openssl
==> Installing mariadb dependency: openssl
==> Downloading
######################################################################## 100.0%
==> Pouring openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in

and run

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2h_1: 1,691 files, 12M
==> Installing mariadb
==> Downloading
######################################################################## 100.0%
==> Pouring mariadb-10.1.15.el_capitan.bottle.tar.gz
==> /usr/local/Cellar/mariadb/10.1.15/bin/mysql_install_db --verbose --user=philippe.wanner --basedir=/usr/local/Cellar/mariadb/10.1.15 --datadir=/usr/local/var/mysql --tmpdir=/tmp
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To have launchd start mariadb now and restart at login:
  brew services start mariadb
Or, if you don't want/need a background service you can just run:
  mysql.server start
==> Summary
🍺  /usr/local/Cellar/mariadb/10.1.15: 573 files, 137.1M

Run the MariaDB installer

macbookpro$ unset TMPDIR
macbookpro$ mysql_install_db

Then you see the following

Installing MariaDB/MySQL system tables in '/usr/local/var/mysql' ...
2016-07-03 13:37:37 140735229489152 [Note] /usr/local/Cellar/mariadb/10.1.15/bin/mysqld (mysqld 10.1.15-MariaDB) starting as process 13274 ...
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Memory barrier is not used
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Compressed tables use zlib 1.2.5
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Using SSE crc32 instructions
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Completed initialization of buffer pool
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Waiting for purge to start
2016-07-03 13:37:37 140735229489152 [Note] InnoDB:  Percona XtraDB ( 5.6.30-76.3 started; log sequence number 1616819
2016-07-03 13:37:37 123145313034240 [Note] InnoDB: Dumping buffer pool(s) not yet started
Filling help tables...
2016-07-03 13:37:39 140735229489152 [Note] /usr/local/Cellar/mariadb/10.1.15/bin/mysqld (mysqld 10.1.15-MariaDB) starting as process 13278 ...
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Memory barrier is not used
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Compressed tables use zlib 1.2.5
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Using SSE crc32 instructions
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Completed initialization of buffer pool
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Waiting for purge to start
2016-07-03 13:37:39 140735229489152 [Note] InnoDB:  Percona XtraDB ( 5.6.30-76.3 started; log sequence number 1616829
2016-07-03 13:37:39 123145313034240 [Note] InnoDB: Dumping buffer pool(s) not yet started
Creating OpenGIS required SP-s...
2016-07-03 13:37:42 140735229489152 [Note] /usr/local/Cellar/mariadb/10.1.15/bin/mysqld (mysqld 10.1.15-MariaDB) starting as process 13282 ...
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Memory barrier is not used
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Compressed tables use zlib 1.2.5
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Using SSE crc32 instructions
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Completed initialization of buffer pool
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Waiting for purge to start
2016-07-03 13:37:42 140735229489152 [Note] InnoDB:  Percona XtraDB ( 5.6.30-76.3 started; log sequence number 1616839
2016-07-03 13:37:42 123145313034240 [Note] InnoDB: Dumping buffer pool(s) not yet started

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

To do so, start the server, then issue the following commands:

'/usr/local/Cellar/mariadb/10.1.15/bin/mysqladmin' -u root password 'new-password'
'/usr/local/Cellar/mariadb/10.1.15/bin/mysqladmin' -u root -h Philippes-MacBook-Pro.local password 'new-password'

Alternatively you can run:

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr/local/Cellar/mariadb/10.1.15' ; /usr/local/Cellar/mariadb/10.1.15/bin/mysqld_safe --datadir='/usr/local/var/mysql'

You can test the MariaDB daemon with
cd '/usr/local/Cellar/mariadb/10.1.15/mysql-test' ; perl

Please report any problems at

The latest information about MariaDB is available at
You can find additional information about the MySQL part at:
Support MariaDB development by buying support/new features from MariaDB
Corporation Ab. You can contact us about this at
Alternatively consider joining our community based development effort:

Start MariaDB Server

You have two way to do this:

Run MariaDB through Homebrew

[Once] Install the brew services (if not yet done)

macbookpro$ brew tap homebrew/services
==> Tapping homebrew/services
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'...
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
Checking connectivity... done.
Tapped 0 formulae (32 files, 46.2K)

Run brew service MariaDB

macbookpro$ brew services start mariadb
==> Successfully started `mariadb` (label: homebrew.mxcl.mariadb)

Note that the following brew services command also exist:

  • brew services restart mariadb
  • brew services stop mariadb

Run MariaDB in background process

macbookpro$ mysql.server start
Starting MySQL

Use MariaDB

macbookpro$ mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.15-MariaDB Homebrew

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
How to install MariaDB on Mac

How to install Wildfly on Mac

The easiest way is to install through Homebrew, the free open-source package managment system.

Install Wildfly

Download and install through brew package managment

macbookpro$ brew update
Already up-to-date.
macbookpro$ brew search wildfly
macbookpro$ brew install wildfly-as
==> Downloading
##########                                                                14.6%
==> Caveats
The home of WildFly Application Server 10 is:
You may want to add the following to your .bash_profile:
  export JBOSS_HOME=/usr/local/opt/wildfly-as/libexec
  export PATH=${PATH}:${JBOSS_HOME}/bin
==> Summary
🍺  /usr/local/Cellar/wildfly-as/10.0.0.Final: 1,180 files, 153.4M, built in 7 minutes 18 seconds

And you are almost all set.

Add the environment variables

macbookpro$ cd /usr/local/opt/wildfly-as/libexec/bin
macbookpro$ ./

  JBoss Bootstrap Environment

  JBOSS_HOME: /usr/local/opt/wildfly-as/libexec

  JAVA: java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true


12:49:37,085 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
12:49:38,033 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
12:49:38,115 INFO  [] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
12:49:38,974 INFO  [] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
12:49:38,987 INFO  [org.xnio] (MSC service thread 1-6) XNIO version 3.3.4.Final
12:49:38,992 INFO  [org.xnio.nio] (MSC service thread 1-6) XNIO NIO Implementation Version 3.3.4.Final
12:49:39,023 WARN  [] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
12:49:39,034 INFO  [] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
12:49:39,038 INFO  [] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
12:49:39,046 INFO  [] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
12:49:39,081 INFO  [] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
12:49:39,088 INFO  [] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
12:49:39,105 INFO  [] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
12:49:39,111 INFO  [] (MSC service thread 1-1) WFLYSEC0001: Current PicketBox version=4.9.4.Final
12:49:39,112 INFO  [] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
12:49:39,121 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.3.15.Final starting
12:49:39,121 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0003: Undertow 1.3.15.Final starting
12:49:39,122 INFO  [] (MSC service thread 1-8) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)
12:49:39,135 INFO  [] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2
12:49:39,159 INFO  [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 4.0.18.Final
12:49:39,194 INFO  [] (MSC service thread 1-5) WFLYNAM0003: Starting Naming Service
12:49:39,194 INFO  [] (MSC service thread 1-4) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
12:49:39,317 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path '/usr/local/opt/wildfly-as/libexec/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
12:49:39,347 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0012: Started server default-server.
12:49:39,349 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0018: Host default-host starting
12:49:39,393 INFO  [] (MSC service thread 1-3) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 32 (per class), which is derived from the number of CPUs on this host.
12:49:39,393 INFO  [] (MSC service thread 1-2) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 128 (per class), which is derived from thread worker pool sizing.
12:49:39,457 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTP listener default listening on
12:49:39,541 INFO  [] (MSC service thread 1-5) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
12:49:39,647 INFO  [] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory /usr/local/opt/wildfly-as/libexec/standalone/deployments
12:49:39,815 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-1) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
12:49:39,815 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-7) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
12:49:39,815 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-3) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
12:49:39,872 INFO  [] (MSC service thread 1-5) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4) 
12:49:40,088 INFO  [] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on
12:49:40,088 INFO  [] (Controller Boot Thread) WFLYSRV0051: Admin console listening on
12:49:40,089 INFO  [] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 3425ms - Started 267 of 553 services (371 services are lazy, passive or on-demand)

 [Optional] Add user to manage the server

macbookpro$ ./ 
What type of user do you wish to add? 
 a) Management User ( 
 b) Application User (
(a): a

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : philippe.wanner
Password recommendations are listed below. To modify these restrictions edit the configuration file.
 - The password should be different from the username
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password : 
WFLYDM0101: Password should have at least 1 digit.
Are you sure you want to use the password entered yes/no? yes
Re-enter Password : 
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]:    
About to add user 'philippe.wanner' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'philippe.wanner' to file '/usr/local/Cellar/wildfly-as/10.0.0.Final/libexec/standalone/configuration/'
Added user 'philippe.wanner' to file '/usr/local/Cellar/wildfly-as/10.0.0.Final/libexec/domain/configuration/'
Added user 'philippe.wanner' with groups  to file '/usr/local/Cellar/wildfly-as/10.0.0.Final/libexec/standalone/configuration/'
Added user 'philippe.wanner' with groups  to file '/usr/local/Cellar/wildfly-as/10.0.0.Final/libexec/domain/configuration/'
Is this new user going to be used for one AS process to connect to another AS process? 
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? no

Log in the management console

Go to http://localhost:9990/console/ and enter your credentials

Screen Shot 2016-07-03 at 13.11.03

And then you get your dashboard

Screen Shot 2016-07-03 at 13.14.26.png

How to install Wildfly on Mac

Java EE 7: The Big Picture

This is my personal summary of the book “Java EE 7: The Big Picture – Master the code, Applications, and Frameworks of Java Platform, Enterprise Edition 7” from Dr. Danny Coward.

Chapter 1: The Big Picture

Java EE Architecture


  • Java EE container (‘Java EE’)
    • Runtime environment provided by the Java EE application server.
    • All the Java EE code runs in this environment.
    • Can mediate or intercept calls to and from the application code, and insert other kinds of logic that qualify and modify the calls to and from the application.
      Example: The security service that the Java EE container provides: the Java EE container can enforce security rules on the application that is running.
    • Supports a wide variety of protocols that clients may use to interact with a running Java EE application. Example: HTTP, WebSockets, RMI
    • Contains a variety of services that a Java EE application may choose to use:
      • Security: restrict access to its functions to only a certain set of known users.
      • Dependency Injection (DI): delegate the lifecycle management and discovery of some of its core components.
      • Transaction: define collections of methods that modify application data in such a way that either all the methods must complete successfully, or the whole set of method executions is rolled back as though nothing has ever happened.
      • Java Message Service (JMS): reliably send messages to other servers in the deployment environment of the Java EE application server.
      • Persistence service: enable application data in the form of a Java object to be synchronized with its equivalent form in the tables of a relational database.
      • JavaMail service: send email. Useful in the kind of application that take some action initiated by and on behalf of a user, and which needs to notify the user at some later time of the outcome of the action.
      • Java EE Connector Architecture (JCA): framework into which a new service that is not a standard part of the Java EE plaform may be added and that can then be utilized by a Java application running in the plaform.
      • Java Database Connectivity (JDBC) API: supports traditional storage and retrieval of Java EE application data in a relational database using the SQL query language.
  • Web container
    • Runs the web components: web pages, Java servlets, and other web components that can interact with clients connecting to the Java EE application with standard web protocols.
  • Enterprise JavaBeans (EJB) container 
    • Runs the application logic
    • EJB are Java classes that contain and manipulate the core data structures
  • Database tier
    • Holds all application data that the Java EE application needs to exists longer than the scope of a single session of the application, or simply between different steps in the application that are separated in time.

Hello World Application


Structure of the Java EE application

  • DisplayServlet is responsible for :
    • rendering the web page seen from the browser
    • creating the HTML elements that make up the web page
    • displaying the message that the Java EE application is holding
  • WriteServlet is responsible for:
    • processing the message that is input to the application
    • passing the hello-message and formulates a Java object from the Message class that is part of the application
    • passing the message to an Enterprise Bean component, called ModelEJB.
  • ModelEJB is responsible for:
    • processing the message and formulates a Java object from the Message class.
    • storing the message object in the database using the Java Persistance API (JPA).
    • retrieve the message in DB on behalf of the DisplayServlet, when the servlet needs to create the web page to display.


  • Browser client: render the HTML content that the Java EE application creates for it, and send a message typed in by the user.
  • Web components (DisplayServlet and WriteServlet): create the HTML content for the browser and to direct the incoming user message to the correct portion of the application that can handle the message processing logic (ModelEJB).
  • ModelEJB: process, store and retrieve the user message to the database.

WriteServlet code

The browser formulates an HTTP POST request and sends it to the Java EE server, to a URL that will look like http://localhost:8080/HelloJavaEE-war/WriteServlet. As you shall see, the WriteServlet is mapped to the WriteServlet, and because of this fact, the Java EE server routes the HTTP POST request to the WriteServlet. Remark: this web component intercepts HTTP POST requests, because it has a doPost() method. WriteServlet is a HttpServlet.

@WebServlet(name = "WriteServlet", urlPatterns = {"/WriteServlet"})
public class WriteServlet extends HttpServlet {
  private ModelEJB ModelEJB;
  private static String PUT_MESSAGE = "put_message";

  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String message = request.getParameter(PUT_MESSAGE);
    if ("".equals(message)) {
    } else {
      try {
      } catch (MessageException nme) {
        throw new ServletException(nme);
} }

Notice that there is no constructor. In fact, the Java EE containers manage the lifecycle of components. In particular, the web container manages the lifecycle of Java servlet components, so the developer can focus on the application logic instead.

ModelEJB code

The ModelEJB is an Enterprise Bean, which is mostly a Plain Old Java Object (POJO).

public class ModelEJB {
  private EntityManagerFactory emf;
  public void putUserMessage(String messageString) throws MessageException {
    try {
      String decodedMessage = URLDecoder.decode(messageString, "UTF-8");
      Message message = new Message("1", "(" + messageString + ")" + " in a database");
      EntityManager em = emf.createEntityManager();
    } catch (UnsupportedEncodingException uee ) {
      throw new MessageException("something odd about that message..." + messageString);

  public String getStoredMessage() throws MessageException {
    EntityManager em = emf.createEntityManager();
    List messages = em.createNamedQuery("findMessages").getResultList();
    if (messages.size() > 0) {
      Message message = (Message) messages.get(0);
      return "(" + message.getMessageString() + "), inside an EJB";
    } else {
      throw new MessageException("There was nothing in the database.");

  public void deleteMessage() {
    EntityManager em = emf.createEntityManager();
} }

What makes this Java class an Enterprise Bean is the annotation @Stateful. This means that the Enterprise Bean container will create one instance of the bean for each client that talks to it.

Message class code

Looks like a normal class but has been annotated with @Entity. Because of that it can be persisted and managed within a database.

@Table(name = "MESSAGE")
    query="select m from Message m"),
    query="delete from Message"
public class Message implements Serializable {
  @Column(name = "ID")
  private String id;

  @Column(name = "MESSAGE")
  private String messageString;
  public Message() {

  public Message(String id, String messageString) { = id;
    this.messageString = messageString;

  ... //getters and setters

DisplayServlet code

This servlet queries the ModelEJB for the stored message and create the HTML that forms the web page that is shown to the user. It has a doGet() method so that it will intercept any HTTP GET requests.

@WebServlet(name = "DisplayServlet", urlPatterns = {"/DisplayServlet"})
public class DisplayServlet extends HttpServlet {
  private ModelEJB modelEJB;

  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    try {
      out.println("<title>Hello Java EE</title>");
      out.println("Enter a message for Java EE which will pass through the web tier, the EJB tier to the database, and back again !");
      out.println("<form action='./WriteServlet' method='POST'>");
      out.println("<input type='submit' value='Enter'>");
      out.println("<input type='text' name='put_message'> ");
      String displayMessage;
      try {
        String storedMessage = modelEJB.getStoredMessage();
        displayMessage = "Hello from (" + storedMessage + "), inside a web component";
      } catch (MessageException nme) {
        displayMessage = "you should enter a value...";
      out.println("The current message from Java EE: <br><b>" + displayMessage + "</b>");
    } finally {
} } }

The Many Variations of Java EE Applications

Many Flavors of Web Interface

  • Original purpose: replace CGI programming and kind of all-purpose server-side component model for handling any request/response style network protocol, not just HTTP.
  • Inconvenience: as seen, embedding HTML inside Java code is too cumbersome approach. But Java EE offers a superior web component model to generate dynamic web content for browsers of all kinds: JavaServer Pages (JSP) and JavaServer Faces (JSF). Both are based on Java servlets.
  • Java EE platform contains a variety of web components that can handle and respond to incoming web service calls. Known as Java Web Service components, these components are to both Simple Object Access Protocol (SOAP) and to Representational State Transfer (REST) web services what Java servlets, JSPs, and JSF are to HTML content.
  • WebSockets are web components that give a server component the ability to send data out to interested clients.

Many Kinds of Application Logic

  • Statefull session beans
    • are instantied by the EJB container each time a new client wishes to uses it.
    • hold its application state for each of its connected clients.
    • E.g.: shopping cart
  • Stateless session beans
    • are brought into existence  each time they are called.
    • perform very well in large-scale systems, beause these beans are instantiated only when needed and can easily be instantiated on a node in a cluster.
  • Singleton session beans
    • are ideal for representing an application state that is common to all connected clients of the application
    • are instantiated only once in the Java EE application
    • E.g.: modeling a news feed viewable by all logged-in users, or a high score table.
  • Message-driven beans
    • offer a programming model wherein instead of making method invocations, tasks are initiated by sending a message, with task completion occuring asynchronously with the sending of another message.
    • Well suited for long-running activities, such as backing up large amounts of data, handling a complicated purchase order.

Different Ways to Store Application Data

  • JPA (Java Persistence API) offers a high-level framework with which applications perform object-relational mapping: data objects you want to model can easily be translated into equivalent data tables in a relational database, which can be a shortcut to designing relational schemas and the various queries needed to store and retrieve the data.
  • JDBC (Java Database Connectivity) API models connections to the relational database and the execution of SQL statements to store, manage, and retrieve that data.
  • Java Transaction API allows multiple activities to be grouped into a single atomic action that either succeeds, meaning each member of the atomic action succeeds, or fails, in which case the individual activities that completed before the failure are reversed, in which case the overall effect is as though nothing had happened.

Interfacing with Other Systems

  • Java web services APIs
    • not a framework of reliable messaging
    • allows for loosely coupled interactions, where systems evolve and add functionality separately from their peers without disrupting a working system.
    • E.g.: analytics servers, purchasing systems, order management servers
  • Java Message Service
    • provides reliable asynchronous message mechanism
    • E.g.: financial purchase transaction, ordering a part number, or requesting a delivery scheme in order to complete its work.
  • Java EE Connector Architecture
    • is a all-purpose extensibility mechanism
    • enables a class of Java EE applications that uses it to rely on arbitrary external information systems.

Packing and Deploying the Hello Java EE Application

The Hello Java EE application consists of web components and an Enterprise Bean and data code.

Web ARchive file (WAR)

  • is the vehicle for deploying the web components in a Java EE application
  • is a kind of ZIP file, with a predefined structure consisting of a
    • root directory to hold any textual web pages such as HTML pages, JSP, or JSF files.
    • /WEB-INF directory under which any Java class files they need, such as Java servlets, are held, in addition to other configuration information.

Enterprise Bean JAR

  • packages the Enterprise Bean code in a archive
  • uses the /META-INF directory to store configuration information about the Enterprise Beans it contains, together with the class files that the beans use at the root level of the archive.
  • held the persistence.xml in the META-INF directory to ensure that ModelEJB can access the database through the Java Persistence layer.

Enterprise ARchive (EAR)

  • allows a Java EE application to be packed into one single, self-contained file.
  • /META-INF held the configuration information

Screen Shot 2016-06-18 at 21.48.18.pngOnce a Java EE application has been package into this form, it can be deployed to any Java EE server.


Java EE 7: The Big Picture

How to install WildFly on Windows

Formerly known as JBoss AS or simply JBoss, WildFly is a fantastic full-featured multiplaform open-source and free application server authored by Red Hat.

This quick tutorial will list the steps to install this AS on a Windows machine.

PREREQUISITE: Install the lastest Java Development Kit (JDK)

To be able to run the AS, you will need a compatible JDK (JDK 7 Update 75 or later), if possible the lastest available on the Oracle website.

  1. Go to this link and download the lastest JDK (e.g. jdk-8u91-windows-x64.exe).
  2. Change the installation directory to c:\Java\jdk{your-version} (e.g. jdk1.8.0_91)screen1This should be like:screen2
  3. Create an environment variable JAVA_HOME for your system.
    1. On your keyboard, press windows+break
    2. Click on ‘Advanced System Configuration’
    3. Under ‘Environment variables’, add the variable JAVA_HOME with values ‘c:\Java\jdk{your-version}’screen3
    4. And add it to the Path variablescreen4
    5. You will need to close any command windows that were open before executing a command with this path, since there is no way to reload environment variables from an active command prompt.
    6. To check if the path variable is correctly configured, type ‘javac -version’ in the prompt. This will give you the version of the java compiler you installed.screen5

Installing WildFly 10

  1. Download the lastest stable version of the Enterprise Application Integration (EAI) server from the official website (Link). (E.g.
  2. Extract the zip archive to C:\EAI. Your system will create a brand new folder named ‘wildfly-10.0.0.Final’ under C:\EAI.
  3. Execute the script ‘C:\EAI\wildfly-10.0.0.Final\bin\standalone.bat‘ to set up the bootstrap environment, check the installation and start the server.screen6
  4. After that the server has been started, you should be able to access the web server at the address http://localhost:8080 and to access to the console at http://localhost:8080/console.screen7

Configure WildFly server

Add a user to access to the console

To be able to access the admin console, you will need to add a new user by executing the script ‘add-user.bat’ located under your WildFly installation folder (e.g. c:\EAI\wildfly-10.0.0.Final).

  1. Execute the script ‘add-user.bat’ in a console window.
  2. Add a Management User by just typing ‘enter’ since this is the default option.screen0
  3. Enter the details of the new user to add as described. (e.g. ‘admin’ and ‘1234’ for a local installation).
  4. Revisit the server console at localhost:9990/console and enter your credentials.
  5. Now, you should be able to see thisscreen1
How to install WildFly on Windows