Real Performance Testing with VirtualBox, Jmeter, Wildfly and Oracle RAC 12.1

Configuration and Test details

Host System 
 - Windows 8.1 
 - CPU i7-4710-HQ 2,5 GHz - 1 socket, 4 Physical CPus, 8 Logical CPUs - 16 Gbyte RAM 

Testcase 
  - VirtualBox System I   running : OEL 6.6, Wildfly 8.2 , 50 Threads ( using Jmeter )
  - VirtualBox System II  running : OEL 6.6, Oracle RAC 12.1.0.2.0 , running Instance bankA1 
  - VirtualBox System III running : OEL 6.6, Oracle RAC 12.1.0.2.0 , running Instance bankA2 


What we exe expecting 
- As the testcase is CPU bound (  very little DB actions) we expect a Host CPU utilization of 100 % .

Single  Core Testing – Using only a single physical CPUs

Guest System  VirtualBox System I [ OEL 6.6 ] CPU details :
[oracle@wls1 Desktop]$ nproc
1
  
[oracle@wls1 Desktop]$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 60
Stepping:              3
CPU MHz:               2496.669
BogoMIPS:              4993.33
L1d cache:             32K
L1d cache:             32K
L2d cache:             6144K
NUMA node0 CPU(s):     0

-> Only a Single CPU is active for our OEL 6.6 guest system!

TaskManager Output :
TaskManagerS
-> Complete CPU utiliztion is only 40 %

Resource Manager Output: 
ResourceManagerS
-> VirtualBox processes are multi-threaded [ this should be helpful for mulitple Testing ]

JMeter Output :
Jmeter_perfS
-> The Single CPU test is able to run at a rate of 20 TPS

 Single CPU Test Summary:

  • Single CPU test utilizes  only 40 % of our Host CPU
  • VirtualBox processes are using up to 50 threads
  • The current test system runs a rate of 20 TPS
  • If we can make happen a CPU utilization of 100 % we should see a rate of 50 TPS

Multiple Cores Testing – Using all 4 physical CPUs

Guest VirtualBox SystemI  [ OEL 6.6 ] details :
[oracle@wls1 Desktop]$ nproc
4
[oracle@wls1 Desktop]$  lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 60
Stepping:              3
CPU MHz:               2494.114
BogoMIPS:              4988.22
L1d cache:             32K
L1d cache:             32K
L2d cache:             6144K
NUMA node0 CPU(s):     0-3
 
--> All 4 physical processors are available at our Guest OS 

Test results :

Task Manager Output :

TaskManagerM
-> All 8 virtual CPUs are running at 100 % utilization 

JMeter Output: 

Jmeter_perfM
-> The whole System runs now at 50 TPS 

4-CPU Test Summary 

  • Using all CPUs increase the the TPS rate to over 51 TPS
  • For Performance Testing using configuring  Virtualbox to use  all  physical CPUs may be a good advice.
  • In the above test the VirtualBox systems running  the RAC instances only uses a single phy. CPU.
  • Our Virtualbox RAC system are not yet CPU bound and a single phy. CPU is sufficient
  • As we expected we can increase the TPS rate by factor 2.5 when we increase the initial HOST CPU utilization from 40 % to 100 %

Reference

Connection timeout message when running nslookup against GNS SCAN Address

Nslookup Error
[root@ns1 named]#  nslookup grac4-scan.grid4.example.com
;; connection timed out; trying next origin
Server:        192.168.5.50
Address:    192.168.5.50#53
** server can't find grac4-scan.grid4.example.com: NXDOMAIN

/var/log/messages of the BIND Nameserver  contains  a lot of IPV6 related errors 
  using GNS host : GNSTESTHOST 
..
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/AAAA/IN': 202.12.27.33#53
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/A/IN': 2001:503:ba3e::2:30#53
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/AAAA/IN': 2001:503:ba3e::2:30#53
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/A/IN': 2001:500:2::c#53
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/AAAA/IN': 2001:500:2::c#53
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/A/IN': 2001:500:2d::d#53
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/AAAA/IN': 2001:500:2d::d#53
....
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/A/IN': 2001:dc3::35#53
Jun 24 15:19:08 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/AAAA/IN': 2001:dc3::35#53
Jun 24 15:19:18 ns1 named[7529]: error (network unreachable) resolving 'GNSTESTHOST.grid4.example.com.de.oracle.com/A/IN': 2001:502:f3ff::64#53

-> All the failed IVPV6 requests add a delay for the request and leads to the nslookup Timeout
-> As our network can't handle IPV6 we need to disable IVP6. 

FIX : Disable ipv6 on CentOS 6/7 / RHEL 6/7 

Edit the /etc/sysctl.conf.
# vi /etc/sysctl.conf
Put the following entry to disable IPv6 for all adapter.
net.ipv6.conf.all.disable_ipv6 = 1

[root@ns1 named]#  ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 08:00:27:2B:5E:DD
          inet addr:192.168.5.50  Bcast:192.168.5.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2171 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1461 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:159819 (156.0 KiB)  TX bytes:185391 (181.0 KiB)
-> No IPV6 reference anymore 

After disabling IPV6 only very less named records should be logged in /var/log/messages : 
Jun 24 15:49:07 ns1 named[3152]: zone 2.168.192.in-addr.arpa/IN: sending notifies (serial 2009011201)
Jun 24 15:49:07 ns1 named[3152]: zone 5.168.192.in-addr.arpa/IN: sending notifies (serial 2009011201)
Jun 24 15:50:45 ns1 named[3152]: error (FORMERR) resolving 'GNSTESTHOST.grid4.example.com/AAAA/IN': 192.168.5.54#53
Jun 24 16:00:48 ns1 named[3152]: error (FORMERR) resolving 'GNSTESTHOST.grid4.example.com/AAAA/IN': 192.168.5.54#53
Jun 24 16:10:50 ns1 named[3152]: error (FORMERR) resolving 'GNSTESTHOST.grid4.example.com/AAAA/IN': 192.168.5.54#53
Jun 24 16:16:52 ns1 named[3152]: client 192.168.5.101#29873: RFC 1918 response from Internet for 5.1.168.192.in-addr.arpa
...

Nslookup should now  work fine 
[root@ns1 log]#  nslookup grac4-scan.grid4.example.com
Server:        192.168.5.50
Address:    192.168.5.50#53

Non-authoritative answer:
Name:    grac4-scan.grid4.example.com
Address: 192.168.5.200
Name:    grac4-scan.grid4.example.com
Address: 192.168.5.165
Name:    grac4-scan.grid4.example.com
Address: 192.168.5.166

How to fix a RAC database startup problem with orachk in 5 minutes ?

New TFA Collector bundles ORAchk and other RAC tools

TFA Collector Features

Installation of TFA Lite /  ORACHK

Note orachk is now bundled with TFA collector  
Use the MOS article below to download TFA collector 
    TFA Collector - Tool for Enhanced Diagnostic Gathering (Doc ID 1513912.2)

Extract and install orachk as root user 
root@grac41 t]# ls
installTFALite  TFACollectorDocV121250.pdf  TFALite_121250.zip
[root@grac41 t]# ./installTFALite
Starting TFA installation
Enter a location for installing TFA (/tfa will be appended if not supplied) [/home/oracle/t/tfa]: 
/home/oracle/TFA
...
---------------------------------.
|            TFA Users            |
+-----------+-----------+---------+
| User Name | User Type | Status  |
+-----------+-----------+---------+
| asmadmin  | GROUP     | Allowed |
| grid      | USER      | Allowed |
| oinstall  | GROUP     | Allowed |
| oracle    | USER      | Allowed |
'-----------+-----------+---------'
Summary of TFA Installation:
.------------------------------------------------------------.
|                           grac41                           |
+---------------------+--------------------------------------+
| Parameter           | Value                                |
+---------------------+--------------------------------------+
| Install location    | /home/oracle/TFA/tfa/grac41/tfa_home |
| Repository location | /home/oracle/TFA/tfa/repository      |
| Repository usage    | 0 MB out of 2982 MB                  |
'---------------------+--------------------------------------'
.------------------------------------------------------------.
|                           grac42                           |
+---------------------+--------------------------------------+
| Parameter           | Value                                |
+---------------------+--------------------------------------+
| Install location    | /home/oracle/TFA/tfa/grac42/tfa_home |
| Repository location | /home/oracle/TFA/tfa/repository      |
| Repository usage    | 0 MB out of 2982 MB                  |
'---------------------+--------------------------------------'
.------------------------------------------------------------.
|                           grac43                           |
+---------------------+--------------------------------------+
| Parameter           | Value                                |
+---------------------+--------------------------------------+
| Install location    | /home/oracle/TFA/tfa/grac43/tfa_home |
| Repository location | /home/oracle/TFA/tfa/repository      |
| Repository usage    | 0 MB out of 2982 MB                  |
'---------------------+--------------------------------------'
TFA is successfully installed...

 

Problem description

 
Either starting RAC instance with sqlplus or srvctl fails with errors :  

[oracle@grac43 dbs]$  sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 23 13:01:15 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.
SQL>  startup nomount
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATA/grac4/spfilegrac4.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATA/grac4/spfilegrac4.ora
ORA-01034: ORACLE not available
ORA-27123: unable to attach to shared memory segment
Linux-x86_64 Error: 13: Permission denied
Additional information: 26
Additional information: 229382

Run Orack and review the HTML file for Errors and Warnings


[root@grac41 orachk]# ./orachk -v
ORACHK  VERSION: 12.1.0.2.3_20150305

[root@grac41 orachk]# ./orachk
CRS stack is running and CRS_HOME is not set. Do you want to set CRS_HOME to /u01/app/11204/grid?[y/n][y]


Check generated HTML file for WARNINGS and ERRORS 
..
Cluster Wide Status 
WARNING => RDBMS software owner UID does not match across cluster

DATA FROM GRAC41 - RDBMS SOFTWARE OWNER UID ACROSS CLUSTER 
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),500(vboxsf),54322(dba),506(asmdba)

DATA FROM GRAC42 - RDBMS SOFTWARE OWNER UID ACROSS CLUSTER 
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),500(vboxsf),54322(dba),506(asmdba)

DATA FROM GRAC43 - RDBMS SOFTWARE OWNER UID ACROSS CLUSTER 
uid=501(grid) gid=54321(oinstall) groups=54321(oinstall),500(vboxsf),54322(dba),504(asmadmin),506(asmdba),507(asmoper) 

-> Here we see easily can see  that uid on GRAC43 is wrong  

Fix the error and verify database status  
[root@grac43 bin]# chown oracle oracle
[root@grac43 bin]# chmod 6751 oracle
[root@grac43 bin]# ls -l oracle
-rwsr-s--x. 1 oracle asmadmin 239732402 Jul 21  2014 oracle
[grid@grac43 ~]$ srvctl start instance -d grac4 -i grac43
[oracle@grac43 dbs]$ srvctl status database -d grac4
Instance grac41 is running on node grac41
Instance grac42 is running on node grac42
Instance grac43 is running on node grac43



WebDriver a perfect API testing your JEE application

Overview

  • Selenium WebDriver marks a leap forward in terms of browser automation
  • WebDriver can be used by multiple Languages : Java, C#, PHP, Phyton, Perl, JS, …
  • Selenium-WebDriver makes direct calls to the browser and can issue Buttons clicks , ..
  • Selenium-WebDriver supports multiple Browers like Firefox , Chrome, HtmlUnitDriver,  …
  • HtmlUnitDriver is a  headless (GUI-less) browser simulator ( good for Load Testing )
  • Before switching to HtmlUnitDriver you may first use  a GUI based Driver like FirefoxDriver

Preparing Test Environment

For testing WebDriver we use 2 Wildfly instances :
Instance 1 (Port 8081 ) : Production  Server  
   publishes our Website to be tested - Session Scoped Bean using following annotations
      @Named("jPATestBean")
      @SessionScoped 
Instance 2 ( Port 8180) : Test Server 
   Simulates a Webbrowser - using following annotations   
      @RunAsClient annotation 
   This project only has a single Java test Class 


Note: The WFJPA2EL-1.0 Web application is deployed to both Server 

 

Testing the same Webapplication running on  different Application Servers

The main purpose of these tests [ test1() and test2() ] are:

  • Review the Page and verify the Page title
  • Dynamically click  the JSF button j_idt8:cBtn32
  • Use View Page Source from your firefox Browser  to find out your IDs for your Button.  Sample:
    <td><input id=“j_idt8:cBtn32” type=”submit” name=”j_idt8:cBtn32″ value=”Check running RAC Instances and JPA Version ” /></td>
  • Verify that we are connecting to the correct  RAC database named:  BANKA
  • Test  using different URLs
    http://localhost:8081/WFJPA2EL-1.0/     http://localhost:8180/WFJPA2EL-1.0/
  • Sleep between HTTP request to allow users to read the HTML page
Java Code
@Test
@RunAsClient
public void test1() throws InterruptedException
{
testJPARunAsClient("http://localhost:8081/WFJPA2EL-1.0/");
}

@Test
@RunAsClient
public void test2() throws InterruptedException
{
testJPARunAsClient("http://localhost:8180/WFJPA2EL-1.0/");
}

public void testJPARunAsClient(String URL) throws InterruptedException
{
String methodName = "testJPARunAsClient()";
System.out.println("Inside: " + methodName + "- URL: " + URL );
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(URL);
String pageTitle = driver.getTitle();
System.out.println(" URL " + contextPath +  " - " +methodName + " - Found Page Title:  " + pageTitle);
Assert.assertEquals( "Testing RAC - J2EE JPA2 API!", pageTitle);
// Press the Check RAC instance Button
driver.findElement(By.id("j_idt8:cBtn32")).click();
String rtInfo = driver.findElement(By.id("j_idt8:optxt1")).getText();
if ( rtInfo != null )
{
System.out.println(rtInfo);
Assert.assertTrue(rtInfo.contains("DB Name:  BANKA"));
}
// Close brower window after 5 seconds
Thread.sleep(5000);
driver.quit();
System.out.println("Leaving: " + methodName);
}
}

Note our tested URL should return
Inside: testJPARunAsClient()- URL: http://localhost:8081/WFJPA2EL-1.0/
URL http://127.0.0.1:8180/testJPABeanUsingWebdriver/ - testJPARunAsClient() - Found Page Title:  Testing RAC - J2EE JPA2 API!
10:34:11.045 Calling  getRacInfo() in progress ...
10:34:11.046 EclipseLink Version: 2.5.2 - [ EclipseLink 2.5.2 == JPA 2.1]
10:34:11.047 Driver Name             : Oracle JDBC driver
10:34:11.047 Driver Version          : 12.1.0.2.0
10:34:11.048 Database Product Version: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
10:34:11.056 DB Name:  BANKA
10:34:11.057 1. Instance Name: bankA_3 - Host: hract21.example.com
10:34:11.057 Leaving getRacInfo() without Exceptions !
Leaving: testJPARunAsClient()

Use View Page Source from firefox to find out our GUI IDs
<td><input id="j_idt8:cBtn32" type="submit" name="j_idt8:cBtn32" value="Check running RAC Instances and JPA Version " /></td>

Starting the test using Maven
$ mvn test

This tests should do the following
- Start 2 firfox browser session and execute the JSF function invoked by j_idt8:cBtn32 button
- After each test the browser should be  closed automatically

The above maven command should return
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.583 sec
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:06.197s
[INFO] Finished at: Thu Jun 18 15:23:00 CEST 2015
[INFO] Final Memory: 19M/55M
[INFO] ------------------------------------------------------------------------

 

Testing a quite complex JTA transaction application by using multiple Browsers


For running test3() and test4() we use a SessionScoped Web application.
This application runs  the following 5 HTTP request :
 - HTTP Request1: Request the initial page via HTTP GET request
 - HTTP Request2: Cleanup table records
 - HTTP Request3: Uses  a HTTP post request to START and SUSPEND a Transaction 
     - Start a JTA transaction
     - Run JPA flush [ == Insert a new db record )
     - Suspend the JTA transaction using the JEE TransactionManager API
     - Add JTA transaction object, Entity Manager object to our HTTPSession Object 
  - HTTP Request4: Uses  a HTTP post request to RESUME and COMMIT the Transaction      
     - retrieve JTA transaction object and Entity Manager object from our HTTPSession Object
     - Resume the Transaction and update the record
     - Commit the record -  in case of any errors rollback the transaction
     - Cleanup HTTP session object , clear the Entity Manager 
  - HTTP Request5: Uses  a HTTP post request to invalidate the HTTP session          
     - Invalidate the HTTP session 

-> This is a quite complex Transaction sample and we will see whether WebDriver 
   can handle this ! 

The main purpose of these tests [ test3() and test4() ]  are 
- Test a SessionScoped JEE application with different Browser [ Firefox and GUIless HtmlUnitDriver ]
- Track the JSESSIONID cookie 
- test3() uses Firefox Driver  
   - start a Firfox session
   - Display the HTML page 
   - Use wait times to display the HTTP pages 
 
- test4()  uses the GUIless HtmlUnitDriver 
   - don't start any browser and display any HTLM page  ( useful for GUI test )
   - Don't use any wait times between the HTTP requests ( useful for performance test ) 

JAVA Code 
  @Test 
     public void test3() throws InterruptedException
      {
         testJPARunAsClientTestSession("http://localhost:8180/WFJPA2EL-1.0/", true);
      }  
    
     @Test 
     public void test4() throws InterruptedException
      {
         testJPARunAsClientTestSession("http://localhost:8180/WFJPA2EL-1.0/", false);
      }  
      public void testJPARunAsClientTestSession(String URL , boolean useGUI) throws InterruptedException
      {
        WebDriver driver = null; 
        String methodName = "testJPARunAsClient()";
        System.out.println("Inside: " + methodName + "- URL: " + URL );
        if (useGUI)
            driver = new FirefoxDriver();
        else 
            driver = new HtmlUnitDriver();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 
        driver.get(URL);  
            //driver.get("http://localhost:8081/WFJPA2EL-1.0/");
            // browser.get("http://localhost:8180/WFJPA2EL-1.0/");
        String pageTitle = driver.getTitle();        
        System.out.println(" URL " + contextPath +  " - " +methodName + " - Found Page Title:  " + pageTitle);
        Assert.assertEquals( "Testing RAC - J2EE JPA2 API!", pageTitle);  
       
            // Press Clean Table Button
        driver.findElement(By.id("j_idt8:cBtn15")).click();       
        String rtInfo = driver.findElement(By.id("j_idt8:optxt1")).getText();
        if ( rtInfo != null )
         {
            if (useGUI)
                System.out.println(rtInfo);
            Assert.assertTrue(rtInfo.contains("Leaving cleanTable() without Exceptions - Data commited"));
         }
        checkCookie(driver, "Action: Clean Table");
        if (useGUI)
            Thread.sleep(2000);
        
            // click Start and Resume Button
        driver.findElement(By.id("j_idt8:cBtn13")).click();       
        rtInfo = driver.findElement(By.id("j_idt8:optxt1")).getText();
        if ( rtInfo != null )
         {
            if (useGUI)
                System.out.println(rtInfo);
            Assert.assertTrue(rtInfo.contains("-> Suspend Transaction - Status: SUSPEND - Salary:1500"));
         }
        checkCookie(driver, "Action: Start and Suspend Transaction");
        if (useGUI)
            Thread.sleep(5000);
        
            // Click Resumee and Commit button
        driver.findElement(By.id("j_idt8:cBtn14")).click();       
        rtInfo = driver.findElement(By.id("j_idt8:optxt1")).getText();
        if ( rtInfo != null )
         {
            if (useGUI)
                    System.out.println(rtInfo);
            Assert.assertTrue(rtInfo.contains("-> Transaction Commited  -  Salary after update:1599"));
         }
        checkCookie(driver, "Action: Resume and Commit Transaction");
        if (useGUI)
            Thread.sleep(10000);
        
               // Click Session Invalidation button
        driver.findElement(By.id("j_idt8:cBtn31")).click();       
        rtInfo = driver.findElement(By.id("j_idt8:optxt1")).getText();
        if ( rtInfo != null )
         {
            System.out.println(rtInfo);          
         }
        checkCookie(driver, "Action: Invalidate JSF session");
        if (useGUI)
            Thread.sleep(1000);
        driver.quit();
      }
     
    private void checkCookie(WebDriver driver, String info)
      {
        Cookie cookie= driver.manage().getCookieNamed("JSESSIONID");
        System.out.println(info + " - JSESSIONID cookie: " + cookie.getValue());
      }
    

Let's verify the Output :  
Action: Clean Table - JSESSIONID cookie: 1ThmlTaJ_TQAqIeltEuixN23.wls1
Action: Start and Suspend Transaction - JSESSIONID cookie: 1ThmlTaJ_TQAqIeltEuixN23.wls1
Action: Resume and Commit Transaction - JSESSIONID cookie: 1ThmlTaJ_TQAqIeltEuixN23.wls1
Action: Invalidate JSF session - JSESSIONID cookie: E9uqbcDsgyCr5aTxu6bQxX26.wls1
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 42.93 sec

-> After invalidation of our JSF session we get a new JSESSIONID cookie - Perfect !

Summary:

  • WebDriver is an easy API for GUI testing and functional testing
  • WebDriver can be used with JMETER ( used for Multithreading testing )
  • WebDriver is able the run even complex JEE application
  • WebDriver perfect deals with the  JSESSIONID cookie

Reference

WildFly 8.2 Installation and First Steps

Installation of Wildfly 8.2

Download Wildfly 8.2 from http://wildfly.org/downloads/

$ cd /home/oracle/WILDFLY
$ unzip  /media/sf_kits/JEE/wildfly-8.2.0.Final.zip

In case you have multiple Wildfly instances runing  you can easily rename top level directory 
$ mv wildfly-8.2.0.Final wildfly-8.2.0.Final_PRODUCITON

Some useful SHELL variables 
export WILDFLY_HOME=/home/oracle/WILDFLY/wildfly-8.2.0.Final_PRODUCITON
alias wf=$WILDFLY_HOME/bin/standalone.sh
alias wfd='cd $WILDFLY_HOME'

Start and stop  Wildfly 
Start WildFly in standalone mode;
[oracle@wls1 local]$ $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
...

Now test that we can display the first WEB Page using the default WILDFLY HTTP PORT number:
$ firefox localhost:8080

Stop the Server 
[oracle@wls1 ~]$ $WILDFLY_HOME/bin/jboss-cli.sh --connect command=:shutdown
{"outcome" => "success"} 

Add an Admin User

$ 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 : oracle
....

Changing Ports [in case you need to run as 2.nd WILDFLY instance on your System ]

Edit  $WILDFLY_HOME/standalone/configuration/standalone.xml
Change
   <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
        <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
        <socket-binding name="http" port="${jboss.http.port:8080}"/>
        <socket-binding name="https" port="${jboss.https.port:8443}"/>
        <socket-binding name="txn-recovery-environment" port="4712"/>
        <socket-binding name="txn-status-manager" port="4713"/>
        <outbound-socket-binding name="mail-smtp">
            <remote-destination host="localhost" port="25"/>
        </outbound-socket-binding>
</socket-binding-group>
to 
    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9980}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9983}"/>
        <socket-binding name="ajp" port="${jboss.ajp.port:8010}"/>
        <socket-binding name="http" port="${jboss.http.port:8081}"/>
        <socket-binding name="https" port="${jboss.https.port:8444}"/>
        <socket-binding name="txn-recovery-environment" port="4702"/>
        <socket-binding name="txn-status-manager" port="4703"/>
        <outbound-socket-binding name="mail-smtp">
            <remote-destination host="localhost" port="26"/>
        </outbound-socket-binding>
    </socket-binding-group>

Restart your server and verify the new Ports:  
$ $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9980 command=:shutdown
{"outcome" => "success"}
$ $WILDFLY_HOME/bin/standalone.sh 

$ firefox localhost:8081  --> Should display the Wildfly default page
$ firefox localhost:9980  --> You should be able to successfully login to the Management Console 

Use jboss.cli to connect to new Management Controller 
$ $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9980 

Server.log should report the changed PORT numbers:
10:58:40,755 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8081
..
10:58:41,737 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9980/management
10:58:41,738 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9980

 

Setup Oracle JDBC driver and a RAC datasource

Step 1: Add Oracle JDBC driver as a module 
[oracle@wls1 WILDFLY]$ cat add_module.cli 
module add --name=com.oracle.ojdbc --resources=/home/oracle/JDBC/Driver/ojdbc7.jar --dependencies=javax.api,javax.transaction.api

$ $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9980  --file=add_module.cli 

Verify that the proper module.xml was created 
$ ls modules/com/oracle/ojdbc/main/
module.xml  ojdbc7.jar
$ cat  modules/com/oracle/ojdbc/main/module.xml 
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc">
    <resources>
        <resource-root path="ojdbc7.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
<module>

Step 2: Deploy the JDBC driver
$ cat add_jdbc_driver.cli
/subsystem=datasources/jdbc-driver=oracle/:add(driver-name=oracle, driver-module-name=com.oracle.ojdbc, driver-xa-datasource-class-name=oracle.jdbc.xa.client.OracleXADataSource) 
$  $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9980  --file=add_jdbc_driver.cli
{"outcome" => "success"} 

Verify Driver 
[oracle@wls1 WILDFLY]$   $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9980   /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
        },
..
Verify Server.log :
11:29:33,533 INFO  [org.jboss.as.connector.subsystems.datasources] (management-handler-thread - 4) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 12.1)
11:29:33,534 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = oracle

Step 3 : Add and verify a DataSource 
$ cat add_ds.cli
if (outcome != success) of /subsystem=datasources/data-source=myRacDS:read-resource
    data-source add \
        --name=myRacDS \
        --driver-name=oracle \
        --jndi-name=java:jboss/datasources/myRacDS \
        --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 --controller=localhost:9980  --file=add_ds.cli
$ $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9980 /subsystem=datasources/data-source=myRacDS:read-resource
{
    "outcome" => "success",
    "result" => {
        "allocation-retry" => 1,
        ...
        "connection-url" => "jdbc:oracle:thin:@ract2-scan.grid12c.example.com:1521/banka",
        "datasource-class" => undefined,
        "driver-class" => undefined,
        "driver-name" => "oracle",
        "enabled" => true,
        ..
        "jndi-name" => "java:jboss/datasources/myRacDS",
        "jta" => true,
        "max-pool-size" => 10,
        "min-pool-size" => 5,
        ...
        }
    }
}

Test the Connection 
-> Ping the SCAN address
[oracle@wls1 WILDFLY]$  ping ract2-scan.grid12c.example.com
PING ract2-scan.grid12c.example.com (192.168.5.221) 56(84) bytes of data.
64 bytes from 192.168.5.221: icmp_seq=1 ttl=64 time=0.534 ms
64 bytes from 192.168.5.221: icmp_seq=2 ttl=64 time=0.298 ms

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

Display and change JTA Transaction Timeout

Display JTA Transaction Timeout 
$  $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9990
      '/subsystem=transactions/:read-attribute(name=default-timeout)'
{
    "outcome" => "success",
    "result" => 30
}
--> JTA Transaction Timeout : 30 seconds

Change JTA Transaction Timeout 
$ $WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9990 
    '/subsystem=transactions/:write-attribute(name=default-timeout,value=60)'
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

Deploy a compiled Web application project

Assume we have already created and tested WFJPA2EL-1.0.war and want to deploy this to our new Wildfly server :
$ cp WFJPA2EL-1.0.war /home/oracle/WILDFLY/wildfly-8.2.0.Final_PRODUCITON/standalone/deployments 
$ touch /home/oracle/WILDFLY/wildfly-8.2.0.Final_PRODUCITON/standalone/deployments/WFJPA2EL-1.0.war.dodeploy

For Redeployment run: touch /home/oracle/WILDFLY/wildfly-8.2.0.Final_PRODUCITON/standalone/deployments/WFJPA2EL-1.0.war.dodeploy
Server.log should report: 
15:32:08,432 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017534: Registered web context: /WFJPA2EL-1.0
15:32:08,465 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565: Replaced deployment "WFJPA2EL-1.0.war" with deployment "WFJPA2EL-1.0.war"

Now test the project 
$ firefox http://localhost:8081/WFJPA2EL-1.0

15:30:46.253 Calling  getRacInfo() in progress ... 
15:30:46.254 EclipseLink Version: 2.5.2 - [ EclipseLink 2.5.2 == JPA 2.1] 
15:30:46.255 Driver Name             : Oracle JDBC driver
15:30:46.256 Driver Version          : 12.1.0.2.0
15:30:46.257 Database Product Version: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
15:30:46.439 DB Name:  BANKA
15:30:46.440 1. Instance Name: bankA_3 - Host: hract21.example.com
15:30:46.440 Leaving getRacInfo() without Exceptions !

Remove a single prepared transaction from WildFly LOG Store

Cleanup Wildfly LOG STORE

  • Be careful don’t run thes commands on a production system as you can easily corrupt your system
  • These commands should only used on your test system

Check for prepared transactions 

$ cat prepared_xa.cli
/subsystem=transactions/log-store=log-store/:probe()
ls /subsystem=transactions/log-store=log-store/transactions $WILDFLY_HOME/bin/jboss-cli.sh --connect --file=prepared_xa.cli
{"outcome" => "success"}
0:ffffc0a805c9:-18c2b06f:55fac789:137
0:ffffc0a805c9:-18c2b06f:55fac789:145
0:ffffc0a805c9:-18c2b06f:55fac789:153
0:ffffc0a805c9:-18c2b06f:55fac789:fa
0:ffffc0a805c9:35abdaa8:55fbbb60:11b
0:ffffc0a805c9:35abdaa8:55fbbb60:355
0:ffffc0a805c9:35abdaa8:55fbbb60:49
0:ffffc0a805c9:35abdaa8:55fbbb60:5b
0:ffffc0a805c9:35abdaa8:55fbbb60:f1

Verify TX Object Store at File System Level
$ ls -1 ./standalone/data/tx-object-store/ShadowNoFileLockStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/
0_ffffc0a805c9_-18c2b06f_55fac789_137
0_ffffc0a805c9_-18c2b06f_55fac789_145
0_ffffc0a805c9_-18c2b06f_55fac789_153
0_ffffc0a805c9_-18c2b06f_55fac789_fa
0_ffffc0a805c9_35abdaa8_55fbbb60_11b
0_ffffc0a805c9_35abdaa8_55fbbb60_355
0_ffffc0a805c9_35abdaa8_55fbbb60_49
0_ffffc0a805c9_35abdaa8_55fbbb60_5b
0_ffffc0a805c9_35abdaa8_55fbbb60_f1

Shutdown Wildfly and delete all prepared Transactions 
$WILDFLY_HOME/bin/jboss-cli.sh  --connect --controller=localhost:9990 command=:shutdown
$ rm ./standalone/data/tx-object-store/ShadowNoFileLockStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/*

Restart Wildfly and verify LOG STORE  $WILDFLY_HOME/bin/jboss-cli.sh --connect --file=prepared_xa.cli
{"outcome" => "success"}

Reference