Featured Posts
  • How to download JBoss Server ?

    How to download JBoss Server ?

    Hi, JBoss is worlds one of the most popular and reliable application server which provides you a lots of features including full customization.  It comes in two flavours 1). JBoss Community Release 2). JBoss RedHat Enterprise Release Community Versus Enterprise JBoss Which one is Best? [youtube iNFV0r9v14g] The JBoss Community releases are the base of JBoss ...

    Read More

  • 4 ways to connect JBoss AS 7 using CLI

    4 ways to connect JBoss AS 7 using CLI

    With JBoss AS 7 Command Line Interface (CLI) has been introduced. Using CLI one can connect to the AS7 domain controller as well as to a standalone server and execute management operations like deploy, undeploy applications, create/delete queue, create/delete topics, create/delete data sources etc. In earlier release JBoss used ...

    Read More

  • Allow JBoss AS7 to reflect the changes made in the JSP files

    Allow JBoss AS7 to reflect the changes made in the JSP files

    Hi, Many times in development mode when we work then it is desired that as soon as we make any changes in the JSP based applications the the changes should be immediately reflected in the browser. So in this article we will see what configuration changes we need to make in ...

    Read More

  • Fetching Client IP Address and Header information in JBoss AS7 access log

    Fetching Client IP Address and Header information in JBoss AS7 access log

    Hi, Many times and usually in production environments it is desired to generate the "access.log" file separately for different web applications so that we can monitor how the users are accessing the application, from what all IP Addresses/Hostnames the clients are accessing the application. We also want to monitor sometimes that ...

    Read More

  • EE6 feature @Resource(lookup=”string”)  in JBoss AS7

    EE6 feature @Resource(lookup=string) in JBoss AS7

    Hi, Here we are going to see the usecase of EE6 specific javax.annotation.Resource annotation in JBoss AS7, The Resource annotation marks a resource that is needed by the application. This annotation may be applied to an application component class, or to fields or methods of the component class. When the ...

    Read More

  • Steps to create Windows service for JBoss AS 7

    Steps to create Windows service for JBoss AS 7

    With JBoss AS 7 lot of things have change for good and if you have noticed a lot of previous scripts have been removed due to which creating a Windows service for JBoss AS7 becomes little tricky, hence with this article we would help you create a Windows service for ...

    Read More

  • Enabling security audit logging in JBoss AS7

    Enabling security audit logging in JBoss AS7

    Hi, Most of the time in production environments it is desired to have the audit logging. Which contains the information and activities logged by the logged in user inside the audit.log. Enabling the "audit.log" logging is little different in JBoss AS7 compared to JBoss AS6, as there has been a ...

    Read More

  • How to create a Service Archieve SAR file in JBoss AS7

    How to create a Service Archieve SAR file in JBoss AS7

    Hi, SAR files are called as Service Archives. The extension of SAR files are *.sar which contains a "META-INF/jboss-service.xml" file, this file describes the custom MBeans which has to be exposed at the time of deployment or JBoss Startup. JBoss's service archive architecture is based on the JMX and the SAR ...

    Read More

  • Deploy and undeploy applicaitons using CLI in JBoss AS 7

    Deploy and undeploy applicaitons using CLI in JBoss AS 7

    With JBoss AS 7 Command Line Interface (CLI) has been introduced. Using CLI one can connect to the AS7 domain controller as well as to a standalone server and execute management operations like deploy, undeploy applications, create/delete queue, create/delete topics, create/delete data sources etc. In earlier release JBoss used to have ...

    Read More

  • How to Develop WebService and use @HandlerChain Annotation in JBoss AS7

    How to Develop WebService and use @HandlerChain Annotation in JBoss AS7

    Hi, As JBoss AS7 is very new And most powerful application server with many changes in it. Here we are going to see a very simple demo of how we can develop, build, deploy and test a simple WebService application in JBoss AS7 In this example we will mainly focus on following ...

    Read More

1 2 3 4 5 6 7 8 9 10

JBoss AS 7 Clustering on OpenShift

Hi,

High availability and fail-over are very important feature for any kind of infrastructure. As the name suggests the services should be available at any given point of time and requests should fail over if any component goes down abruptly. You can have several parallel instance of an application and can scale up and down depending on the business requirement, without worrying much about the cost. Load is distributed across different servers, and even if one or more of the servers fails, the application is still accessible via the other application instances. HA is crucial for scalable enterprise applications, as you can improve performance by adding more gears (which will be replica of your current one).

The latest Openshift Online has came up with “JEE Full Profile on JBoss” cartridge which allows you to get benefits of JBoss Clustering. It simply uses HAProxy as a load balancer upfront and creates multiple replicas of you application. The scaling can be based on your choice automatic or manual.

In this article we will see a demo of JBoss Clustering over Openshift. We will deploy a sample application on a two node JBoss Cluster and will try to replicate the user sessions in case of a jvm failure.

Step-1: Create a new application. Please note that we are using “-s” here to enable scaling:

$ rhc app create -a clusterwebapp -t jbossas-7 -s

Above will create a directory “clusterwebapp” at the location from where you ran the command from your terminal.

Download the application from : https://github.com/nikhilmone/ClusteredWebApp and put it inside the deployments directory. Once done simple git add, commit and push your application.

Step-2 : For this example we would be using manual scaling, so that we can quickly check if session replication works.

$ cd clusterwebapp/.openshift/markers/

Step-3 : Create a blank file as “disable_auto_scaling” :

$ touch disable_auto_scaling

Step-4 : Now add the changes to git repository, commit the changes and push them to Openshift server :

..

$ cd ../../

$ git add .openshift/markers/disable_auto_scaling

$ git commit -m "disabling auto-scaling"

$ git push

..

Step-3 : Once the auto-scaling is disabled, lets enable manual scaling :

Create an SSH connection to your application :

$ssh UUID@APPNAME-NAMESPACE.rhcloud.com

for eg :

ssh 123a456c09d12345b123a12345cc1234@clusterwebapp-mydomain.rhcloud.com

Step-4 : Run below command to enable manual scaling :

$ add-gear -a APPNAME -u UUID -n NAMESPACE

for eg :

..

add-gear -a clusterwebapp -u 123a456c09d12345b123a12345cc1234 -n mydomain

..

Now manual scaling is enabled. Let’s check if High Availability works. Try to access the application using the url :

Navigate to the management console now and select how many gears you want to scale your application, select two for now, so we will have a 2 node JBoss Clustering.

Let’s try to hit the application which is currently deployed on a 2 node JBoss Cluster.

http://clusterwebapp-mydomain.rhcloud.com/ClusterWebApp, this gives the welcome page.

You can see the session ID here. Now since we have established a session with the application, let’s bring down the JBoss node abruptly to check if this session fails over.

SSH to your application using :

ssh 123a456c09d12345b123a12345cc1234@clusterwebapp-mydomain.rhcloud.com

Grep for the java process and kill the process id, now our JBoss server is down. If clustering is working, the url should still work.

Hit http://clusterwebapp-mydomain.rhcloud.com/ClusterWebApp again, if this gives the same session ID that means our session has been failed over to the other JBoss node. To make sure this, do check the server logs :)

Note that you can only run TCP clustering on OpenShift as of now. The best part is a developer need not to bother about clustering configuration OpenShift takes care of that. Quite a PaaS huh !! :)

Regards,
Middlewaremagic Team :)


Integrate your Eclipse Juno IDE with Openshift

Hi,

In this article we will discuss how can we integrate our Eclipse IDE to OpenShift and create new applications. In previous articles we discussed about how we can connect to OpenShift and create application through command line and management console ? But of-course it would be really great if we can create, build, test, modify and publish our applications directly from the IDE itself.

I am going to use Eclipse Juno, which is the latest eclipse IDE and will create a sample JBossAS-7 application

Download Eclipse from here.

Download Eclipse Juno depending on your Operating System. I chose Windows-64 bit version. If you are already running an older version of Eclipse, you can always upgrade it or try to follow the same steps with little tweaks :)

Step-1: Start Eclipse and navigate to Help tab. Here select Eclipse Marketplace and search for JBoss Tools, click on install.

Select the OpenShift tools as shown in image :

Once done, click next and accept the License Agreements and then restart Eclipse. It will come up with a welcome page like below :

Step-2 : Lets create an application now. On the welcome page itself click on OpenShift Application. It will ask you to sign-in with your OpenShift account. Saving the password is completely your choice.

Now give a name to your application and select what type of application you want to create from the available options shown in below image. Also select the embedded cartridges, if you want to use any.

I am not using any embedded cartridge for now, now click next.

Here we get an option, whether we want to create a new project or would like to use an existing project. Also it is good to check the option for creating a server, which will help us to easily test and publish our application. Click next.

Now we need to setup clone destination, basically the application created on OpenShift Server will be cloned to this directory. Make sure that directory exists, before this setup :)

Step-3 : Now it is time to configure SSH keys, if you don’t.. you would end up with below.

Click on SSH2 Preferences to configure your keys. Navigate to Key Management and click on Generate RSA Key.

Let’s save the private key and click Ok.

Step-4 : Now you must add this public key to your OpenShift account. For this

login to your OpenShift account. Navigate to My Account page and add your Public Key there.

Let’s carry forward the Step-3 and click on finish. This will prompt you to enter a passphrase for your private key.

Click Ok and you will get a local copy of the application on your machine. You may see an error mark against your application in Package Explorer view, this can be solved by updating you maven configuration. Check below :

Step-5 : Now lets make some changes in to the application. I made a change in “index.html”. once you save this, you might get a popup stating that there has been a change in one of your file, would you like to publish it ? you can click on yes and the change would be pushed to OpenShift server.

Right click on your project and run the application on server.

This will first build your application :

and then it will publish it as well, see the changes that we made :

You can also navigate to the Servers tab, right click on your OpenShift Server and click on Publish.

If you want to tail the log files, check environment variables or try port-forwarding it is all there. See below :

So once the environment has been set, you can make multiple changes and can publish them at your will. :)

Regards,
Middlewaremagic Team :)


How to load jars residing over NFS in JBossAS7 classpath ?

Hi,

In this article we will discuss how can we load jars residing over NFS in JBoss AS-7 classpath. In some development environment, when there are multiple jars and properties files are being used by multiple servers, it is good to put all of them in a central repository, so that if the files (jar/properties files/xmls) are modified, all the servers will pickup the latest version and there will be less overhead related to copying the latest versions to individual servers

NFS allows a user on a client computer to access files over a network in a manner similar to how local storage is accessed. I installed NFS using below link :

Remote_Disk_Access_with_NFS#Installing_NFS

As JBoss AS-7 has introduced a module structure to load your custom jars. One can quickly create a custom module and put the required jars in them, with appropriate entries in module.xml . But in this case we would be needing an additional module directory, which would be residing over NFS server and we would map this to our local (client) server.

Step-1: Modify standalone.sh and add a separate module directory. To do this navigate to $JBOSS_HOME/bin and edit the file.

Search for keyword “module” and it should look like below :

..
if [ "x$JBOSS_MODULEPATH" = "x" ]; then
    JBOSS_MODULEPATH="$JBOSS_HOME/modules"
fi
..

Edit the above section of your “standalone.sh” script and then add the “:” separated path of your module directories as following

..
JBOSS_MODULEPATH=/mnt/nfs:$JBOSS_HOME/modules

#if [ "x$JBOSS_MODULEPATH" = "x" ]; then
  #  JBOSS_MODULEPATH="$JBOSS_HOME/modules"
#fi
..

Here /mnt/nfs/ is the directory, where our new module directory would be residing.

Step-2 : On the shared mount create below directory structure :

..
/mnt/nfs/
├── aaa
   └── bbb
       └── ccc
           └── main
               ├── module.xml
               ├── utility_JAR.jar

..

where

module.xml :

..

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="aaa.bbb.ccc">
   <resources>
       <resource-root path="utility_JAR.jar"/>
   </resources>
</module>

..

Step-3 : Now lets create a simple application which would be using utility_JAR.jar (ClassLoaderTestWAR.war). The war file will have below structure :”

..
ClassLoaderTestWAR.war/
├── index.jsp
├── WEB-INF
   ├── jboss-deployment-structure.xml
   ├── web.xml
..

Where :

index.jsp :

..
<html>
     <head><title>ClassLoader Demo</title></head>
     <body bgcolor="maroon" text="white">
            <center>
                    <h1>Class Loader Demo..</h1>

<%
       aaa.bbb.TestUtility utility=new aaa.bbb.TestUtility();
       String whichClassLoader=utility.sayWhichClassLoader();
       System.out.println("\n\n\t -----> "+whichClassLoader);
       out.println("<h1>"+whichClassLoader+"</h1>");
%>

      </body>
</html>
..

jboss-deployment-structure.xml :

..

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
 <deployment>
   <dependencies>
       <module name="aaa.bbb.ccc" />
   </dependencies>
 </deployment>
</jboss-deployment-structure>

..

web.xml :

..

<web-app>
   <welcome-file-list>
       <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
</web-app>

..

Step-4 : Now deploy the application and start the JBoss AS-7 server.

Step-5 : Access the application using : http://localhost:8080/ClassLoaderTestWAR

You will see something like below :

If the above output comes that means the jar was loaded from our new module directory, which resides over NFS.

Regards,
Middlewaremagic Team :)


How to achieve high availability on Openshift ?

Hi,

High availability is a very important feature for any kind of infrastructure. As the name suggests the services should be available at any given point of time. You can have several parallel instance of an application and can scale up and down depending on the business requirement, without worrying much about the cost. Load is distributed across different servers, and even if one or more of the servers fails, the application is still accessible via the other application instances. HA is crucial for scalable enterprise applications, as you can improve performance by adding more gears (which will be replica of your current one).

Lets create a scaled application and see how High Availability works in Openshift. Follow Below steps :

Step-1: Create a new application. Please note that we are using “-s” here to enable scaling:

$ rhc app create -a myhaproxy -t jbossas-7 -s

Above will create a directory “myhaproxy” at the location from where you ran the command from your terminal.

Now there are two types of scaling : Automatic and Manual. The command mentioned in Step-1 creates an application which is auto-scalable, i.e. the application will be scaled based on the incoming load. However you can also scale your application manually. For eg: if you are anticipating a certain amount of load, or you have limited resources (less number of gears available), or if you want to control the cost manually.

Lets see how can we scale our application manually.

Step-2 : Navigate from the directory “myhaproxy” which got created in Step-1 to :

$ cd myhaproxy/.openshift/markers/

Step-3 : Create a blank file as “disable_auto_scaling” :

$ touch disable_auto_scaling

Step-4 : Now add the changes to git repository, commit the changes and push them to Openshift server :

..

$ cd ../../

$ git add .openshift/markers/disable_auto_scaling

$ git commit -m "disabling auto-scaling"

$ git push

..

Step-3 : Once the auto-scaling is disabled, lets enable manual scaling :

Create an SSH connection to your application :

$ssh UUID@APPNAME-NAMESPACE.rhcloud.com

for eg :

ssh 123a456c09d12345b123a12345cc1234@myhaproxy-mydomain.rhcloud.com

Step-4 : Run below command to enable manual scaling :

$ add gear -a APPNAME -u UUID -n NAMESPACE

for eg :

..

add-gear -a myhaproxy -u 123a456c09d12345b123a12345cc1234 -n mydomain

..

Now manual scaling is enabled. Let’s check if High Availability works. Try to access the application using the url :

myhaproxy-mydomain.rhcloud.com, this gives the welcome page.

Now again ssh to your application using :

ssh 123a456c09d12345b123a12345cc1234@myhaproxy-mydomain.rhcloud.com

Grep for the java process and kill the process id, now our JBoss server is down. If high availability is working, the url should still work.

myhaproxy-mydomain.rhcloud.com, if this gives the welcome page, we are good :) . (Preferably try from a different browser)

You can see high availability statistics from the management console, by logging in to

You can also select minimum or maximum number of gears you want to scale up to.

Regards,
Middlewaremagic Team :)


Scheduling timed jobs using cron on Openshift

Hi,

Cron is UNIX/Linux service or daemon to execute scheduled commands according to instruction in a file. It uses a daemon, crond, which runs constantly in the background and checks every minute/ hour/ day/ week/ month or an year (based on the configuration) to see if any of the scheduled jobs need to be executed; if so, it executes them. These jobs are generally referred to as cron jobs.

You can use the OpenShift Enterprise cron scheduler to set up timed jobs for your applications. This would need a running Openshift application, a cron cartridge (cron-1.4) and a cronjob script.

Follow Below steps to configure a cronjob:

Step-1: Create a new application:

$ rhc app create -a crontestapp -t php-5.3

Above will create a directory “crontestapp” at the location from where you ran the command from your terminal.

Step-2 : Add the cron scheduler cartridge to your new application, to configure the cronjobs :

rhc app cartridge add -a crontestapp -c cron-1.4

Step-3 : Add the cron jobs to your application depending on whether you want to execute them minutely, hourly, daily, weekly or monthly. for this navigate to :

${Your Project dir}/crontestapp/.openshift/cron/{minutely,hourly,weekly,daily,monthly}/

For example try below script:

..
#!/bin/bash
#This is a test cron script
#Author : Nikhil Mone
(echo ========== Hostname ========= ; hostname ; echo ========== Date ========== ; date ; echo ========== Grep PHP procs ========= ; ps -ef | grep php ; echo =========================) > $OPENSHIFT_REPO_DIR/php/foo.txt &
..

Step-4 : Now commit your changes and push them to the remote repository.

$ git add .openshift/cron/

$ git commit -m “configuring my test cron jobs”

$ git push

The script will write the output to the file foo.txt every minute. Now try to access your application from the browser and append “/foo.txt”

for eg :

http://crontestapp-mydomain.rhcloud.com/foo.txt

You can also use curl to verify the operation of this script:

..
$ curl http://crontestapp-mydomain.rhcloud.com/foo.txt

========== Hostname =========
ex-std-node69.prod.rhcloud.com
========== Date ==========
Sat Jan 12 13:55:04 EST 2013
========== Grep PHP procs =========
1269     27627     1  0 11:53 ?        00:00:02 /usr/sbin/httpd -C Include /var/lib/openshift/642c790205d04d7db91a368c5cbf04c2//php-5.3/conf.d/*.conf -f /usr/libexec/openshift/cartridges/php-5.3/info/configuration/etc/conf/httpd_nolog.conf -k start
1269     27629 27627  0 11:53 ?        00:00:00 /usr/sbin/rotatelogs /var/lib/openshift/642c790205d04d7db91a368c5cbf04c2/php-5.3/logs/error_log-%Y%m%d-%H%M%S-%Z 86400
1269     27630 27627  0 11:53 ?        00:00:00 /usr/sbin/rotatelogs /var/lib/openshift/642c790205d04d7db91a368c5cbf04c2/php-5.3/logs/access_log-%Y%m%d-%H%M%S-%Z 86400
1269     27652 27627  0 11:53 ?        00:00:00 /usr/sbin/httpd -C Include /var/lib/openshift/642c790205d04d7db91a368c5cbf04c2//php-5.3/conf.d/*.conf -f /usr/libexec/openshift/cartridges/php-5.3/info/configuration/etc/conf/httpd_nolog.conf -k start
1269     28774 28765  0 13:55 ?        00:00:00 grep php
=========================
..

The scripts that we put inside cron subdirectories get executed according to their frequencies and in alphabetical order. One need to make sure if you are using interdependent crons then the script names should be in alphabetical order.

You can use the below command to enable or disable your cron scripts. For example, to disable all of your scripts:

$ rhc app cartridge stop -a crontestapp -c cron-1.4

To enable all of your scripts:

$ rhc app cartridge start -a crontestapp -c cron-1.4

Note : The cron commands affect all cron jobs. You cannot disable or enable individual cron jobs.

Regards,
Middlewaremagic Team :)


Client side Native Management API for monitoring JBossAS7.1.2

Hi,

JBossAS7 is one of the best application server which provides various options to control/manage/monitor the application resources using various options like jboss-cli.sh (CLI scripts) , jboss management console, JSON based monitoring & management using curl/wget, JBoss Native Management APIs …etc

Here in this article we will see how we can manage & monitor JBossAS 7.1.2 using JBoss Native Management APIs, this approach is best for the java developers, as in many production environments it is very convenient to manage the application respources based on java code. The developers wants to mmanage things using java style of programming, So for those develpers JBoss Native Management APIs is much convenient way of managing the JBoss.

More informations on this can be found in the following link: https://docs.jboss.org/author/display/AS7/The+native+management+API

The Source code for the following Demo is available in the github repository:
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/NativeManagement_API_JBossAS712

Step1). First of all we will create a directory somewhere in our file system as “/home/jaysensharma/NativeManagement_API_JBossAS712″ and then we will create a directory with name “src” inside “/home/jaysensharma/NativeManagement_API_JBossAS712″:

Step2). Now we will use the “org.jboss.as.controller.client.ModelControllerClient” API to establish connection to the JBoss Server/Controller, So create a program as “NativeManagementClient.java” inside “/home/jaysensharma/NativeManagement_API_JBossAS712/src” as following:

import java.net.UnknownHostException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.sasl.RealmCallback;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.client.ModelControllerClient.Factory;
import java.net.InetAddress;
import java.io.IOException;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.Property;

public class NativeManagementClient
{
    //static String host = "10.10.10.96"; // "localhost";
    static String host = "localhost";
    static int port = 9999;
    static String password = "admin";
    static String userid = "admin123";
    static String hostControllerName="master";
    static String serverName="JayServer";
    static boolean standaloneMode=true;     //  If you are running your Servers in Domain Mode then set this to false.
    static ModelControllerClient client = null;    

    public static void main (String[] args)
       {
           try {
                 createAndCheckClientConnection();
                 performOperations(client);
               }

           catch (java.io.IOException ex)
               {
                 System.out.println("\n\n Unable to Connect to the Host: "+host+" or Port:"+port+"\t\t" + ex.getMessage());
                 //ex.printStackTrace();
               }
           catch (Exception ex)
               {
                 System.out.println("\n\nSomeThing is Wrong: "+ex.getMessage());
                 //ex.printStackTrace();
               }

           try {
                 if (client != null ) client.close();
               }
           catch (Exception e)
               {
                 System.out.println ("Exception: " + e.getMessage());
                 e.printStackTrace();
               }
        }

    public static void createAndCheckClientConnection() throws IOException
     {
                 // NOTE: For hostname as "localhost" there is no need to pass the username & password  */
                 //client = ModelControllerClient.Factory.create(host, port, null); 

                 // If you are running this program remotely then you need to pass the credentials */
                 client = createClient (InetAddress.getByName(host), port, userid, password.toCharArray(), "ManagementRealm" );
                 System.out.println("Got the client: "+client);

                 // Checking whether Client is actually connected to Controller or not by executing dummy ModelNode? */
                 ModelNode op = new ModelNode();
                 op.get("operation").set("read-resource");
                 ModelNode returnVal=client.execute(op);
                 System.out.println("\n\nrelease-version: " + returnVal.get("result").get("release-version").asString());
                 System.out.println("release-codename: " + returnVal.get("result").get("release-codename").asString());
     }

   public static void performOperations(ModelControllerClient client)
      {
                  if(standaloneMode==true)
                     {
                        // FOR STANDALONE MODE use the "TestStandaloneModel" class as following:
                        TestStandaloneModel testStandaloneModel=new TestStandaloneModel();              

                        // Getting Web Subsystem runtime Details */
                        testStandaloneModel.getWebSubsystemRuntimeDetails(client);
                        // Testing Non XA DataSource ExampleDS */
                        testStandaloneModel.testNonXADataSource(client,"ExampleDS");
                        // Monitoring Application Statistics where application name is "Log4jDemo.war" */
                        testStandaloneModel.monitorApplicationStatistics(client,"Log4jDemo.war");
                     }
                  if(standaloneMode==false)
                    {
                        TestDomainModeModel testDomainModeModel= new TestDomainModeModel();
                        // Getting Web Subsystem runtime Details */
                        testDomainModeModel.getWebSubsystemRuntimeDetails(client,hostControllerName,serverName);
                        // Testing Non XA DataSource ExampleDS */
                        testDomainModeModel.testNonXADataSource(client,hostControllerName,serverName,"ExampleDS");
                        // Monitoring Application Statistics where application name is "Log4jDemo.war" */
                        testDomainModeModel.monitorApplicationStatistics(client,hostControllerName,serverName,"Log4jDemo.war");
                    }
      }

     static ModelControllerClient createClient (final InetAddress host, final int port, final String username, final char[] password, final String securityRealmName)
      {
         final CallbackHandler callbackHandler = new CallbackHandler() {
                 public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
                   {
                       for (Callback current : callbacks) {
                          if (current instanceof NameCallback) {
                             NameCallback ncb = (NameCallback) current;
                             System.out.println("\n\t\tncb.setName() = "+new String(password));
                             ncb.setName(new String(password));
                            } else if (current instanceof PasswordCallback) {
                             PasswordCallback pcb = (PasswordCallback) current;
                             System.out.println("\n\t\tpcb.setPassword() = "+username);
                             pcb.setPassword(username.toCharArray());
                            } else if (current instanceof RealmCallback) {
                             RealmCallback rcb = (RealmCallback) current;
                             System.out.println("\n\t\trcb.getDefaulttest() = "+rcb.getDefaultText());
                             rcb.setText(securityRealmName);
                            } else {
                             throw new UnsupportedCallbackException(current);
                        }
                    }
               }
             };
          return ModelControllerClient.Factory.create(host, port, callbackHandler);
       }
}

Step3). This step is for accessing JBoss informations in Standalone Mode, The most important part here we will write “TestStandaloneModel.java” program inside the “/home/jaysensharma/NativeManagement_API_JBossAS712/src” using the “org.jboss.dmr.ModelNode” and “ModelControllerClient” in order to access the “web” subsystem, deployment and “DataSource statistics” related informations as following:

import org.jboss.dmr.ModelNode;
import org.jboss.dmr.Property;
import org.jboss.as.controller.client.ModelControllerClient;

public class TestStandaloneModel
  {
   public void getWebSubsystemRuntimeDetails(ModelControllerClient client)
    {
       System.out.println("\n\n\n************************************************");
       System.out.println("Web Subsystem Runtime Details");
       System.out.println("************************************************");
       try{
             ModelNode op = new ModelNode();
             op.get("operation").set("read-resource");
             ModelNode address = op.get("address");
             address.add("subsystem", "web");
             address.add("connector", "http");
             op.get("recursive").set(true);
             op.get("include-runtime").set(true);
             op.get("operations").set(true);

             ModelNode returnVal = client.execute(op);
             String result=returnVal.get("result").toString();
             String path="/subsystem=web/connector=http";
             if(result.equals("undefined"))
                {
                   System.out.println("\n\tCheck ["+path+"] ** Server may not be Running");
                }
             else
                {
                   System.out.println(returnVal.get("result").toString());
                }
          }
        catch(Exception e)
          {
             e.printStackTrace();
             System.out.println("getWebSubsystemRuntimeDetails Failed: "+e);
          }
    }

   public void testNonXADataSource(ModelControllerClient client,String dataSourceName)
    {
       System.out.println("\n\n\n************************************************");
       System.out.println("DataSource \""+dataSourceName+"\" TestResults");
       System.out.println("************************************************");

       try{
             ModelNode op = new ModelNode();
             op.get("operation").set("test-connection-in-pool");
             ModelNode address = op.get("address");
             address.add("subsystem", "datasources");
             address.add("data-source", dataSourceName);
             op.get("operations").set(true);

             ModelNode returnVal = client.execute(op);
             String result=returnVal.get("result").toString();
             String path="/subsystem=datasources/data-source="+dataSourceName;
             if(result.equals("[true]"))
                {
                   System.out.println("\n\tNon XA DataSource \""+dataSourceName+"\" is RUNNING Successfully.");
                }
             else if(result.equals("[false]"))
                {
                   System.out.println("\n\tNon XA DataSource \""+dataSourceName+"\" is TEST FAILED Successfully. Check PATH exist or not? ["+path+"]");
                }
             else if(result.equals("undefined"))
                {
                   System.out.println("\n\tDataSource \""+dataSourceName+"\" might not be deployed, ["+path+"]  ** Server may not be Running"+"Please Check the DataSource \""+dataSourceName+"\" name, It may be INCORRECT. \n\tCheck PATH exist or not? ["+path+"]");
                }
          }
        catch(Exception e)
          {
             e.printStackTrace();
             System.out.println("testNonXADataSource Failed: "+e);
          }
    }

   public void monitorApplicationStatistics(ModelControllerClient client,String applicationName)
    {
       System.out.println("\n\n\n******************************************************");
       System.out.println("Application \""+applicationName+"\" RuntimeStatistics");
       System.out.println("******************************************************");
       try{
             ModelNode op = new ModelNode();
             op.get("operation").set("read-resource");
             ModelNode address = op.get("address");
             address.add("deployment", applicationName);
             op.get("recursive").set(true);
             op.get("include-runtime").set(true);
             op.get("include-defaults").set(true);
             op.get("operations").set(true);

             ModelNode returnVal = client.execute(op);
             String result=returnVal.get("result").toString();
             String path="/deployment="+applicationName;
             if(result.equals("undefined"))
                {
                   System.out.println("\n\tApplication \""+applicationName+ "\" might not have deployed. ** Server may not be Running. Check PATH exist or not? ["+path+"]");
                }
             else
                {
                   System.out.println("\n\tMonitoring \""+applicationName+ "\""+result);
                }
          }
        catch(Exception e)
          {
             e.printStackTrace();
             System.out.println("testNonXADataSource Failed: "+e);
          }
    }
  }

Step4). This step is for accessing JBoss informations of JBoss instances running in Domain Mode, The most important part here we will write “TestDomainModeModel.java” program inside the “/home/jaysensharma/NativeManagement_API_JBossAS712/src” using the “org.jboss.dmr.ModelNode” and “ModelControllerClient” in order to access the “web” subsystem, deployment and “DataSource statistics” related informations as following:

import org.jboss.dmr.ModelNode;
import org.jboss.dmr.Property;
import org.jboss.as.controller.client.ModelControllerClient;

public class TestDomainModeModel
  {
   public void getWebSubsystemRuntimeDetails(ModelControllerClient client,String hostControllerName,String serverName)
    {
       System.out.println("\n\n\n************************************************");
       System.out.println("Web Subsystem Runtime Details");
       System.out.println("************************************************");
       try{
             ModelNode op = new ModelNode();
             op.get("operation").set("read-resource");
             ModelNode address = op.get("address");
             address.add("host", hostControllerName);
             address.add("server", serverName);
             address.add("subsystem", "web");
             address.add("connector", "http");
             op.get("recursive").set(true);
             op.get("include-runtime").set(true);
             op.get("operations").set(true);

             ModelNode returnVal = client.execute(op);
             String result=returnVal.get("result").toString();
             String path="/host="+hostControllerName+"/server="+serverName+"/subsystem=web/connector=http";
             if(result.equals("undefined"))
                {
                   System.out.println("\n\tCheck ["+path+"] ** HostController HostController or Server may not be Running");
                }
             else
                {
                   System.out.println(returnVal.get("result").toString());
                }
          }
        catch(Exception e)
          {
             e.printStackTrace();
             System.out.println("getWebSubsystemRuntimeDetails Failed: "+e);
          }
    }

   public void testNonXADataSource(ModelControllerClient client,String hostControllerName,String serverName,String dataSourceName)
    {
       System.out.println("\n\n\n************************************************");
       System.out.println("DataSource \""+dataSourceName+"\" TestResults");
       System.out.println("************************************************");

       try{
             ModelNode op = new ModelNode();
             op.get("operation").set("test-connection-in-pool");
             ModelNode address = op.get("address");
             address.add("host", hostControllerName);
             address.add("server", serverName);
             address.add("subsystem", "datasources");
             address.add("data-source", dataSourceName);
             op.get("operations").set(true);

             ModelNode returnVal = client.execute(op);
             String result=returnVal.get("result").toString();
             String path="/host="+hostControllerName+"/server="+serverName+"/subsystem=datasources/data-source="+dataSourceName;
             if(result.equals("[true]"))
                {
                   System.out.println("\n\tNon XA DataSource \""+dataSourceName+"\" is RUNNING Successfully.");
                }
             else if(result.equals("[false]"))
                {
                   System.out.println("\n\tNon XA DataSource \""+dataSourceName+"\" is TEST FAILED Successfully. Check PATH exist or not? ["+path+"]");
                }
             else if(result.equals("undefined"))
                {
                   System.out.println("\n\tDataSource \""+dataSourceName+"\" might not be deployed on this ["+path+"]  ** HostController or Server may not be Running"+"Please Check the DataSource \""+dataSourceName+"\" name, It may be INCORRECT. \n\tCheck PATH exist or not? ["+path+"]");
                }
          }
        catch(Exception e)
          {
             e.printStackTrace();
             System.out.println("testNonXADataSource Failed: "+e);
          }
    }

   public void monitorApplicationStatistics(ModelControllerClient client,String hostControllerName,String serverName,String applicationName)
    {
       System.out.println("\n\n\n******************************************************");
       System.out.println("Application \""+applicationName+"\" RuntimeStatistics");
       System.out.println("******************************************************");
       try{
             ModelNode op = new ModelNode();
             op.get("operation").set("read-resource");
             ModelNode address = op.get("address");
             address.add("host", hostControllerName);
             address.add("server", serverName);
             address.add("deployment", applicationName);
             op.get("recursive").set(true);
             op.get("include-runtime").set(true);
             op.get("include-defaults").set(true);
             op.get("operations").set(true);

             ModelNode returnVal = client.execute(op);
             String result=returnVal.get("result").toString();
             String path="/host="+hostControllerName+"/server="+serverName+"/deployment="+applicationName;
             if(result.equals("undefined"))
                {
                   System.out.println("\n\tApplication \""+applicationName+ "\" might not have deployed on this host="+hostControllerName+"/server="+serverName+"  ** HostController or Server may not be Running. Check PATH exist or not? ["+path+"]");
                }
             else
                {
                   System.out.println("\n\tMonitoring \""+applicationName+ "\""+result);
                }
          }
        catch(Exception e)
          {
             e.printStackTrace();
             System.out.println("testNonXADataSource Failed: "+e);
          }
    }
  }

Step5). Now the most important part of building & running the Native Management API client which we created, so in order to achieve that we will create a simple ant build script, So Create a “build.xml” file inside the “/home/jaysensharma/NativeManagement_API_JBossAS712″ directory as following:

<project name="JBossAS712NativeManagementClient" default="all">
<property name="jboss.home" value="/home/jaysensharma/jboss-as-7.1.2.Final" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="src.dir" value="src" />
<property name="output.dir" value="build" />
<property name="client.jar.name" value="jbossModelAPIClient.jar" />

        <!-- Following 5 Jars are needed for Client. Client Needs the following Jar to be present in the CLASSPATH including -->
        <path id="jboss.client.classpath">
           <fileset dir="${jboss.module.dir}/org/jboss/as/controller-client/main">
               <include name="jboss-as-controller-client*.jar"/>
           </fileset>
           <fileset dir="${jboss.module.dir}/org/jboss/threads/main">
               <include name="jboss-threads*.jar"/>
           </fileset>
           <fileset dir="${jboss.module.dir}/org/jboss/as/protocol/main">
               <include name="jboss-as-protocol*.jar"/>
           </fileset>

           <fileset dir="${jboss.module.dir}/org/jboss/dmr/main">
               <include name="jboss-dmr*.jar"/>
           </fileset>
           <fileset dir="${jboss.home}/bin/client" >
               <include name="jboss-client.jar" />
           </fileset>
        </path>

        <target name="all" depends="run" />

        <target name="run">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <delete dir="${output.dir}" />
           <mkdir dir="${output.dir}" />
           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="NativeManagementClient.java,TestStandaloneModel.java,TestDomainModeModel.java" classpathref="jboss.client.classpath"/>
           <jar jarfile="${output.dir}/${client.jar.name}" basedir="${tmp.dir}" compress="true" />
           <delete dir="${tmp.dir}"/>
           <java classname="NativeManagementClient" fork="true">
               <classpath>
                  <pathelement location="${output.dir}/${client.jar.name}"/>
                  <path refid="jboss.client.classpath"/>
               </classpath>
           </java>
        </target>        

</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script to point to your own JBoss AS7 directory. It requires 5 Jars to be present in the Client’s classpath as mentioned in the above xml file.

Step-6). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/jaysensharma/jdk1.6.0_21/bin:/home/jaysensharma/org.apache.ant_1.6.5/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.6.5/bin;%PATH%

Step-7). Now once the PATH is set In the command/Shell prompt you can move inside the directory “/home/jaysensharma/NativeManagement_API_JBossAS712″ and then run the ant to build and deploy the EJB based EAR applicationon your JBoss Standalone full profile, by running the command “ant deploy”

[jsenshar@localhost NativeManagement_API_JBossAS712]$ ant
Buildfile: build.xml

run:
    [mkdir] Created dir: /home/jaysensharma/NativeManagement_API_JBossAS712/tmp
   [delete] Deleting directory /home/jaysensharma/NativeManagement_API_JBossAS712/build
    [mkdir] Created dir: /home/jaysensharma/NativeManagement_API_JBossAS712/build
    [javac] Compiling 3 source files to /home/jaysensharma/NativeManagement_API_JBossAS712/tmp
      [jar] Building jar: /home/jaysensharma/NativeManagement_API_JBossAS712/build/jbossModelAPIClient.jar
   [delete] Deleting directory /home/jaysensharma/NativeManagement_API_JBossAS712/tmp
     [java] Got the client: org.jboss.as.controller.client.impl.RemotingModelControllerClient@7f971afc
     [java] Nov 27, 2012 12:06:02 AM org.xnio.Xnio <clinit>
     [java] INFO: XNIO Version 3.0.4.GA-redhat-1
     [java] Nov 27, 2012 12:06:02 AM org.xnio.nio.NioXnio <clinit>
     [java] INFO: XNIO NIO Implementation Version 3.0.4.GA-redhat-1
     [java] Nov 27, 2012 12:06:02 AM org.jboss.remoting3.EndpointImpl <clinit>
     [java] INFO: JBoss Remoting version 3.2.8.GA-redhat-1
     [java]
     [java]
     [java] release-version: 7.1.2.Final-redhat-1
     [java] release-codename: Steropes
     [java]
     [java]
     [java]
     [java] ************************************************
     [java] Web Subsystem Runtime Details
     [java] ************************************************
     [java] {
     [java]     "bytesReceived" => "0",
     [java]     "bytesSent" => "0",
     [java]     "enable-lookups" => false,
     [java]     "enabled" => true,
     [java]     "errorCount" => "0",
     [java]     "executor" => undefined,
     [java]     "max-connections" => undefined,
     [java]     "max-post-size" => 2097152,
     [java]     "max-save-post-size" => 4096,
     [java]     "maxTime" => "0",
     [java]     "name" => "http",
     [java]     "processingTime" => "0",
     [java]     "protocol" => "HTTP/1.1",
     [java]     "proxy-name" => undefined,
     [java]     "proxy-port" => undefined,
     [java]     "redirect-port" => 8433,
     [java]     "requestCount" => "0",
     [java]     "scheme" => "http",
     [java]     "secure" => false,
     [java]     "socket-binding" => "http",
     [java]     "ssl" => undefined,
     [java]     "virtual-server" => undefined
     [java] }
     [java]
     [java]
     [java]
     [java] ************************************************
     [java] DataSource "ExampleDS" TestResults
     [java] ************************************************
     [java]
     [java] 	Non XA DataSource "ExampleDS" is RUNNING Successfully.
     [java]
     [java]
     [java]
     [java] ******************************************************
     [java] Application "Log4jDemo.war" RuntimeStatistics
     [java] ******************************************************
     [java]
     [java] 	Monitoring "Log4jDemo.war"{
     [java]     "content" => [{
     [java]         "path" => "deployments/Log4jDemo.war",
     [java]         "relative-to" => "jboss.server.base.dir",
     [java]         "archive" => true
     [java]     }],
     [java]     "enabled" => true,
     [java]     "name" => "Log4jDemo.war",
     [java]     "persistent" => false,
     [java]     "runtime-name" => "Log4jDemo.war",
     [java]     "status" => "OK",
     [java]     "subdeployment" => undefined,
     [java]     "subsystem" => {"web" => {
     [java]         "active-sessions" => 0,
     [java]         "context-root" => "/Log4jDemo",
     [java]         "duplicated-session-ids" => 0,
     [java]         "expired-sessions" => 0,
     [java]         "max-active-sessions" => 0,
     [java]         "rejected-sessions" => 0,
     [java]         "session-avg-alive-time" => 0,
     [java]         "session-max-alive-time" => 0,
     [java]         "sessions-created" => 0,
     [java]         "virtual-host" => "default-host",
     [java]         "servlet" => {"servlets.TestServlet" => {
     [java]             "load-time" => 0L,
     [java]             "maxTime" => 9223372036854775807L,
     [java]             "min-time" => 0L,
     [java]             "processingTime" => 0L,
     [java]             "requestCount" => 0,
     [java]             "servlet-class" => "servlets.TestServlet",
     [java]             "servlet-name" => "servlets.TestServlet"
     [java]         }}
     [java]     }}
     [java] }

all:

BUILD SUCCESSFUL
Total time: 2 seconds

Step-8). If you are running your JBoss in Domain mode then you need to just edit the “NativeManagementClient.java” file, and just change the variable “standaloneMode” value to “false” as following:

static boolean standaloneMode=false;

.
.
Thanks
MiddlewareMagic Team :)


SAR dependency alternate approach using @Singleton in JBossAS7.1.2

Hi,

SAR files are called as Service Archives. The extension of SAR files are *.sar which contains a “META-INF/jboss-service.xml” file, this file describes the custom MBeans which has to be exposed at the time of deployment or JBoss Startup. JBoss’s service archive architecture is based on the JMX and the SAR files which are basically JBoss specific can be deployed in the jboss inorder to publish your MBean based services. At the time of JBoss startup these service archive deployer (SARDeployer) instantiates the JBoss service classes and exposes them as manageable beans through JMX.

In previous release of JBoss 5/6 the SAR provided mbeans dependency could be very easily defined using <depends> tag, as following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<server>
    <mbean code="custom.mbean.MyServerMonitor" name="service.server.monitor:service=MyMonitor">
         <attribute name="Frequency">5000</attribute>
         <depends>jboss.jca:service=DataSourceBinding,name=MySqlDS</depends>
    </mbean>
</server>

@org.jboss.ejb3.annotation.Service and @org.jboss.ejb3.annotation.Management are no longer supported which could be used to define Services. However in JBossAS7 this approach of defining the dependency is not good and you may see following kind of exceptions at the time of server startup:

JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.mbean.service."jboss.as:subsystem=datasources,data-source=MySqlDS".create (missing) dependents: [service jboss.mbean.service."service.server.monitor:service=MyMonitor".create]
      service jboss.mbean.service."jboss.as:subsystem=datasources,data-source=MySqlDS".start (missing) dependents: [service jboss.mbean.service."service.server.monitor:service=MyMonitor".start]

JBossAS7 is fully EE6 certified application server and it provides a much better approach to create a Service with the help of EJB3.1 specific “javax.ejb.Startup” and “javax.ejb.Singleton” annotations. This kind of service can be made dependent to other services like DataSource. In this example we will see What is the better approach to define a service (without using container specific SAR feature).

The Source code for this demo can be found in the following github link:
https://github.com/jaysensharma/MiddlewareMagicDemos/tree/master/SingletonServiceDemo

Creating DataSource in JBossAS7.1.2

As we are going make our Service dependent on a DataSource, sothat we can see how the dependency goes.

Configuration-1). So here first of all we will create a DataSource by running the following CLI script in batch mode. So create a file with name “createDataSource.cli” somewhere in your filesystem like “/home/jaysensharma/SingletonServiceDemo/createDataSource.cli” as following:

deploy  /home/jaysensharma/SingletonServiceDemo/mysql-connector-java-5.1.13-bin.jar

/subsystem=datasources/data-source="MySqlDS":add(jndi-name="java:jboss/datasources/MySqlDS",driver-name="mysql-connector-java-5.1.13-bin.jar",connection-url="jdbc:mysql://localhost:3306/testDB",user-name="root",password="redhat")

Configuration-2). Now start your “$JBOSS_HOME/bin/jboss-cli.sh” script in order to run the above deploy the mysql driver and create DataSource as following:

./jboss-cli.sh -c --controller=10.10.10.10:9999 --file=/home/jaysensharma/SingletonServiceDemo/createDataSource.cli

Configuration-3). As soon as you will run the cli script as mentioned above you will see that the following kind of datasource is created on your standalone*.xml.

                <datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS">
                    <connection-url>jdbc:mysql://localhost:3306/testDB</connection-url>
                    <driver>mysql-connector-java-5.1.13-bin.jar</driver>
                    <security>
                        <user-name>root</user-name>
                        <password>redhat</password>
                    </security>
                </datasource>

Creating @Singleton service dependent on the DataSource

Step1). First of all we will create a directory somewhere in our file system as “/home/jaysensharma/SingletonServiceDemo” and then we will create a directory with name “src” inside “/home/jaysensharma/SingletonServiceDemo”:

Step2). Now write a @Startup @Singleton EJB3.1 service using “SingletonServiceBean.java” inside “/home/jaysensharma/SingletonServiceDemo/src” as following:

package sar.dependency.alternative;
import javax.ejb.Startup;
import javax.ejb.Singleton;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

//commons logging
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

// DataSource related
import javax.sql.DataSource;
import java.sql.Connection;

// Resource Injection related
import javax.annotation.Resource;

@Startup
@Singleton  

public class SingletonServiceBean
 {
     private static Log logger = LogFactory.getLog(SingletonServiceBean.class);
     Connection con=null;

     public SingletonServiceBean()
            {
               logger.info("SingletonServiceBean constructor invoked.");
            }

     @Resource(name = "java:jboss/datasources/MySqlDS")
     DataSource ds;
     /* This @PostConstruct annotation is required to tell JBoss to invoke the "performOperations" immediately after the "SingletonServiceBean" creation. */
     @PostConstruct
     public void performOperations()
	    {
               logger.info("SingletonServiceBean performOperations() invoked.");
               try{
                     con=ds.getConnection();
                     logger.info("***** DataSource = "+ds+" . Connection con = "+con+" retrieved from the ConnectionPool.*****");
                  }
               catch(Exception e)
                 {
                     logger.error("Unable to get Connection From DataSource = "+ds+" ERROR: "+e.getMessage());
                     e.printStackTrace();
                 }
	    }

	@PreDestroy
	public void cleanUp() throws Exception {
	  logger.info("cleaning up connections.");
          if(con!=null)
            {
               try{
                     con.close();
                     logger.info("Connection con = "+con+" is successfully returned to the ConnectionPool.");
                  }
               catch(Exception e)
                 {
                     logger.error("Unable to Close Connection con = "+con+" ERROR: "+e.getMessage());
                     e.printStackTrace();
                 }
               finally{
                        try{   con.close(); }
                        catch(Exception ee) { ee.printStackTrace(); }
                      }
            }
	}
 }

Step3). Now the most important part of building / deploying the Singleton Service which we created, so in order to achieve that we will create a simple ant build script, So Create a “build.xml” file inside the “/home/jaysensharma/SingletonServiceDemo” directory as following:

<project name="SingletonStartupService" default="all">
<property name="jboss.home" value="/home/jaysensharma/jboss-as-7.1.2.Final" />
<property name="jboss.module.dir" value="${jboss.home}/modules" />
<property name="basedir" value="." />
<property name="tmp.dir" value="tmp" />
<property name="src.dir" value="src" />
<property name="output.dir" value="build" />
<property name="ear.name" value="TestSingletonService.ear" />
<property name="ejb.jar" value="singletonServiceEJB.jar" />

        <path id="jboss.classpath">
           <fileset dir="${jboss.module.dir}">
               <include name="**/*.jar"/>
           </fileset>
        </path>

        <target name="all" depends="deploy" />

        <target name="build_ear">
           <delete dir="${tmp.dir}" />
           <mkdir dir="${tmp.dir}" />
           <javac srcdir="${src.dir}" destdir="${tmp.dir}"  includes="*.java" classpathref="jboss.classpath"/>

           <jar jarfile="${tmp.dir}/${ejb.jar}" basedir="${tmp.dir}" compress="true" />

           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/sar"/>
           </delete>
           <mkdir dir="${tmp.dir}/META-INF"/>
           <copy todir="${tmp.dir}/META-INF">
                <fileset dir="${src.dir}/">
                  <include name="application.xml"/>
                </fileset>
           </copy>
           <jar jarfile="${tmp.dir}/${ear.name}" basedir="${tmp.dir}" compress="true" />
           <delete includeEmptyDirs="true">
              <fileset dir="${tmp.dir}/META-INF"/>
           </delete>
           <delete file="${tmp.dir}/${ejb.jar}"/>

           <copy file="${tmp.dir}/${ear.name}" tofile="${output.dir}/${ear.name}"/>
           <delete dir="${tmp.dir}"/>
        </target>

        <target name="deploy" depends="build_ear">
            <echo message="*******************  Deploying the EAR file ${ear.name} *********************" />
            <echo message="********** ${output.dir}/${ear.name} to ${jboss.home}/standalone/deployments **********" />
            <copy todir="${jboss.home}/standalone/deployments/">
                <fileset dir="${output.dir}/">
                  <include name="${ear.name}"/>
                </fileset>
            </copy>
            <echo message="*******************  Deployed Successfully   *********************" />
        </target>

</project>

NOTE: The only change in the above file you need to do is to change the “jboss.home” directory path in the second line of the above script to point to your own JBoss AS7 directory.

Step-4). Now before running your ANT script to build and deploy the above webapplication you should have the ANT as well as JAVA set in the $PATH variable of the Shell / command prompt as following:

For Unix Based OS:
export PATH=/home/jaysensharma/jdk1.6.0_21/bin:/home/jaysensharma/org.apache.ant_1.6.5/bin:$PATH

For Windows Based OS:
set PATH=C:/jdk1.6.0_21/bin;C:/org.apache.ant_1.6.5/bin;%PATH%

Step-5). Now once the PATH is set In the command/Shell prompt you can move inside the directory “/home/jaysensharma/SingletonServiceDemo” and then run the ant to build and deploy the EJB based EAR applicationon your JBoss Standalone full profile, by running the command “ant deploy”

[jaysensharma@localhost SingletonServiceDemo]$ ant
Buildfile: build.xml

build_ear:
    [mkdir] Created dir: /home/jaysensharma/SingletonServiceDemo/tmp
    [javac] Compiling 1 source file to /home/jaysensharma/SingletonServiceDemo/tmp
      [jar] Building jar: /home/jaysensharma/SingletonServiceDemo/tmp/singletonServiceEJB.jar
    [mkdir] Created dir: /home/jaysensharma/SingletonServiceDemo/tmp/META-INF
      [jar] Building jar: /home/jaysensharma/SingletonServiceDemo/tmp/TestSingletonService.ear
   [delete] Deleting: /home/jaysensharma/SingletonServiceDemo/tmp/singletonServiceEJB.jar
     [copy] Copying 1 file to /home/jaysensharma/SingletonServiceDemo/build
   [delete] Deleting directory /home/jaysensharma/SingletonServiceDemo/tmp

deploy:
     [echo] *******************  Deploying the EAR file TestSingletonService.ear *********************
     [echo] ********** build/TestSingletonService.ear to /home/jaysensharma/jboss-as-7.1.2.Final/standalone/deployments **********
     [copy] Copying 1 file to /home/jaysensharma/jboss-as-7.1.2.Final/standalone/deployments
     [echo] *******************  Deployed Successfully   *********************

all:

BUILD SUCCESSFUL
Total time: 1 second

Step-6). As the application is deployed on your JBoss so now try restarting your JBoss and then see whether the Above service us successfully get the DataSource and JDBC Connection or not. If the Dependency is correctly working then after restarting your JBoss you will see the following kind of message on your JBoss console / logs.

22:41:51,569 INFO  [sar.dependency.alternative.SingletonServiceBean] (MSC service thread 1-1) ***** DataSource = org.jboss.jca.adapters.jdbc.WrapperDataSource@43877c42 . Connection con = org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@5424bf0 retrieved from the ConnectionPool.*****

.
.
Thanks
MiddlewareMagic Team :)


Middleware Magic Completes 2 year of spreading its Magic

It’s a pleasure to announce that Middleware Magic is celebrating it’s second anniversary today. We are now two years old today.

For new readers, we started Middleware Magic 2 years back and started as a tech blog for only Weblogic and with time we found that lot of new stuff is going on JBoss which caught our eyes, hence a year back exactly this day we had started tech blogging on JBoss as well and with it we really started making magic in the world of middleware.

Weblogic

JBoss

We always have a keen eye on our growing numbers and it’s really good to see we are growing with time and we are spreading the news like always in the world of middleware technology. This year for the total page views hit [i.e. JBoss + Weblogic] and total social network followers [i.e. Facebook + Twitter + Google] are

Pages Views 1,88,000+
Social Network followers 1140+

And special thanks to all the guys who took interests in joining our team and we are eagerly waiting for your articles to get them published on middleware magic with your name on it. We would also like to thank our subscribers from for supporting us and our teams [René van Wijk, Ravish Mody and Jay SenSharma] hard work as well as for bringing us to this stage and making middleware magic such a huge platform for everyone else.


Curl Based Management & Monitoring in JBossAS7 with HTTP-JSON APIs

Trust me None other Application Server provides this kind of amazing feature, except JBossAS7. JBoss AS7 is one of the bestest application available in the Middleware World, As it provides much more facilities to the Administrators in order to manage/configure and monitor various resources. As we are already familier with a utility called as “$JBOSS_HOME/bin/jboss-cli.sh” is one of the most powerful and easiest utility which can be used to manage and monitor JBossAS7.

In this demonstration we will see that JBoss AS7 provides another best feature, which allows us to easily access & monitor & management the JBoss AS7 using OS level utilities like “curl”. Yes, JBoss AS7 provides HTTP-JSON based APIs which can be used to achieve the same. So lets see some of it’s features…

So lets start JBossAS7 like following:

    ./standalone.sh -c standalone-full.xml

NOTE: In all the following operations we will assume that you have created a ManagementRealm User with username “admin” and password as “admin123″ (you can create any user name/password based on your requirement), Then change the username & password in the mentioned demo URLs like “http://admin:admin123@localhost:9990/management/”

NOTE: Curl is a free utility for non-interactive download of files from the Web.

So Open a Terminal (command prompt) and start testing the following Curl command on your JBossAS7

Checking Server State

curl --digest -L -D - http://admin:admin123@localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"read-attribute","name":"server-state","json.pretty":1}'

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="07d65fc8e028df9ed577145c8e973c64"
Date: Sun, 23 Sep 2012 15:18:59 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 15:18:59 GMT

{
    "outcome" : "success",
    "result" : "running"
}

Editing “max-pool-size” attribute of ExampleDS DataSource

curl --digest -L -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"write-attribute","address":[{"subsystem":"datasources"},{"data-source":"ExampleDS"}],"name":"max-pool-size","value":10}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="57d99ff484d2b950ecfde2bcd8c7b55c"
Date: Sun, 23 Sep 2012 15:27:32 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 15:27:32 GMT

Editing “min-pool-size” attribute of ExampleDS DataSource

curl --digest -L -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"write-attribute","address":[{"subsystem":"datasources"},{"data-source":"ExampleDS"}],"name":"min-pool-size","value":5}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="662bd288e4949b0093b8d1c5db704a6a"
Date: Sun, 23 Sep 2012 15:33:37 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 15:33:37 GMT

Changing console-handler “CONSOLE” logging level to “WARN”


curl --digest -L -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"write-attribute","address":[{"subsystem":"logging"},{"console-handler":"CONSOLE"}],"name":"level","value":"WARN", "json.pretty":1}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="8ad3a0fd0b5f393c8cf9ac757d8395d3"
Date: Sun, 23 Sep 2012 20:00:07 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 20:00:07 GMT

{"outcome" : "success"}

Testing ExampleDS datasource connections

curl --digest -L -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"test-connection-in-pool","address":[{"subsystem":"datasources"},{"data-source":"ExampleDS"}]}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="2feecad0028c0122ed04c2bf344fdde3"
Date: Sun, 23 Sep 2012 16:47:29 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 16:47:30 GMT

{"outcome" : "success", "result" : [true]}

Getting JVM Memory & Runtime Details

curl --digest -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"read-resource", "include-runtime":"true", "address":[{"core-service":"platform-mbean"},{"type":"memory"}], "json.pretty":1}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="86d37639bcc651b1cea47a91bef0be14"
Date: Sun, 23 Sep 2012 19:44:19 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 19:44:19 GMT

{
    "outcome" : "success",
    "result" : {
        "heap-memory-usage" : {
            "init" : 1366294528,
            "used" : 161655864,
            "committed" : 1324351488,
            "max" : 1324351488
        },
        "non-heap-memory-usage" : {
            "init" : 24313856,
            "used" : 61050320,
            "committed" : 61210624,
            "max" : 318767104
        },
        "object-name" : "java.lang:type=Memory",
        "object-pending-finalization-count" : 0,
        "verbose" : false
    }
}

Getting JBoss Runtime Details

curl --digest -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"read-resource", "include-rutime":"true", "address":[{"core-service":"platform-mbean"},{"type":"runtime"}], "json.pretty":1}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="b2d05e49490da200cdd74bd7f848998e"
Date: Sun, 23 Sep 2012 19:45:22 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 19:45:22 GMT

{
    "outcome" : "success",
    "result" : {
        "name" : "24028@localhost.localdomain",
        "vm-name" : "Java HotSpot(TM) 64-Bit Server VM",
        "vm-vendor" : "Oracle Corporation",
        "vm-version" : "23.1-b03",
        "spec-name" : "Java Virtual Machine Specification",
        "spec-vendor" : "Oracle Corporation",
        "spec-version" : "1.7",
        "management-spec-version" : "1.2",
        "class-path" : "/home/userone/jboss-as-7.1.2/jboss-modules.jar",
        "library-path" : "/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib",
        "boot-class-path-supported" : true,
        "boot-class-path" : "/home/userone/jdk1.7.0_05/jre/lib/resources.jar:/home/userone/jdk1.7.0_05/jre/lib/rt.jar:/home/userone/jdk1.7.0_05/jre/lib/sunrsasign.jar:/home/userone/jdk1.7.0_05/jre/lib/jsse.jar:/home/userone/jdk1.7.0_05/jre/lib/jce.jar:/home/userone/jdk1.7.0_05/jre/lib/charsets.jar:/home/userone/jdk1.7.0_05/jre/lib/jfr.jar:/home/userone/jdk1.7.0_05/jre/classes",
        "input-arguments" : [
            "-D[Standalone]",
            "-XX:+UseCompressedOops",
            "-Xms1303m",
            "-Xmx1303m",
            "-XX:MaxPermSize=256m",
            "-Djava.net.preferIPv4Stack=true",
            "-Dorg.jboss.resolver.warning=true",
            "-Dsun.rmi.dgc.client.gcInterval=3600000",
            "-Dsun.rmi.dgc.server.gcInterval=3600000",
            "-Djboss.modules.system.pkgs=org.jboss.byteman",
            "-Djava.awt.headless=true",
            "-Djboss.server.default.config=standalone.xml",
            "-Dorg.jboss.boot.log.file=/home/userone/jboss-as-7.1.2/standalone/log/boot.log",
            "-Dlogging.configuration=file:/home/userone/jboss-as-7.1.2/standalone/configuration/logging.properties"
        ],
        "start-time" : 1348315286154,
        "system-properties" : {
            "[Standalone]" : "",
            "awt.toolkit" : "sun.awt.X11.XToolkit",
            "catalina.home" : "/home/userone/jboss-as-7.1.2/standalone/tmp",
            "ddddd" : "eeeee",
            "file.encoding" : "UTF-8",
            "file.encoding.pkg" : "sun.io",
            "file.separator" : "/",
            "java.awt.graphicsenv" : "sun.awt.X11GraphicsEnvironment",
            "java.awt.headless" : "true",
            "java.awt.printerjob" : "sun.print.PSPrinterJob",
            "java.class.path" : "/home/userone/jboss-as-7.1.2/jboss-modules.jar",
            "java.class.version" : "51.0",
            "java.endorsed.dirs" : "/home/userone/jdk1.7.0_05/jre/lib/endorsed",
            "java.ext.dirs" : "/home/userone/jdk1.7.0_05/jre/lib/ext:/usr/java/packages/lib/ext",
            "java.home" : "/home/userone/jdk1.7.0_05/jre",
            "java.io.tmpdir" : "/tmp",
            "java.library.path" : "/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib",
            "java.naming.factory.url.pkgs" : "org.jboss.as.naming.interfaces:org.jboss.ejb.client.naming",
            "java.net.preferIPv4Stack" : "true",
            "java.protocol.handler.pkgs" : "org.jboss.net.protocol|org.jboss.vfs.protocol",
            "java.runtime.name" : "Java(TM) SE Runtime Environment",
            "java.runtime.version" : "1.7.0_05-b05",
            "java.specification.name" : "Java Platform API Specification",
            "java.specification.vendor" : "Oracle Corporation",
            "java.specification.version" : "1.7",
            "java.util.logging.manager" : "org.jboss.logmanager.LogManager",
            "java.vendor" : "Oracle Corporation",
            "java.vendor.url" : "http://java.oracle.com/",
            "java.vendor.url.bug" : "http://bugreport.sun.com/bugreport/",
            "java.version" : "1.7.0_05",
            "java.vm.info" : "mixed mode",
            "java.vm.name" : "Java HotSpot(TM) 64-Bit Server VM",
            "java.vm.specification.name" : "Java Virtual Machine Specification",
            "java.vm.specification.vendor" : "Oracle Corporation",
            "java.vm.specification.version" : "1.7",
            "java.vm.vendor" : "Oracle Corporation",
            "java.vm.version" : "23.1-b03",
            "javax.management.builder.initial" : "org.jboss.as.jmx.PluggableMBeanServerBuilder",
            "javax.xml.datatype.DatatypeFactory" : "__redirected.__DatatypeFactory",
            "javax.xml.parsers.DocumentBuilderFactory" : "__redirected.__DocumentBuilderFactory",
            "javax.xml.parsers.SAXParserFactory" : "__redirected.__SAXParserFactory",
            "javax.xml.stream.XMLEventFactory" : "__redirected.__XMLEventFactory",
            "javax.xml.stream.XMLInputFactory" : "__redirected.__XMLInputFactory",
            "javax.xml.stream.XMLOutputFactory" : "__redirected.__XMLOutputFactory",
            "javax.xml.transform.TransformerFactory" : "__redirected.__TransformerFactory",
            "javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema" : "__redirected.__SchemaFactory",
            "javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom" : "__redirected.__XPathFactory",
            "jboss.home.dir" : "/home/userone/jboss-as-7.1.2",
            "jboss.host.name" : "localhost",
            "jboss.modules.dir" : "/home/userone/jboss-as-7.1.2/modules",
            "jboss.modules.system.pkgs" : "org.jboss.byteman",
            "jboss.node.name" : "localhost",
            "jboss.qualified.host.name" : "localhost.localdomain",
            "jboss.server.base.dir" : "/home/userone/jboss-as-7.1.2/standalone",
            "jboss.server.config.dir" : "/home/userone/jboss-as-7.1.2/standalone/configuration",
            "jboss.server.data.dir" : "/home/userone/jboss-as-7.1.2/standalone/data",
            "jboss.server.default.config" : "standalone.xml",
            "jboss.server.deploy.dir" : "/home/userone/jboss-as-7.1.2/standalone/data/content",
            "jboss.server.log.dir" : "/home/userone/jboss-as-7.1.2/standalone/log",
            "jboss.server.name" : "localhost",
            "jboss.server.temp.dir" : "/home/userone/jboss-as-7.1.2/standalone/tmp",
            "line.separator" : "\n",
            "logging.configuration" : "file:/home/userone/jboss-as-7.1.2/standalone/configuration/logging.properties",
            "module.path" : "/home/userone/jboss-as-7.1.2/modules",
            "org.apache.coyote.http11.Http11Protocol.COMPRESSION" : "on",
            "org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" : "text/javascript,text/css,text/html",
            "org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIN_SIZE" : "5",
            "org.jboss.as.logging.per-deployment" : "false",
            "org.jboss.boot.log.file" : "/home/userone/jboss-as-7.1.2/standalone/log/boot.log",
            "org.jboss.com.sun.CORBA.ORBUseDynamicStub" : "true",
            "org.jboss.resolver.warning" : "true",
            "org.jboss.security.context.ThreadLocal" : "true",
            "org.omg.CORBA.ORBClass" : "org.jacorb.orb.ORB",
            "org.omg.CORBA.ORBSingletonClass" : "org.jacorb.orb.ORBSingleton",
            "org.osgi.vendor.framework" : "org.jboss.osgi.framework",
            "org.xml.sax.driver" : "__redirected.__XMLReaderFactory",
            "os.arch" : "amd64",
            "os.name" : "Linux",
            "os.version" : "3.4.9-2.fc16.x86_64",
            "path.separator" : ":",
            "sun.arch.data.model" : "64",
            "sun.boot.class.path" : "/home/userone/jdk1.7.0_05/jre/lib/resources.jar:/home/userone/jdk1.7.0_05/jre/lib/rt.jar:/home/userone/jdk1.7.0_05/jre/lib/sunrsasign.jar:/home/userone/jdk1.7.0_05/jre/lib/jsse.jar:/home/userone/jdk1.7.0_05/jre/lib/jce.jar:/home/userone/jdk1.7.0_05/jre/lib/charsets.jar:/home/userone/jdk1.7.0_05/jre/lib/jfr.jar:/home/userone/jdk1.7.0_05/jre/classes",
            "sun.boot.library.path" : "/home/userone/jdk1.7.0_05/jre/lib/amd64",
            "sun.cpu.endian" : "little",
            "sun.cpu.isalist" : "",
            "sun.desktop" : "gnome",
            "sun.io.unicode.encoding" : "UnicodeLittle",
            "sun.java.command" : "/home/userone/jboss-as-7.1.2/jboss-modules.jar -mp /home/userone/jboss-as-7.1.2/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/home/userone/jboss-as-7.1.2 -Djboss.server.base.dir=/home/userone/jboss-as-7.1.2/standalone -c standalone-full.xml -Dorg.jboss.as.logging.per-deployment=false",
            "sun.java.launcher" : "SUN_STANDARD",
            "sun.jnu.encoding" : "UTF-8",
            "sun.management.compiler" : "HotSpot 64-Bit Tiered Compilers",
            "sun.os.patch.level" : "unknown",
            "sun.rmi.dgc.client.gcInterval" : "3600000",
            "sun.rmi.dgc.server.gcInterval" : "3600000",
            "user.country" : "US",
            "user.dir" : "/home/userone/jboss-as-7.1.2/bin",
            "user.home" : "/home/jsenshar",
            "user.language" : "en",
            "user.name" : "jsenshar",
            "user.timezone" : "Asia/Calcutta"
        },
        "uptime" : 114236761,
        "object-name" : "java.lang:type=Runtime"
    }
}

Getting Server Environment Details

curl --digest -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"read-resource", "include-runtime":"true", "address":[{"core-service":"server-environment"}], "json.pretty":1}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="39385b83b7b9b2abbd722a3bdb4d7173"
Date: Sun, 23 Sep 2012 19:47:56 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 19:47:56 GMT

{
    "outcome" : "success",
    "result" : {
        "base-dir" : "/home/userone/jboss-as-7.1.2/standalone",
        "config-dir" : "/home/userone/jboss-as-7.1.2/standalone/configuration",
        "config-file" : "/home/userone/jboss-as-7.1.2/standalone/configuration/standalone-full.xml",
        "content-dir" : "/home/userone/jboss-as-7.1.2/standalone/data/content",
        "data-dir" : "/home/userone/jboss-as-7.1.2/standalone/data",
        "deploy-dir" : "/home/userone/jboss-as-7.1.2/standalone/data/content",
        "ext-dirs" : [
            "/home/userone/jdk1.7.0_05/jre/lib/ext",
            "/usr/java/packages/lib/ext"
        ],
        "home-dir" : "/home/userone/jboss-as-7.1.2",
        "host-name" : "localhost",
        "initial-running-mode" : "NORMAL",
        "launch-type" : "STANDALONE",
        "log-dir" : "/home/userone/jboss-as-7.1.2/standalone/log",
        "modules-dir" : "/home/userone/jboss-as-7.1.2/modules",
        "node-name" : "localhost",
        "qualified-host-name" : "localhost.localdomain",
        "server-name" : "localhost",
        "temp-dir" : "/home/userone/jboss-as-7.1.2/standalone/tmp"
    }
}

Getting Runtime Statistics of Http Connector of web subsystem

curl --digest -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"read-resource", "include-runtime":"true", "address":[{"subsystem":"web"},{"connector":"http"}], "json.pretty":1}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="37b5ee0cb0dde6f3963e7660a4439862"
Date: Sun, 23 Sep 2012 19:51:16 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 19:51:16 GMT

{
    "outcome" : "success",
    "result" : {
        "bytesReceived" : "0",
        "bytesSent" : "0",
        "enable-lookups" : false,
        "enabled" : true,
        "errorCount" : "0",
        "executor" : null,
        "max-connections" : 20,
        "max-post-size" : 2097152,
        "max-save-post-size" : 4096,
        "maxTime" : "0",
        "name" : "http",
        "processingTime" : "0",
        "protocol" : "HTTP/1.1",
        "proxy-name" : null,
        "proxy-port" : null,
        "redirect-port" : 8433,
        "requestCount" : "0",
        "scheme" : "http",
        "secure" : false,
        "socket-binding" : "http",
        "ssl" : null,
        "virtual-server" : null
    }
}

Shutting down JBoss Standalone Server

curl --digest -D - http://admin:admin123@localhost:9990/management/ -d '{"operation":"shutdown" , "json.pretty":1}' -HContent-Type:application/json

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="dd74ab565fbf5345ebb015cbd337ffea"
Date: Sun, 23 Sep 2012 20:08:02 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 20:08:02 GMT

{"outcome" : "success"}

Getting Application “TestLogging.ear” Details

curl --digest -D - http://admin:admin123@localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"read-resource", "address":["deployment","TestLogging.ear"], "json.pretty":1}' 

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="486aa728c5bd526ab1bf1b96941252e2"
Date: Sat, 22 Sep 2012 11:07:38 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sat, 22 Sep 2012 11:07:38 GMT

{
    "outcome" : "success",
    "result" : {
        "content" : [{
            "path" : "deployments/TestLogging.ear",
            "relative-to" : "jboss.server.base.dir",
            "archive" : false
        }],
        "enabled" : true,
        "name" : "TestLogging.ear",
        "persistent" : false,
        "runtime-name" : "TestLogging.ear",
        "subsystem" : null,
        "subdeployment" : {
            "Log4jDemoOne.war" : null,
            "Log4jDemoTwo.war" : null
        }
    }
}

Getting Runtime Statistics of “Test_EAR.ear” application (session/request monitoring)

curl --digest -D - http://admin:admin123@localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"read-resource","recursive":"true", "include-runtime":"true", "address":["deployment","Test_EAR.ear"], "json.pretty":1}'

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="80f9f113cda3ea0430c0a1474ac9b736"
Date: Sun, 23 Sep 2012 20:20:29 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sun, 23 Sep 2012 20:20:29 GMT

{
    "outcome" : "success",
    "result" : {
        "content" : [{"hash" : {
            "BYTES_VALUE" : "mSLytFVBop/W+VqanbNUztt7DRY="
        }}],
        "enabled" : true,
        "name" : "Test_EAR.ear",
        "persistent" : true,
        "runtime-name" : "test_trn.ear",
        "status" : "no metrics available",
        "subsystem" : null,
        "subdeployment" : {"Test_WAR.war" : {"subsystem" : {"web" : {
            "active-sessions" : 1,
            "context-root" : "/Test_WAR",
            "duplicated-session-ids" : 0,
            "expired-sessions" : 0,
            "max-active-sessions" : 1,
            "rejected-sessions" : 0,
            "servlet" : null,
            "session-avg-alive-time" : 0,
            "session-max-alive-time" : 0,
            "sessions-created" : 1,
            "virtual-host" : "default-host"
        }}}}
    }
}

Getting JNDI view details (list Jndi) / (jndi-view)

curl --digest -D - http://admin:admin123@localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"jndi-view", "address":["subsystem","naming"], "json.pretty":1}'

HTTP/1.1 401 Unauthorized
Content-length: 0
Www-authenticate: Digest realm="ManagementRealm",nonce="e92a46c2e34810ed0084542cc59ca38f"
Date: Sat, 22 Sep 2012 11:13:29 GMT

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: application/json
Date: Sat, 22 Sep 2012 11:13:29 GMT

{
    "outcome" : "success",
    "result" : {
        "java: contexts" : {
            "java:" : {
                "ConnectionFactory" : {
                    "class-name" : "org.hornetq.jms.client.HornetQJMSConnectionFactory",
                    "value" : "HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-invm-InVMConnectorFactory?server-id=0], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]"
                },
                "JmsXA" : {
                    "class-name" : "org.hornetq.ra.HornetQRAConnectionFactoryImpl",
                    "value" : "org.hornetq.ra.HornetQRAConnectionFactoryImpl@59ffb3fa"
                },
                "TransactionManager" : {
                    "class-name" : "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate",
                    "value" : "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@13190ef8"
                },
                "ejb" : {
                    "class-name" : "javax.naming.Context",
                    "children" : {"mgmt" : {
                        "class-name" : "javax.naming.Context",
                        "children" : null
                    }}
                },
                "jboss" : {
                    "class-name" : "javax.naming.Context",
                    "value" : "org.jboss.as.naming.WritableServiceBasedNamingStore@6ab0fa3b"
                }
            },
            "java:jboss" : {
                "ORB" : {
                    "class-name" : "org.jacorb.orb.ORB",
                    "value" : "org.jacorb.orb.ORB@274fb2cf"
                },
                "TransactionManager" : {
                    "class-name" : "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate",
                    "value" : "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@13190ef8"
                },
                "TransactionSynchronizationRegistry" : {
                    "class-name" : "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple",
                    "value" : "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@61644832"
                },
                "UserTransaction" : {
                    "class-name" : "org.jboss.tm.usertx.client.ServerVMClientUserTransaction",
                    "value" : "org.jboss.tm.usertx.client.ServerVMClientUserTransaction@5e6d855c"
                },
                "corbanaming" : {
                    "class-name" : "org.omg.CosNaming._NamingContextExtStub",
                    "value" : "IOR:000000000000002B49444C3A6F6D672E6F72672F436F734E616D696E672F4E616D696E67436F6E746578744578743A312E3000000000000100000000000000B0000102000000000A3132372E302E302E31000DC8000000114A426F73732F4E616D696E672F726F6F74000000000000040000000000000008000000004A4143000000000100000020000000000501000100000001000100010001010900000002050100010001010000000014000000080000001A00000DC90000002100000030000000000000000100000000000000220000000000000000000000000000000000000000000000000000000000000000"
                },
                "irpoa" : {
                    "class-name" : "org.jacorb.poa.POA",
                    "value" : "org.jacorb.poa.POA@7ebffc91"
                },
                "jaas" : {
                    "class-name" : "$Proxy13",
                    "children" : {
                        "jboss-ejb-policy" : {
                            "class-name" : "org.jboss.as.security.plugins.SecurityDomainContext",
                            "value" : "org.jboss.security.authentication.JBossCachedAuthenticationManager@7c1e7bee"
                        },
                        "other" : {
                            "class-name" : "org.jboss.as.security.plugins.SecurityDomainContext",
                            "value" : "org.jboss.security.authentication.JBossCachedAuthenticationManager@355a85eb"
                        },
                        "jboss-web-policy" : {
                            "class-name" : "org.jboss.as.security.plugins.SecurityDomainContext",
                            "value" : "org.jboss.security.authentication.JBossCachedAuthenticationManager@4a0e22aa"
                        }
                    }
                },
                "poa" : {
                    "class-name" : "org.jacorb.poa.POA",
                    "value" : "org.jacorb.poa.POA@6605ece1"
                },
                "mail" : {
                    "class-name" : "javax.naming.Context",
                    "children" : {"Default" : {
                        "class-name" : "javax.mail.Session",
                        "value" : "javax.mail.Session@3e475bbb"
                    }}
                },
                "datasources" : {
                    "class-name" : "javax.naming.Context",
                    "children" : {"ExampleDS" : {
                        "class-name" : "org.jboss.jca.adapters.jdbc.WrapperDataSource",
                        "value" : "org.jboss.jca.adapters.jdbc.WrapperDataSource@9b534aa"
                    }}
                },
                "exported" : {
                    "class-name" : "javax.naming.Context",
                    "value" : "org.jboss.as.naming.WritableServiceBasedNamingStore@579489e0"
                }
            },
            "java:global" : null
        },
        "applications" : {"TestLogging.ear" : {
            "java:app" : {
                "AppName" : {
                    "class-name" : "java.lang.String",
                    "value" : "TestLogging"
                },
                "env" : {
                    "class-name" : "org.jboss.as.naming.NamingContext",
                    "children" : null
                }
            },
            "modules" : null
        }}
    }
}

Dumping JBoss Services which are active

curl --digest -D - http://admin:admin123@localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"dump-services", "address":["core-service","service-container"], "json.pretty":1}'

.
.
Thanks :)
MiddlewareMagic Team


Managing JBossAS7 with HTTP-JSON APIs using wget

Hi,

JBoss AS7 is one of the bestest application available in the Middleware World, As it provides much more facilities to the Administrators in order to manage/configure and monitor various resources. As we are already familier with a utility called as “$JBOSS_HOME/bin/jboss-cli.sh” is one of the most powerful and easiest utility which can be used to manage and monitor JBossAS7.

In this demonstration we will see that JBoss AS7 provides another best feature, which allows us to easily access & monitor the JBoss AS7 using OS level utilities like “curl” or “wget”. Yes, JBoss AS7 provides HTTP-JSON based APIs which can be used to achieve the same. So lets see some of it’s features…

So lets start JBossAS7 like following:

    ./standalone.sh -c standalone-full.xml

NOTE: In all the following operations we will assume that you have created a ManagementRealm User with username “admin” and password as “admin123″ (you can create any user name/password based on your requirement), Then change the username & password in the mentioned demo URLs like “http://admin:admin123@localhost:9990/management/

NOTE: Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.
Wget can follow links in HTML pages and create local versions of remote web sites, fully recreating the directory structure of the original site. This is sometimes referred to as “recursive downloading.” While doing that, Wget respects the Robot Exclusion Standard (/robots.txt). Wget can be instructed to convert the links in downloaded HTML files to the local files for offline viewing.
More informations about “wget” utility can be found in the following link: http://en.wikipedia.org/wiki/Wget

Http Connector’s Runtime statistics

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/web/connector/http?operation=resource&include-runtime=true&recursive&json.pretty"

{
    "bytesReceived" : "0",
    "bytesSent" : "0",
    "enable-lookups" : false,
    "enabled" : true,
    "errorCount" : "0",
    "executor" : null,
    "max-connections" : 20,
    "max-post-size" : 2097152,
    "max-save-post-size" : 4096,
    "maxTime" : "124",
    "name" : "http",
    "processingTime" : "255",
    "protocol" : "HTTP/1.1",
    "proxy-name" : null,
    "proxy-port" : null,
    "redirect-port" : 8433,
    "requestCount" : "21",
    "scheme" : "http",
    "secure" : false,
    "socket-binding" : "http",
    "ssl" : null,
    "virtual-server" : null
}

Accessing the “jsp-configuration” of JBoss Web Container

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/web/configuration/jsp-configuration?operation=resource&recursive&json.pretty"

{
    "check-interval" : 0,
    "development" : false,
    "disabled" : false,
    "display-source-fragment" : true,
    "dump-smap" : false,
    "error-on-use-bean-invalid-class-attribute" : false,
    "generate-strings-as-char-arrays" : false,
    "java-encoding" : "UTF8",
    "keep-generated" : true,
    "mapped-file" : true,
    "modification-test-interval" : 4,
    "recompile-on-fail" : false,
    "scratch-dir" : null,
    "smap" : true,
    "source-vm" : "1.5",
    "tag-pooling" : true,
    "target-vm" : "1.5",
    "trim-spaces" : false,
    "x-powered-by" : true
}

Accessing Deployment Details

wget -O out.txt "http://admin:admin123@localhost:9990/management/deployment/TestLogging.ear/subdeployment/Log4jDemoOne.war?operation=resource&include-runtime&recursive&json.pretty"

Suppose you have deployed an EAP application with name “TestLogging.ear” which contains a sunmodule with name “Log4jDemoOne.war” then you can get it’s runtime information using the above command, the outputwill be something like following:


{"subsystem" : {"web" : {
    "active-sessions" : 0,
    "context-root" : "/Log4jDemoOne",
    "duplicated-session-ids" : 0,
    "expired-sessions" : 2,
    "max-active-sessions" : 2,
    "rejected-sessions" : 0,
    "servlet" : null,
    "session-avg-alive-time" : 1851,
    "session-max-alive-time" : 1852,
    "sessions-created" : 2,
    "virtual-host" : "default-host"
}}}

In order to get the EAR depployment details you can use the following command:

wget -O out.txt "http://admin:admin123@localhost:9990/management/deployment/TestLogging.ear?operation=resource&recursive&json.pretty"

{
    "content" : [{
        "path" : "deployments/TestLogging.ear",
        "relative-to" : "jboss.server.base.dir",
        "archive" : false
    }],
    "enabled" : true,
    "name" : "TestLogging.ear",
    "persistent" : false,
    "runtime-name" : "TestLogging.ear",
    "subsystem" : null,
    "subdeployment" : {
        "Log4jDemoOne.war" : {"subsystem" : {"web" : {
            "context-root" : "/Log4jDemoOne",
            "servlet" : null,
            "virtual-host" : "default-host"
        }}},
        "Log4jDemoTwo.war" : {"subsystem" : {"web" : {
            "context-root" : "/Log4jDemoTwo",
            "servlet" : null,
            "virtual-host" : "default-host"
        }}}
    }
}

Getting Management Interface Details

wget -O out.txt "http://admin:admin123@localhost:9990/management/interface/public?operation=resource&recursive&json.pretty"

{
    "any" : null,
    "any-address" : null,
    "any-ipv4-address" : null,
    "any-ipv6-address" : null,
    "inet-address" : {
        "EXPRESSION_VALUE" : "${jboss.bind.address:127.0.0.1}"
    },
    "link-local-address" : null,
    "loopback" : null,
    "loopback-address" : null,
    "multicast" : null,
    "name" : "public",
    "nic" : null,
    "nic-match" : null,
    "not" : null,
    "point-to-point" : null,
    "public-address" : null,
    "site-local-address" : null,
    "subnet-match" : null,
    "up" : null,
    "virtual" : null
}

DataSource Configuration & Runtime Details

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/datasources/data-source/ExampleDS/statistics/pool?read-resource&include-runtime=true&recursive&json.pretty"

{
    "ActiveCount" : "0",
    "AvailableCount" : "20",
    "AverageBlockingTime" : "0",
    "AverageCreationTime" : "0",
    "CreatedCount" : "0",
    "DestroyedCount" : "0",
    "MaxCreationTime" : "0",
    "MaxUsedCount" : "0",
    "MaxWaitTime" : "0",
    "TimedOut" : "0",
    "TotalBlockingTime" : "0",
    "TotalCreationTime" : "0"
}

Geting Jdbc Statictics:

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/datasources/data-source/ExampleDS/statistics/jdbc?read-resource&include-runtime=true&recursive&json.pretty"

{
    "PreparedStatementCacheAccessCount" : "0",
    "PreparedStatementCacheAddCount" : "0",
    "PreparedStatementCacheCurrentSize" : "0",
    "PreparedStatementCacheDeleteCount" : "0",
    "PreparedStatementCacheHitCount" : "0",
    "PreparedStatementCacheMissCount" : "0"
}

Getting all the informations related to DataSource at once:


wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/datasources/data-source/ExampleDS/statistics?read-resource&include-runtime=true&recursive&json.pretty"

{
    "allocation-retry" : null,
    "allocation-retry-wait-millis" : null,
    "allow-multiple-users" : null,
    "background-validation" : null,
    "background-validation-millis" : null,
    "blocking-timeout-wait-millis" : null,
    "check-valid-connection-sql" : null,
    "connection-properties" : null,
    "connection-url" : "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1",
    "datasource-class" : null,
    "driver-class" : null,
    "driver-name" : "h2",
    "enabled" : true,
    "exception-sorter-class-name" : null,
    "exception-sorter-properties" : null,
    "flush-strategy" : null,
    "idle-timeout-minutes" : null,
    "jndi-name" : "java:jboss/datasources/ExampleDS",
    "jta" : true,
    "max-pool-size" : null,
    "min-pool-size" : null,
    "new-connection-sql" : null,
    "password" : "sa",
    "pool-prefill" : null,
    "pool-use-strict-min" : null,
    "prepared-statements-cache-size" : null,
    "query-timeout" : null,
    "reauth-plugin-class-name" : null,
    "reauth-plugin-properties" : null,
    "security-domain" : null,
    "set-tx-query-timeout" : false,
    "share-prepared-statements" : false,
    "spy" : false,
    "stale-connection-checker-class-name" : null,
    "stale-connection-checker-properties" : null,
    "track-statements" : "NOWARN",
    "transaction-isolation" : null,
    "url-delimiter" : null,
    "url-selector-strategy-class-name" : null,
    "use-ccm" : true,
    "use-fast-fail" : false,
    "use-java-context" : true,
    "use-try-lock" : null,
    "user-name" : "sa",
    "valid-connection-checker-class-name" : null,
    "valid-connection-checker-properties" : null,
    "validate-on-match" : false,
    "statistics" : {
        "jdbc" : {
            "PreparedStatementCacheAccessCount" : "0",
            "PreparedStatementCacheAddCount" : "0",
            "PreparedStatementCacheCurrentSize" : "0",
            "PreparedStatementCacheDeleteCount" : "0",
            "PreparedStatementCacheHitCount" : "0",
            "PreparedStatementCacheMissCount" : "0"
        },
        "pool" : {
            "ActiveCount" : "0",
            "AvailableCount" : "20",
            "AverageBlockingTime" : "0",
            "AverageCreationTime" : "0",
            "CreatedCount" : "0",
            "DestroyedCount" : "0",
            "MaxCreationTime" : "0",
            "MaxUsedCount" : "0",
            "MaxWaitTime" : "0",
            "TimedOut" : "0",
            "TotalBlockingTime" : "0",
            "TotalCreationTime" : "0"
        }
    }
}

Getting the <connection-url> attribute details of DataSource:

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/datasources/data-source/ExampleDS?operation=attribute&name=connection-url"

"jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"

Getting “set-tx-query-timeout” attribute information of DataSource

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/datasources/data-source/ExampleDS?operation=attribute&name=set-tx-query-timeout"

false

Getting DataSource’s Comlete Configuration related information

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/datasources/data-source/ExampleDS?operation=resource&recursive&json.pretty"

{
    "allocation-retry" : null,
    "allocation-retry-wait-millis" : null,
    "allow-multiple-users" : null,
    "background-validation" : null,
    "background-validation-millis" : null,
    "blocking-timeout-wait-millis" : null,
    "check-valid-connection-sql" : null,
    "connection-properties" : null,
    "connection-url" : "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1",
    "datasource-class" : null,
    "driver-class" : null,
    "driver-name" : "h2",
    "enabled" : true,
    "exception-sorter-class-name" : null,
    "exception-sorter-properties" : null,
    "flush-strategy" : null,
    "idle-timeout-minutes" : null,
    "jndi-name" : "java:jboss/datasources/ExampleDS",
    "jta" : true,
    "max-pool-size" : null,
    "min-pool-size" : null,
    "new-connection-sql" : null,
    "password" : "sa",
    "pool-prefill" : null,
    "pool-use-strict-min" : null,
    "prepared-statements-cache-size" : null,
    "query-timeout" : null,
    "reauth-plugin-class-name" : null,
    "reauth-plugin-properties" : null,
    "security-domain" : null,
    "set-tx-query-timeout" : false,
    "share-prepared-statements" : false,
    "spy" : false,
    "stale-connection-checker-class-name" : null,
    "stale-connection-checker-properties" : null,
    "track-statements" : "NOWARN",
    "transaction-isolation" : null,
    "url-delimiter" : null,
    "url-selector-strategy-class-name" : null,
    "use-ccm" : true,
    "use-fast-fail" : false,
    "use-java-context" : true,
    "use-try-lock" : null,
    "user-name" : "sa",
    "valid-connection-checker-class-name" : null,
    "valid-connection-checker-properties" : null,
    "validate-on-match" : false,
    "statistics" : {
        "jdbc" : null,
        "pool" : null
    }
}

Getting Memory & Thread & Runtime Details with server properties

 wget -O out.txt "http://admin:admin123@localhost:9990/management/core-service/platform-mbean?operation=resource&type=runtime&recursive&json.pretty"

{"type" : {
    "garbage-collector" : {"name" : {
        "PS_Scavenge" : {},
        "PS_MarkSweep" : {}
    }},
    "runtime" : {
        "name" : "24028@localhost.localdomain",
        "vm-name" : "Java HotSpot(TM) 64-Bit Server VM",
        "vm-vendor" : "Oracle Corporation",
        "vm-version" : "23.1-b03",
        "spec-name" : "Java Virtual Machine Specification",
        "spec-vendor" : "Oracle Corporation",
        "spec-version" : "1.7",
        "management-spec-version" : "1.2",
        "class-path" : "/home/userone/jboss-as-7.1.2/jboss-modules.jar",
        "library-path" : "/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib",
        "boot-class-path-supported" : true,
        "boot-class-path" : "/home/userone/jdk1.7.0_05/jre/lib/resources.jar:/home/userone/jdk1.7.0_05/jre/lib/rt.jar:/home/userone/jdk1.7.0_05/jre/lib/sunrsasign.jar:/home/userone/jdk1.7.0_05/jre/lib/jsse.jar:/home/userone/jdk1.7.0_05/jre/lib/jce.jar:/home/userone/jdk1.7.0_05/jre/lib/charsets.jar:/home/userone/jdk1.7.0_05/jre/lib/jfr.jar:/home/userone/jdk1.7.0_05/jre/classes",
        "input-arguments" : [
            "-D[Standalone]",
            "-XX:+UseCompressedOops",
            "-Xms1303m",
            "-Xmx1303m",
            "-XX:MaxPermSize=256m",
            "-Djava.net.preferIPv4Stack=true",
            "-Dorg.jboss.resolver.warning=true",
            "-Dsun.rmi.dgc.client.gcInterval=3600000",
            "-Dsun.rmi.dgc.server.gcInterval=3600000",
            "-Djboss.modules.system.pkgs=org.jboss.byteman",
            "-Djava.awt.headless=true",
            "-Djboss.server.default.config=standalone.xml",
            "-Dorg.jboss.boot.log.file=/home/userone/jboss-as-7.1.2/standalone/log/boot.log",
            "-Dlogging.configuration=file:/home/userone/jboss-as-7.1.2/standalone/configuration/logging.properties"
        ],
        "start-time" : 1348315286154,
        "system-properties" : {
            "[Standalone]" : "",
            "awt.toolkit" : "sun.awt.X11.XToolkit",
            "catalina.home" : "/home/userone/jboss-as-7.1.2/standalone/tmp",
            "file.encoding" : "UTF-8",
            "file.encoding.pkg" : "sun.io",
            "file.separator" : "/",
            "java.awt.graphicsenv" : "sun.awt.X11GraphicsEnvironment",
            "java.awt.headless" : "true",
            "java.awt.printerjob" : "sun.print.PSPrinterJob",
            "java.class.path" : "/home/userone/jboss-as-7.1.2/jboss-modules.jar",
            "java.class.version" : "51.0",
            "java.endorsed.dirs" : "/home/userone/jdk1.7.0_05/jre/lib/endorsed",
            "java.ext.dirs" : "/home/userone/jdk1.7.0_05/jre/lib/ext:/usr/java/packages/lib/ext",
            "java.home" : "/home/userone/jdk1.7.0_05/jre",
            "java.io.tmpdir" : "/tmp",
            "java.library.path" : "/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib",
            "java.naming.factory.url.pkgs" : "org.jboss.as.naming.interfaces:org.jboss.ejb.client.naming",
            "java.net.preferIPv4Stack" : "true",
            "java.protocol.handler.pkgs" : "org.jboss.net.protocol|org.jboss.vfs.protocol",
            "java.runtime.name" : "Java(TM) SE Runtime Environment",
            "java.runtime.version" : "1.7.0_05-b05",
            "java.specification.name" : "Java Platform API Specification",
            "java.specification.vendor" : "Oracle Corporation",
            "java.specification.version" : "1.7",
            "java.util.logging.manager" : "org.jboss.logmanager.LogManager",
            "java.vendor" : "Oracle Corporation",
            "java.vendor.url" : "http://java.oracle.com/",
            "java.vendor.url.bug" : "http://bugreport.sun.com/bugreport/",
            "java.version" : "1.7.0_05",
            "java.vm.info" : "mixed mode",
            "java.vm.name" : "Java HotSpot(TM) 64-Bit Server VM",
            "java.vm.specification.name" : "Java Virtual Machine Specification",
            "java.vm.specification.vendor" : "Oracle Corporation",
            "java.vm.specification.version" : "1.7",
            "java.vm.vendor" : "Oracle Corporation",
            "java.vm.version" : "23.1-b03",
            "javax.management.builder.initial" : "org.jboss.as.jmx.PluggableMBeanServerBuilder",
            "javax.xml.datatype.DatatypeFactory" : "__redirected.__DatatypeFactory",
            "javax.xml.parsers.DocumentBuilderFactory" : "__redirected.__DocumentBuilderFactory",
            "javax.xml.parsers.SAXParserFactory" : "__redirected.__SAXParserFactory",
            "javax.xml.stream.XMLEventFactory" : "__redirected.__XMLEventFactory",
            "javax.xml.stream.XMLInputFactory" : "__redirected.__XMLInputFactory",
            "javax.xml.stream.XMLOutputFactory" : "__redirected.__XMLOutputFactory",
            "javax.xml.transform.TransformerFactory" : "__redirected.__TransformerFactory",
            "javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema" : "__redirected.__SchemaFactory",
            "javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom" : "__redirected.__XPathFactory",
            "jboss.home.dir" : "/home/userone/jboss-as-7.1.2",
            "jboss.host.name" : "localhost",
            "jboss.modules.dir" : "/home/userone/jboss-as-7.1.2/modules",
            "jboss.modules.system.pkgs" : "org.jboss.byteman",
            "jboss.node.name" : "localhost",
            "jboss.qualified.host.name" : "localhost.localdomain",
            "jboss.server.base.dir" : "/home/userone/jboss-as-7.1.2/standalone",
            "jboss.server.config.dir" : "/home/userone/jboss-as-7.1.2/standalone/configuration",
            "jboss.server.data.dir" : "/home/userone/jboss-as-7.1.2/standalone/data",
            "jboss.server.default.config" : "standalone.xml",
            "jboss.server.deploy.dir" : "/home/userone/jboss-as-7.1.2/standalone/data/content",
            "jboss.server.log.dir" : "/home/userone/jboss-as-7.1.2/standalone/log",
            "jboss.server.name" : "localhost",
            "jboss.server.temp.dir" : "/home/userone/jboss-as-7.1.2/standalone/tmp",
            "line.separator" : "\n",
            "logging.configuration" : "file:/home/userone/jboss-as-7.1.2/standalone/configuration/logging.properties",
            "module.path" : "/home/userone/jboss-as-7.1.2/modules",
            "org.apache.coyote.http11.Http11Protocol.COMPRESSION" : "on",
            "org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" : "text/javascript,text/css,text/html",
            "org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIN_SIZE" : "5",
            "org.jboss.as.logging.per-deployment" : "false",
            "org.jboss.boot.log.file" : "/home/userone/jboss-as-7.1.2/standalone/log/boot.log",
            "org.jboss.com.sun.CORBA.ORBUseDynamicStub" : "true",
            "org.jboss.resolver.warning" : "true",
            "org.jboss.security.context.ThreadLocal" : "true",
            "org.omg.CORBA.ORBClass" : "org.jacorb.orb.ORB",
            "org.omg.CORBA.ORBSingletonClass" : "org.jacorb.orb.ORBSingleton",
            "org.osgi.vendor.framework" : "org.jboss.osgi.framework",
            "org.xml.sax.driver" : "__redirected.__XMLReaderFactory",
            "os.arch" : "amd64",
            "os.name" : "Linux",
            "os.version" : "3.4.9-2.fc16.x86_64",
            "path.separator" : ":",
            "sun.arch.data.model" : "64",
            "sun.boot.class.path" : "/home/userone/jdk1.7.0_05/jre/lib/resources.jar:/home/userone/jdk1.7.0_05/jre/lib/rt.jar:/home/userone/jdk1.7.0_05/jre/lib/sunrsasign.jar:/home/userone/jdk1.7.0_05/jre/lib/jsse.jar:/home/userone/jdk1.7.0_05/jre/lib/jce.jar:/home/userone/jdk1.7.0_05/jre/lib/charsets.jar:/home/userone/jdk1.7.0_05/jre/lib/jfr.jar:/home/userone/jdk1.7.0_05/jre/classes",
            "sun.boot.library.path" : "/home/userone/jdk1.7.0_05/jre/lib/amd64",
            "sun.cpu.endian" : "little",
            "sun.cpu.isalist" : "",
            "sun.desktop" : "gnome",
            "sun.io.unicode.encoding" : "UnicodeLittle",
            "sun.java.command" : "/home/userone/jboss-as-7.1.2/jboss-modules.jar -mp /home/userone/jboss-as-7.1.2/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/home/userone/jboss-as-7.1.2 -Djboss.server.base.dir=/home/userone/jboss-as-7.1.2/standalone -c standalone-full.xml -Dorg.jboss.as.logging.per-deployment=false",
            "sun.java.launcher" : "SUN_STANDARD",
            "sun.jnu.encoding" : "UTF-8",
            "sun.management.compiler" : "HotSpot 64-Bit Tiered Compilers",
            "sun.os.patch.level" : "unknown",
            "sun.rmi.dgc.client.gcInterval" : "3600000",
            "sun.rmi.dgc.server.gcInterval" : "3600000",
            "user.country" : "US",
            "user.dir" : "/home/userone/jboss-as-7.1.2/bin",
            "user.home" : "/home/jsenshar",
            "user.language" : "en",
            "user.name" : "jsenshar",
            "user.timezone" : "Asia/Calcutta"
        },
        "uptime" : 14530013,
        "object-name" : "java.lang:type=Runtime"
    },
    "memory-manager" : {"name" : {
        "PS_Scavenge" : {},
        "CodeCacheManager" : {},
        "PS_MarkSweep" : {}
    }},
    "threading" : {
        "all-thread-ids" : [
            150,
            142,
            140,
            139,
            138,
            137,
            136,
            135,
            134,
            132,
            131,
            130,
            129,
            127,
            126,
            125,
            124,
            123,
            122,
            121,
            120,
            117,
            116,
            115,
            114,
            113,
            112,
            111,
            110,
            109,
            108,
            106,
            105,
            103,
            102,
            101,
            100,
            98,
            97,
            96,
            93,
            95,
            94,
            92,
            91,
            90,
            88,
            87,
            86,
            85,
            80,
            79,
            53,
            52,
            51,
            20,
            18,
            17,
            16,
            15,
            14,
            13,
            12,
            11,
            8,
            4,
            3,
            2
        ],
        "thread-contention-monitoring-supported" : true,
        "thread-cpu-time-supported" : true,
        "current-thread-cpu-time-supported" : true,
        "object-monitor-usage-supported" : true,
        "synchronizer-usage-supported" : true,
        "thread-contention-monitoring-enabled" : false,
        "thread-cpu-time-enabled" : true,
        "thread-count" : 68,
        "peak-thread-count" : 118,
        "total-started-thread-count" : 144,
        "daemon-thread-count" : 31,
        "current-thread-cpu-time" : 528324157,
        "current-thread-user-time" : 170000000,
        "object-name" : "java.lang:type=Threading"
    },
    "buffer-pool" : {"name" : {
        "mapped" : {},
        "direct" : {}
    }},
    "memory-pool" : {"name" : {
        "PS_Eden_Space" : {
            "name" : "PS_Eden_Space",
            "type" : "HEAP",
            "valid" : true,
            "memory-manager-names" : [
                "PS_MarkSweep",
                "PS_Scavenge"
            ],
            "usage-threshold-supported" : false,
            "collection-usage-threshold-supported" : true,
            "usage-threshold" : null,
            "collection-usage-threshold" : 0,
            "usage" : {
                "init" : 341639168,
                "used" : 154096440,
                "committed" : 341966848,
                "max" : 341966848
            },
            "peak-usage" : {
                "init" : 341639168,
                "used" : 341639168,
                "committed" : 341966848,
                "max" : 341966848
            },
            "usage-threshold-exceeded" : null,
            "usage-threshold-count" : null,
            "collection-usage-threshold-exceeded" : false,
            "collection-usage-threshold-count" : 0,
            "collection-usage" : {
                "init" : 341639168,
                "used" : 0,
                "committed" : 341966848,
                "max" : 341966848
            },
            "object-name" : "java.lang:type=MemoryPool,name=\"PS Eden Space\""
        },
        "PS_Old_Gen" : {
            "name" : "PS_Old_Gen",
            "type" : "HEAP",
            "valid" : true,
            "memory-manager-names" : ["PS_MarkSweep"],
            "usage-threshold-supported" : true,
            "collection-usage-threshold-supported" : true,
            "usage-threshold" : 0,
            "collection-usage-threshold" : 0,
            "usage" : {
                "init" : 910884864,
                "used" : 81936,
                "committed" : 910884864,
                "max" : 911605760
            },
            "peak-usage" : {
                "init" : 910884864,
                "used" : 81936,
                "committed" : 910884864,
                "max" : 911605760
            },
            "usage-threshold-exceeded" : false,
            "usage-threshold-count" : 0,
            "collection-usage-threshold-exceeded" : false,
            "collection-usage-threshold-count" : 0,
            "collection-usage" : {
                "init" : 910884864,
                "used" : 0,
                "committed" : 0,
                "max" : 911605760
            },
            "object-name" : "java.lang:type=MemoryPool,name=\"PS Old Gen\""
        },
        "PS_Survivor_Space" : {
            "name" : "PS_Survivor_Space",
            "type" : "HEAP",
            "valid" : true,
            "memory-manager-names" : [
                "PS_MarkSweep",
                "PS_Scavenge"
            ],
            "usage-threshold-supported" : false,
            "collection-usage-threshold-supported" : true,
            "usage-threshold" : null,
            "collection-usage-threshold" : 0,
            "usage" : {
                "init" : 56885248,
                "used" : 44903304,
                "committed" : 56885248,
                "max" : 56885248
            },
            "peak-usage" : {
                "init" : 56885248,
                "used" : 44903304,
                "committed" : 56885248,
                "max" : 56885248
            },
            "usage-threshold-exceeded" : null,
            "usage-threshold-count" : null,
            "collection-usage-threshold-exceeded" : false,
            "collection-usage-threshold-count" : 0,
            "collection-usage" : {
                "init" : 56885248,
                "used" : 44903304,
                "committed" : 56885248,
                "max" : 56885248
            },
            "object-name" : "java.lang:type=MemoryPool,name=\"PS Survivor Space\""
        },
        "PS_Perm_Gen" : {
            "name" : "PS_Perm_Gen",
            "type" : "NON_HEAP",
            "valid" : true,
            "memory-manager-names" : ["PS_MarkSweep"],
            "usage-threshold-supported" : true,
            "collection-usage-threshold-supported" : true,
            "usage-threshold" : 0,
            "collection-usage-threshold" : 0,
            "usage" : {
                "init" : 21757952,
                "used" : 53906776,
                "committed" : 54001664,
                "max" : 268435456
            },
            "peak-usage" : {
                "init" : 21757952,
                "used" : 53906776,
                "committed" : 54001664,
                "max" : 268435456
            },
            "usage-threshold-exceeded" : false,
            "usage-threshold-count" : 0,
            "collection-usage-threshold-exceeded" : false,
            "collection-usage-threshold-count" : 0,
            "collection-usage" : {
                "init" : 21757952,
                "used" : 0,
                "committed" : 0,
                "max" : 268435456
            },
            "object-name" : "java.lang:type=MemoryPool,name=\"PS Perm Gen\""
        },
        "Code_Cache" : {
            "name" : "Code_Cache",
            "type" : "NON_HEAP",
            "valid" : true,
            "memory-manager-names" : ["CodeCacheManager"],
            "usage-threshold-supported" : true,
            "collection-usage-threshold-supported" : false,
            "usage-threshold" : 0,
            "collection-usage-threshold" : null,
            "usage" : {
                "init" : 2555904,
                "used" : 1969024,
                "committed" : 2555904,
                "max" : 50331648
            },
            "peak-usage" : {
                "init" : 2555904,
                "used" : 1979776,
                "committed" : 2555904,
                "max" : 50331648
            },
            "usage-threshold-exceeded" : false,
            "usage-threshold-count" : 0,
            "collection-usage-threshold-exceeded" : null,
            "collection-usage-threshold-count" : null,
            "collection-usage" : null,
            "object-name" : "java.lang:type=MemoryPool,name=\"Code Cache\""
        }
    }},
    "compilation" : {
        "name" : "HotSpot 64-Bit Tiered Compilers",
        "compilation-time-monitoring-supported" : true,
        "total-compilation-time" : 7407,
        "object-name" : "java.lang:type=Compilation"
    },
    "memory" : {},
    "class-loading" : {},
    "operating-system" : {
        "name" : "Linux",
        "arch" : "amd64",
        "version" : "3.4.9-2.fc16.x86_64",
        "available-processors" : 4,
        "system-load-average" : 0.13,
        "object-name" : "java.lang:type=OperatingSystem"
    }
}}

Messaging & HornetQ subsystem related Details

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/messaging/hornetq-server/default?operation=resource&recursive&json.pretty"

{
    "acceptor" : null,
    "allow-failback" : true,
    "async-connection-execution-enabled" : true,
    "backup" : false,
    "bridge" : null,
    "broadcast-group" : null,
    "cluster-connection" : null,
    "cluster-password" : "CHANGE ME!!",
    "cluster-user" : "HORNETQ.CLUSTER.ADMIN.USER",
    "clustered" : false,
    "connection-ttl-override" : -1,
    "connector" : null,
    "connector-service" : null,
    "core-address" : null,
    "create-bindings-dir" : true,
    "create-journal-dir" : true,
    "discovery-group" : null,
    "divert" : null,
    "failback-delay" : 5000,
    "failover-on-shutdown" : false,
    "grouping-handler" : null,
    "id-cache-size" : 2000,
    "jms-queue" : null,
    "jms-topic" : null,
    "jmx-domain" : "org.hornetq",
    "jmx-management-enabled" : false,
    "journal-buffer-size" : null,
    "journal-buffer-timeout" : null,
    "journal-compact-min-files" : 10,
    "journal-compact-percentage" : 30,
    "journal-file-size" : 102400,
    "journal-max-io" : null,
    "journal-min-files" : 2,
    "journal-sync-non-transactional" : true,
    "journal-sync-transactional" : true,
    "journal-type" : "ASYNCIO",
    "live-connector-ref" : null,
    "log-journal-write-rate" : false,
    "management-address" : "jms.queue.hornetq.management",
    "management-notification-address" : "hornetq.notifications",
    "memory-measure-interval" : -1,
    "memory-warning-threshold" : 25,
    "message-counter-enabled" : false,
    "message-counter-max-day-history" : 10,
    "message-counter-sample-period" : 10000,
    "message-expiry-scan-period" : 30000,
    "message-expiry-thread-priority" : 3,
    "page-max-concurrent-io" : 5,
    "path" : null,
    "perf-blast-pages" : -1,
    "persist-delivery-count-before-delivery" : false,
    "persist-id-cache" : true,
    "persistence-enabled" : true,
    "queue" : null,
    "remoting-interceptors" : null,
    "run-sync-speed-test" : false,
    "scheduled-thread-pool-max-size" : 5,
    "security-domain" : "other",
    "security-enabled" : true,
    "security-invalidation-interval" : 10000,
    "server-dump-interval" : -1,
    "shared-store" : true,
    "thread-pool-max-size" : 30,
    "transaction-timeout" : 300000,
    "transaction-timeout-scan-period" : 1000,
    "wild-card-routing-enabled" : true,
    "address-setting" : {"#" : {
        "address-full-policy" : "BLOCK",
        "dead-letter-address" : "jms.queue.DLQ",
        "expiry-address" : "jms.queue.ExpiryQueue",
        "last-value-queue" : false,
        "max-delivery-attempts" : 10,
        "max-size-bytes" : 10485760,
        "message-counter-history-day-limit" : 10,
        "page-max-cache-size" : 5,
        "page-size-bytes" : 10485760,
        "redelivery-delay" : 0,
        "redistribution-delay" : -1,
        "send-to-dla-on-no-route" : false
    }},
    "connection-factory" : {
        "InVmConnectionFactory" : {
            "auto-group" : false,
            "block-on-acknowledge" : false,
            "block-on-durable-send" : true,
            "block-on-non-durable-send" : false,
            "cache-large-message-client" : false,
            "call-timeout" : 30000,
            "client-failure-check-period" : 30000,
            "client-id" : null,
            "compress-large-messages" : false,
            "confirmation-window-size" : -1,
            "connection-load-balancing-policy-class-name" : "org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy",
            "connection-ttl" : 60000,
            "connector" : {"in-vm" : null},
            "consumer-max-rate" : -1,
            "consumer-window-size" : 1048576,
            "discovery-group-name" : null,
            "discovery-initial-wait-timeout" : null,
            "dups-ok-batch-size" : 1048576,
            "entries" : ["java:/ConnectionFactory"],
            "factory-type" : null,
            "failover-on-initial-connection" : false,
            "failover-on-server-shutdown" : null,
            "group-id" : null,
            "ha" : false,
            "max-retry-interval" : 2000,
            "min-large-message-size" : 102400,
            "pre-acknowledge" : false,
            "producer-max-rate" : -1,
            "producer-window-size" : 65536,
            "reconnect-attempts" : 0,
            "retry-interval" : 2000,
            "retry-interval-multiplier" : 1.0,
            "scheduled-thread-pool-max-size" : 5,
            "thread-pool-max-size" : 30,
            "transaction-batch-size" : 1048576,
            "use-global-pools" : true
        },
        "RemoteConnectionFactory" : {
            "auto-group" : false,
            "block-on-acknowledge" : false,
            "block-on-durable-send" : true,
            "block-on-non-durable-send" : false,
            "cache-large-message-client" : false,
            "call-timeout" : 30000,
            "client-failure-check-period" : 30000,
            "client-id" : null,
            "compress-large-messages" : false,
            "confirmation-window-size" : -1,
            "connection-load-balancing-policy-class-name" : "org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy",
            "connection-ttl" : 60000,
            "connector" : {"netty" : null},
            "consumer-max-rate" : -1,
            "consumer-window-size" : 1048576,
            "discovery-group-name" : null,
            "discovery-initial-wait-timeout" : null,
            "dups-ok-batch-size" : 1048576,
            "entries" : ["java:jboss/exported/jms/RemoteConnectionFactory"],
            "factory-type" : null,
            "failover-on-initial-connection" : false,
            "failover-on-server-shutdown" : null,
            "group-id" : null,
            "ha" : false,
            "max-retry-interval" : 2000,
            "min-large-message-size" : 102400,
            "pre-acknowledge" : false,
            "producer-max-rate" : -1,
            "producer-window-size" : 65536,
            "reconnect-attempts" : 0,
            "retry-interval" : 2000,
            "retry-interval-multiplier" : 1.0,
            "scheduled-thread-pool-max-size" : 5,
            "thread-pool-max-size" : 30,
            "transaction-batch-size" : 1048576,
            "use-global-pools" : true
        }
    },
    "in-vm-acceptor" : {"in-vm" : {
        "param" : null,
        "server-id" : 0
    }},
    "in-vm-connector" : {"in-vm" : {
        "param" : null,
        "server-id" : 0
    }},
    "pooled-connection-factory" : {"hornetq-ra" : {
        "auto-group" : false,
        "block-on-acknowledge" : false,
        "block-on-durable-send" : true,
        "block-on-non-durable-send" : false,
        "cache-large-message-client" : false,
        "call-timeout" : 30000,
        "client-failure-check-period" : 30000,
        "client-id" : null,
        "confirmation-window-size" : -1,
        "connection-load-balancing-policy-class-name" : "org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy",
        "connection-ttl" : 60000,
        "connector" : {"in-vm" : null},
        "consumer-max-rate" : -1,
        "consumer-window-size" : 1048576,
        "discovery-group-name" : null,
        "discovery-initial-wait-timeout" : null,
        "dups-ok-batch-size" : 1048576,
        "entries" : ["java:/JmsXA"],
        "failover-on-initial-connection" : false,
        "failover-on-server-shutdown" : null,
        "group-id" : null,
        "ha" : false,
        "jndi-params" : null,
        "max-pool-size" : -1,
        "max-retry-interval" : 2000,
        "min-large-message-size" : 102400,
        "min-pool-size" : -1,
        "password" : null,
        "pre-acknowledge" : false,
        "producer-max-rate" : -1,
        "producer-window-size" : 65536,
        "reconnect-attempts" : 0,
        "retry-interval" : 2000,
        "retry-interval-multiplier" : 1.0,
        "scheduled-thread-pool-max-size" : 5,
        "setup-attempts" : null,
        "setup-interval" : null,
        "thread-pool-max-size" : 30,
        "transaction" : "xa",
        "transaction-batch-size" : 1048576,
        "use-global-pools" : true,
        "use-jndi" : null,
        "use-local-tx" : null,
        "user" : null
    }},
    "remote-acceptor" : {
        "netty" : {
            "param" : null,
            "socket-binding" : "messaging"
        },
        "netty-throughput" : {
            "socket-binding" : "messaging-throughput",
            "param" : {
                "batch-delay" : {"value" : "50"},
                "direct-deliver" : {"value" : "false"}
            }
        }
    },
    "remote-connector" : {
        "netty" : {
            "param" : null,
            "socket-binding" : "messaging"
        },
        "netty-throughput" : {
            "socket-binding" : "messaging-throughput",
            "param" : {"batch-delay" : {"value" : "50"}}
        }
    },
    "security-setting" : {"#" : {"role" : {"guest" : {
        "consume" : true,
        "create-durable-queue" : false,
        "create-non-durable-queue" : true,
        "delete-durable-queue" : false,
        "delete-non-durable-queue" : true,
        "manage" : false,
        "send" : true
    }}}}
}

Getting “cluster-user” attribute details of HornetQ server:

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/messaging/hornetq-server/default?operation=attribute&name=cluster-user"

"HORNETQ.CLUSTER.ADMIN.USER"

Loggign Subsystem Related Informations

Getting “console-handler” CONSOLE logger level information

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/console-handler/CONSOLE?operation=attribute&name=level"

"INFO"

Getting “console-handler” CONSOLE logger “autoflush” information

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/console-handler/CONSOLE?operation=attribute&name=autoflush"

true

Getting console-handler’s complete config informations

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/console-handler/CONSOLE?operation=resource&recursive&json.pretty"

{
    "autoflush" : true,
    "encoding" : null,
    "filter" : null,
    "formatter" : "%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n",
    "level" : "INFO",
    "target" : "System.out"
}

Getting articular logger’s like”org.apache.tomcat.util.modeler” information:

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/logger/org.apache.tomcat.util.modeler?operation=resource&recursive&json.pretty"

{
    "filter" : null,
    "handlers" : null,
    "level" : "WARN",
    "use-parent-handlers" : true
}

Getting “periodic-rotating-file-handler” formatter information:

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/periodic-rotating-file-handler/FILE?operation=attribute&name=formatter"

"%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"

Getting “” suffix information:

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/periodic-rotating-file-handler/FILE?operation=attribute&name=suffix"

".yyyy-MM-dd"

Getting “” complete config infromations

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/periodic-rotating-file-handler/FILE?operation=resource&recursive&json.pretty"

{
    "append" : true,
    "autoflush" : true,
    "encoding" : null,
    "file" : {
        "relative-to" : "jboss.server.log.dir",
        "path" : "server.log"
    },
    "filter" : null,
    "formatter" : "%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n",
    "level" : null,
    "suffix" : ".yyyy-MM-dd"
}

Getting “root-logger” logging level information:

wget -O out.txt "http://admin:admin123@localhost:9990/management/subsystem/logging/root-logger/ROOT?operation=attribute&name=level"

"INFO"

.
.
Thanks :)
MiddlewareMagic Team


  • Receive FREE Updates


    FREE Email updates of our new posts Enter your email address:



  • Magic Archives

  • Copyright © 2010-2012 Middleware Magic. All rights reserved. | Disclaimer