Wednesday, June 4, 2014

Check Important information like Product-name, Version, codename etc in Jboss EAP 6 or Wildfly 8 using CLI.

Sometimes, we need some information about the product we are using. Suppose, we want to know about the product version, name, codename or running mode in Jboss AS 7, Jboss EAP 6 or Wildfly-8.[0-1]. We can do all this easily using built in CLI utility.


Below are the steps :
1.) Start your Application Server Instance in any mode(standalone/domain). Here, we are doing all this in standalone mode.

root@lubuntu1:/data/wildfly-8.1.0.Final/bin# ./standalone.sh
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /data/wildfly-8.1.0.Final

  JAVA: java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

12:32:02,587 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
12:32:06,242 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
12:32:07,582 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015899: WildFly 8.1.0.Final "Kenny" starting
12:32:20,281 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
12:32:20,494 INFO  [org.xnio] (MSC service thread 1-2) XNIO version 3.2.2.Final
   2.) Create a new Management user using add-user.sh|bat
root@lubuntu1:/data/wildfly-8.1.0.Final/bin# ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a):

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : admin
User 'admin' already exists and is disabled, would you like to...
 a) Update the existing user password and roles
 b) Enable the existing user
 c) Type a new username
(a):
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
 - The password should be different from the username
Password :
Re-enter Password :

 3.) Connect to controller using ./jboss-cli.sh|bat script present in $JBOSS_HOME/bin directory.
lubuntu@lubuntu1:/data/wildfly-8.1.0.Final/bin$ ./jboss-cli.sh -c --controller=127.0.0.1:9990
Authenticating against security realm: ManagementRealm
Username: admin
Password:
[standalone@127.0.0.1:9990 /]

4.) Check all required Information :
     a.) Using 'ls -l'  command.
[standalone@127.0.0.1:9990 /] ls -l
ATTRIBUTE                VALUE       TYPE  
launch-type              STANDALONE  STRING
management-major-version 2           INT   
management-micro-version 0           INT   
management-minor-version 1           INT   
name                     lubuntu1    STRING
namespaces               []          OBJECT
process-type             Server      STRING
product-name             undefined   STRING
product-version          undefined   STRING
profile-name             undefined   STRING
release-codename         Kenny       STRING
release-version          8.1.0.Final STRING
running-mode             NORMAL      STRING
schema-locations         []          OBJECT
server-state             running     STRING

CHILD                MIN-OCCURS MAX-OCCURS
core-service         n/a        n/a       
deployment           n/a        n/a       
deployment-overlay   n/a        n/a       
extension            n/a        n/a       
interface            n/a        n/a       
path                 n/a        n/a       
socket-binding-group n/a        n/a       
subsystem            n/a        n/a       
system-property      n/a        n/a

In EAP 6.*
[standalone@127.0.0.1:9999 /] ls -l
ATTRIBUTE                VALUE                 TYPE  
launch-type              STANDALONE            STRING
management-major-version 1                     INT   
management-micro-version 0                     INT   
management-minor-version 5                     INT   
name                     lubuntu1              STRING
namespaces               []                    OBJECT
process-type             Server                STRING
product-name             EAP                   STRING
product-version          6.2.0.GA              STRING
profile-name             undefined             STRING
release-codename         Janus                 STRING
release-version          7.3.0.Final-redhat-14 STRING
running-mode             NORMAL                STRING
schema-locations         []                    OBJECT
server-state             running               STRING 
     b.) Using read-attribute :

[standalone@127.0.0.1:9999 /] read-attribute --name=product-version
6.2.0.GA
[standalone@127.0.0.1:9999 /] read-attribute --name=product-name
EAP
[standalone@127.0.0.1:9999 /] read-attribute --name=launch-type
STANDALONE
[standalone@127.0.0.1:9999 /] read-attribute --name=release-codename
Janus
[standalone@127.0.0.1:9999 /] read-attribute --name=release-version
7.3.0.Final-redhat-14
[standalone@127.0.0.1:9999 /] read-attribute --name=running-mode
NORMAL
[standalone@127.0.0.1:9999 /] read-attribute --name=name
lubuntu1

[standalone@127.0.0.1:9999 /] :read-attribute(name=product-version)
{
    "outcome" => "success",
    "result" => "6.2.0.GA"
}
[standalone@127.0.0.1:9999 /] :read-attribute(name=product-name)
{
    "outcome" => "success",
    "result" => "EAP"
}
[standalone@127.0.0.1:9999 /] :read-attribute(name=release-codename)
{
    "outcome" => "success",
    "result" => "Janus"
}
[standalone@127.0.0.1:9999 /] :read-attribute(name=release-version)
{
    "outcome" => "success",
    "result" => "7.3.0.Final-redhat-14"
}
[standalone@127.0.0.1:9999 /] 

Happy Learning :) !!

No comments:

Post a Comment

Integrate Jenkins with Azure Key Vault

Jenkins has been one of the most used CI/CD tools. For every tool which we are using in our daily life, it becomes really challenges when ...