WildFLY Commands and Configuration Tasks

Start and stop  Wildfly

Start Wildfly 
$ $WILDFLY_HOME/bin/standalone.sh
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /usr/local/wildfly-8.2.0.Final
  JAVA: /usr/java/jdk1.7.0_71/bin/java
  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

Stop WildFly 
$ $WILDFLY_HOME/bin/jboss-cli.sh --connect command=:shutdown
{"outcome" => "success"}

Access Wildfly using localhost and HOSTNAME

If you want to bind to all available IP addresses, then start WILDFLY by : 

% ./bin/standalone.sh -b 0.0.0.0

This should allow to the connect via http://localhost and http://wls1 [ where wls1 is our HOSTNAME ]
$ firefox http://localhost:8180/WFJPA2EL-1.0/
$ firefox http://wls1:8180/WFJPA2EL-1.0/


For permanent solution you can change the bind address in your standalone.xml file:  
    <interfaces>
..       
        <interface name="public">
            <inet-address value="${jboss.bind.address:0.0.0.0}"/>            
        </interface>
  ..      
    </interfaces>

 

Working with simple Objects


Remove a JNDI String object 
[oracle@wls1 JNDI]$  $WILDFLY_HOME/bin/jboss-cli.sh --connect   "/subsystem=naming/binding=java\:global\/mystring/:remove"
[oracle@wls1 JNDI]$  $WILDFLY_HOME/bin/jboss-cli.sh --connect  reload

Create a JNDI String object
[oracle@wls1 JNDI]$ cat  new_jndi.cli
/subsystem=naming/binding=java\:global\/mystring/:add(binding-type=simple,value="My JNDI strored String",type=java.lang.String)
[oracle@wls1 JNDI]$  $WILDFLY_HOME/bin/jboss-cli.sh --connect --file=new_jndi.cli
{"outcome" => "success"}

Verify JNDI view:

[oracle@wls1 JNDI]$  $WILDFLY_HOME/bin/jboss-cli.sh  --connect  "/subsystem=naming:jndi-view"
...
      "java:global" => {
                "mystring" => {
                    "class-name" => "java.lang.String",
                    "value" => "My JNDI strored String"
                },

Setup and verify a RAC datasource by using the RAC SCAN address

Setup RAC datasource by using the RAC SCAN address
[oracle@wls1 WILDFLY]$ cat add_ds.cli
if (outcome != success) of /subsystem=datasources/data-source=myDS:read-resource
    data-source add \
        --name=myDS \
        --driver-name=oracle \
        --jndi-name=java:jboss/datasources/myDS \
        --user-name="scott"\
        --password="tiger"\
        --use-java-context=true \
        --use-ccm=true \
        --min-pool-size=5 \
        --max-pool-size=10 \
        --pool-prefill=true \
        --allocation-retry=1 \
        --prepared-statements-cache-size=32 \
        --share-prepared-statements=true \
        --connection-url="jdbc:oracle:thin:@ract2-scan.grid12c.example.com:1521/banka"
end-if

$ $WILDFLY_HOME/bin/jboss-cli.sh --connect --file=add_ds.cli

Test the connection  $WILDFLY_HOME/bin/jboss-cli.sh --connect   /subsystem=datasources/data-source=myRacDS:test-connection-in-pool
{
    "outcome" => "success",
    "result" => [true]
}

Check newly create datasource properties: 
$ $WILDFLY_HOME/bin/jboss-cli.sh --connect   /subsystem=datasources/data-source=myRacDS:read-resource
{
    "outcome" => "success",
    "result" => {
        "allocation-retry" => 1,
        "allocation-retry-wait-millis" => undefined,
        "allow-multiple-users" => false,
        "background-validation" => undefined,
        "background-validation-millis" => undefined,
        "blocking-timeout-wait-millis" => undefined,
        "capacity-decrementer-class" => undefined,
        "capacity-decrementer-properties" => undefined,
        "capacity-incrementer-class" => undefined,
        "capacity-incrementer-properties" => undefined,
        "check-valid-connection-sql" => undefined,
        "connection-listener-class" => undefined,
        "connection-listener-property" => undefined,
        "connection-properties" => undefined,
        "connection-url" => "jdbc:oracle:thin:@ract2-scan.grid12c.example.com:1521/banka",
        "datasource-class" => undefined,
        "driver-class" => undefined,
        "driver-name" => "oracle",
        "enabled" => true,
        "exception-sorter-class-name" => undefined,
        "exception-sorter-properties" => undefined,
        "flush-strategy" => undefined,
        "idle-timeout-minutes" => undefined,
        "initial-pool-size" => undefined,
        "jndi-name" => "java:jboss/datasources/myRacDS",
        "jta" => true,
        "max-pool-size" => 10,
        "min-pool-size" => 5,
        "new-connection-sql" => undefined,
        "password" => "tiger",
        "pool-prefill" => true,
        "pool-use-strict-min" => undefined,
        "prepared-statements-cache-size" => 32,
        "query-timeout" => undefined,
        "reauth-plugin-class-name" => undefined,
        "reauth-plugin-properties" => undefined,
        "security-domain" => undefined,
        "set-tx-query-timeout" => false,
        "share-prepared-statements" => true,
        "spy" => false,
        "stale-connection-checker-class-name" => undefined,
        "stale-connection-checker-properties" => undefined,
        "track-statements" => "NOWARN",
        "transaction-isolation" => undefined,
        "url-delimiter" => undefined,
        "url-selector-strategy-class-name" => undefined,
        "use-ccm" => true,
        "use-fast-fail" => false,
        "use-java-context" => true,
        "use-try-lock" => undefined,
        "user-name" => "scott",
        "valid-connection-checker-class-name" => undefined,
        "valid-connection-checker-properties" => undefined,
        "validate-on-match" => false,
        "statistics" => {
            "jdbc" => undefined,
            "pool" => undefined
        }
    }
}

Remove a Datasource

 $WILDFLY_HOME/bin/jboss-cli.sh --connect   /subsystem=datasources/data-source=myRacDS:remove

 

Display installed  JDBC Drivers

$ $WILDFLY_HOME/bin/jboss-cli.sh --connect  /subsystem=datasources:installed-drivers-list
{
    "outcome" => "success",
    "result" => [
        {
            "driver-name" => "oracle",
            "deployment-name" => undefined,
            "driver-module-name" => "com.oracle.ojdbc",
            "module-slot" => "main",
            "driver-datasource-class-name" => "",
            "driver-xa-datasource-class-name" => "oracle.jdbc.xa.client.OracleXADataSource",
            "driver-class-name" => "oracle.jdbc.OracleDriver",
            "driver-major-version" => 12,
            "driver-minor-version" => 1,
            "jdbc-compliant" => true
        }

Change Wildfly JVM parameters  [ Standalone Mode ]

Edit File:   $WILDFLY_HOME/bin/standalone.conf [ Note we add the blue line at the end ! ]
if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   JAVA_OPTS="$JAVA_OPTS -Dappdynamics.bciengine.class.lookahead=!*"
   JAVA_OPTS="$JAVA_OPTS -XX:+TraceLoaderConstraints -verbose:class"
else
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi
--> Restart Wildfly 

With Netbeans Wildfly Integration:  
Services -> Wildfly Application Server -> [RC] Properties -> Platform -> VM Options 
Add your enew parameters  : 
   -Dappdynamics.bciengine.class.lookahead=!* -XX:+TraceLoaderConstraints -verbose:class

After a Wildfly restart you should see :
  JBoss Bootstrap Environment
  JBOSS_HOME: /usr/local/wildfly-8.2.0.Final
  JAVA: /usr/java/latest/bin/java
  JAVA_OPTS:  -Xms128m -Xmx512m  -Dappdynamics.bciengine.class.lookahead=!* -XX:+TraceLoaderConstraints -verbose:class
    -XX:MaxPermSize=256m -server -Dhttp.nonProxyHosts=localhost,127.0.0.1,wls1.example.com -Djava.net.preferIPv4Stack=true 
    -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

 

Display WildFLY LogFile location

$ $WILDFLY_HOME/bin/jboss-cli.sh --connect  /subsystem=logging/:list-log-files 
{
    "outcome" => "success",
    "result" => [
        {
            "file-name" => "server.log",
            "file-size" => 458152L,
            "last-modified-date" => "2015-03-31T13:15:40.000+0200"
        },
        {
            "file-name" => "server.log.2014-12-24",
            "file-size" => 40595L,
            "last-modified-date" => "2014-12-24T17:40:22.000+0100"
        },

Sample or Standalone Mode : ./standalone/log/server.log

Setup a XA Datasource by using the RAC SCAN address

if (outcome != success) of /subsystem=datasources/xa-data-source=xa_rac12g_banka:read-resource
    xa-data-source add \
        --name=xa_rac12g_banka\
        --driver-name=oracle \
        --jndi-name=java:jboss/datasources/xa_rac12g_banka\
        --user-name="scott"\
        --password="tiger"\
        --use-java-context=true \
        --use-ccm=true \
        --min-pool-size=10 \
        --max-pool-size=100 \
        --pool-prefill=true \
        --check-valid-connection-sql="select 1 from dual" \
        --allocation-retry=1 \
        --prepared-statements-cache-size=32 \
        --share-prepared-statements=true
    /subsystem=datasources/xa-data-source=xa_rac12g_banka/xa-datasource-properties=URL:add(value="jdbc:oracle:thin:@ract2-scan.grid12c.example.com:1521/banka")
    reload
end-if

 

Enabling tracing HTTP request with Wildfly

-> jboss-cli Commands  
/subsystem=undertow/configuration=filter/custom-filter=request-dumper:add(class-name=io.undertow.server.handlers.RequestDumpingHandler, module=io.undertow.core)
/subsystem=undertow/server=default-server/host=default-host/filter-ref=request-dumper:add

For Details read:  following Article.

Script to enable HTTP logging :  enable_http_logging.cli
/subsystem=undertow/configuration=filter/custom-filter=request-dumper:add(class-name=io.undertow.server.handlers.RequestDumpingHandler, module=io.undertow.core)
/subsystem=undertow/server=default-server/host=default-host/filter-ref=request-dumper:add

Script to disable HTTP logging : disable_http_logging.cli
/subsystem=undertow/configuration=filter/custom-filter=request-dumper:remove
/subsystem=undertow/server=default-server/host=default-host/filter-ref=request-dumper:remove
:shutdown(restart=true)

One thought on “WildFLY Commands and Configuration Tasks”

  1. can you help me here please

    1. fails i have data source called “jdbc/abc/d/es/responddb”
    2. working jdbc/mytestbd when only single name path but above is not working

    when it try to get test connection its fails , i have given right pool name

    /host=my-host1/server=my-host1-inst1/subsystem=datasources/data-source=jdbc/abc/d/es/responddb:read-resource:test-connection-in-pool

    errors: Node path format is wrong around ‘crsoftwareinc’ (index=76).

Leave a Reply to rajesh Cancel reply

Your email address will not be published. Required fields are marked *