1 Reply Latest reply on Oct 9, 2018 9:55 AM by simkam

    Multiple global module

    Alain GREGOIRE Newbie

      Hi,

       

      I have a Docker image process executing many CLI file (execute.sh).

      The content of execute.sh is

       

      #!/bin/bash

       

      # Usage: execute.sh [WildFly mode] [configuration file]

      #

      # The default mode is 'standalone' and default configuration is based on the

      # mode. It can be 'standalone.xml' or 'domain.xml'.

       

      JBOSS_HOME=/opt/jboss/wildfly

      JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh

      JBOSS_MODE=${1:-"standalone"}

      JBOSS_CONFIG=${2:-"$JBOSS_MODE-full.xml"}

       

      function wait_for_server() {

        until `$JBOSS_CLI -c "ls /deployment" &> /dev/null`; do

          sleep 1

        done

      }

       

      echo "=> Starting WildFly server"

      $JBOSS_HOME/bin/$JBOSS_MODE.sh -c $JBOSS_CONFIG > /dev/null &

       

      echo "=> Waiting for the server to boot"

      wait_for_server

       

      #we will execute sequentially all the cli files in the current directory

      echo "=> Executing cli files"

       

      for file in `dirname "$0"`/*;

      do

        if [ "${file##*.}" = "cli" ]; then

          echo "Launching JBoss CLI script [$file]";

          $JBOSS_CLI -c --file=$file;

        fi

      done

       

      echo "=> Shutting down WildFly"

      if [ "$JBOSS_MODE" = "standalone" ]; then

        $JBOSS_CLI -c ":shutdown"

      else

        $JBOSS_CLI -c "/host=*:shutdown"

      fi

       

      Wildfly is started, scripts are executed and then Wildfly is stopped.

       

      2 of these scripts are setting a global module. The first one is :

      /subsystem=ee:write-attribute(name="global-modules",value=[{"name" => "eu.europa.ec.ecas","slot" => "main"}])

       

      and the second one is:

      /subsystem=ee:write-attribute(name="global-modules",value=[{"name" => "javax.jms.api","slot" => "main"}])

       

      Only the second one is kept so does it mean this command is a "set" and not a "add" ?

      If yes, how can I add a global-module if others modules have been already set ?

       

      Regards,

      GREGOIRE Alain.

        • 1. Re: Multiple global module
          simkam Newbie

          Hi,

           

          you can add more global modules by putting more "objects" to value list:

          /subsystem=ee:write-attribute(name="global-modules",value=[{"name" => "javax.jms.api","slot" => "main"}, {name => "org.hibernate", slot => "main"}])

           

          or use :list-add function:

          /subsystem=ee:list-add(name=global-modules, value={name = "org.hibernate", slot = main})

          /subsystem=ee:list-add(name=global-modules, value={name = "javax.jms.api", slot = main}