From Glassfish to Wildfly - Shared lib dir - part 3

Shared lib dir in Wildfly

In glassifsh I was using a domains/domain1/lib/ directory as shared directory where to put all jars needed by all applications (ear, war, jar)

When install wildfly sure you will search for similiar directory..
Wildfly hasn't a shared lib directory, but are using a module concept and other classloading system.

You can install module, global module or follow the next solution.

I make different EAR which group some jars.
For example PdfBoxLibEar where I put pdfbox jar, itext jar, xmlworker jar.

When making the ear be sure that the jar embedded is deployed in lib/ directory of ear.

Then When an application foo needs to PdfBoxLibEar write in the following:

Manifest-Version: 1.0
Dependencies: deployment. LIB_PdfBoxLibEar.ear export, deployment. OTHER_LIB.ear export,

deployment is location where ear is deployed by default.
export is a keyword for make the library available also with internal ear modules(i.e. war or ejb)

From Glassfish to Wildfly - Autodeploy directory - part 2

In glassfish you have /autodeploy directory where to put ear, war and jar in order to auto deploy it in application server.

In Wildfly there is also autodeploy dir.. /opt/wildfly/standalone/deployments/

When you put an application in the directory deployment scanner start and deploy automatically the application.

I notice that deployment scanner stop to works when a large file is upload to server.
The deployment scanner see incomplete file and wait for completition.. but in 8.1 wildfly it stops and deployment scanner stop to works until next restart.

In order to avoid this problem

Make other directory for uploading
Put in crontab(i.e. every 2 minute) the following script

#touch "$AUTODEPLOY_DIR"avoid_empty_dir_error
for filename in $AUTODEPLOY_DIR*.*ar; do
#for filename in 'find /home/myftp/autodeploy -name "*.*ar"'; do
if [ "$filename" = "$AUTODEPLOY_DIR*.*ar" ]; then
echo "nofiles"
       fuser1=$(/sbin/fuser "$filename")
       if [[ -z "${fuser1}" ]];
               echo "move and rename the file"
                #file non usato da nessun processo, copia terminata
               /bin/cp $filename $WILDFLY_DEPLOY_DIR #uso bin/cp in modo da non chiedere overwrite
               mv $filename $filename.bak
       else echo "copia ftp in corso" #copia in corso

that copy the *.ar file from autodeploy dir to wildfly real autodeploy dir only when the file transfer is complete!

From Glassfish to Wildfly - part 1

How to install wildfly on linux?

Simply by download and launching the following wonderful script:
Wildfly is installed in /opt/wildfly
You can launch Wildfly by using /etc/init.d/wildfly start

Open Port and Remote Access

Find and launch in order to add user for management realm.
It is necessary for web console admin.

Find and edit standalone.xml in socketbinding section edit the default port if you want.

Enable for web console listener

Root User or not?

By default wildfly is installed and launched as wildfly user.
I think it is the best way.
But I'm migrating from glassfish (i.e. installaed and launched as root user) so all files writed by glassfish applications have root file permission.

So the better solution is to change all file permission from root to wildfly.
Alternative editing /etc/default/wildfly.conf and launch wildfly as root.

MySql Driver

Download from mysql site the connector j.
Access to web admin console and deploy it
(You can also deploy by using autodeploy dir into /opt/wildfly/standalone/deployments/)