Installing a JBoss AS 7 module using the CLI

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

The release 7.2 of JBoss AS introduces the capability to install a module using the Command Line Interface. In this tutorial we will show how you can install a data source as a module using a CLI script.

 Modules are the heart of the new application server release. If you want to install a library as a module, in order to share with your applications, you have to create a directory structure for it and add the module.xml file descriptor and the JAR libraries. See this tutorial for more information about installing a module on your AS 7 file system.

This might be a little lenghty approach or simply it can be you don't have access to the JBoss AS file system. (e.g. a remote server installation). In order to install modules using the CLI, you have to download a JBoss AS 7.2 latest build from Jenkins

As you can see, once you connect with the CLI (jboss-cli.cmd / some new commands are available, by pressing the tab key.

jboss as 7 module cli

The command we will use is "module" and you need to provide three arguments: the module name, the resources (JAR files) and the dependencies used. Optionally you can add a module slot, in case your module uses several different implementations.

Here's the script for creating a MySQL module (line 1) + driver (line 2) + data source (line 3).

module add --name=org.mysql --resources=mysql-connector-java-5.1.18-bin.jar --dependencies=javax.api,javax.transaction.api




/subsystem=datasources/data-source=MySQLDS:add(jndi-name=java:jboss/datasources/MySQLDS, driver-name=mysql, connection-url=jdbc:mysql://localhost:3306/as7development,user-name=root,password=admin)


Related articles available on

How do I get the list of MBeans with twiddle?

  JBoss provides a simple command line tool that allows for inte

How to count active session with twiddle ?

  There are some well known alternatives to count the number of

How do I run garbage collector from shell?

  You can suggest JBoss to run the garbage collector in differen

How do I check my application status from shell?

  This is a two process step: at first you need to retrieve the

How do you shut down multiple JBoss instances?

  Supposing you have configured 2 instances of JBoss, one on por

twiddle reference guide

JBoss provides a simple command line tool that allows for interac