venerdì 28 ottobre 2016

Codemotion Milano 2016: Parlerò di "DevOps in Cloud, dai Container all’approccio Codeless"

Io e il mitico Gabriele Provinciali saremo presenti al Codemotion Milano 2016, il 26 Novembre alle 12.30

DevOps in Cloud, dai Container all’approccio Codeless. [12:30/13:10]
Un approccio moderno allo sviluppo software dovrebbe sfruttare linguaggi ed ambienti appartenenti a diverse tipologie di innovazione: DevOps per automatizzare continuous integration e continuous delivery, il Cloud per gestire il ciclo di vita del software in qualsiasi momento, i Software Containers per raggiungere livelli di scalabilità adeguati alle dimensioni dell’audience e un approccio Codeless per confezionare applicazioni e cruscotti ad uso dell’utenza business. Il talk sarà articolato intorno a queste quattro aree mostrando principalmente esempi pratici.

lunedì 24 ottobre 2016

WebLogic Cluster & Load Balancer: Example with WebLogic Plug-In on Apache HTTP Server

I have used on Windows 10 x64 :
I assume that you have already Installed and Configured a Cluster (Traditional or Dynamic) on WLS.

In my examples I have created a Dynamic Cluster with 2 Managed Server (Maximum of 8) and the 2 Active Managed Server are:

It is recommended to enable the WLS settings "WebLogic Plugin Enabled":

Install now Apache Http Server:
it is very simple, on windows you must only unzip the file.

Now unzip the content of the file inside a folder.

I have installed Apache in  d:\Apache24 and I have unzipped the plugin in the folder d:\Apache24\WLS-PLUGIN\

This is the content extracted from

I have created a startApache.cmd file where I have added d:\Apache24\WLS-PLUGIN\lib\ to the PATH envinroment variable:

Now we must modify the httpd.conf that is in the folder: d:\Apache24\conf:
- We must add the WebLogic plugin
- We must add the information of the WebLogic Cluster:

LoadModule weblogic_module d:\Apache24\WLS-PLUGIN\lib\  
 <IfModule weblogic_module>  
   <Location />  
    SetHandler    weblogic-handler  

Now start everything, WebLogic Admin, your Cluster and Apache, deploy something on the cluster and test it, in my example I have deployed MyApp.war on a Dynamic cluster that is composed by 2 managed server (and 8 as max), and I can test MyApp pointing directly to each one of the Managed Server:

To test if the Apache & the Weblogic PlugIn are correctly configured, you can try to call your deployed App pointing directly on Apache: (In my test I have started everything on a single machine):


You must remember that in httpd.conf file you have only defined 2 Managed Server that at he moment are part of the Dynamic Cluster.

Those 2 Managed are defined "Cluster Master" and they are responsible to create/maintain & update the Dynamic Server List that WebLogic send to the WebLogic PlugIn:

DynamicServerList (default ON)
WebLogicCluster is only a starting point for the dynamic server list that the server and plug-in maintain
This server list is dynamically updated for every request
If set to OFF:
The plug-in only uses the static list specified with the WebLogicCluster parameter
If one or more servers in the static list fails, the plug-in could waste time trying to connect to a dead server, resulting in decreased performance.
If you add a new server to the cluster, the plug-in cannot proxy requests to the new server unless you redefine this parameter. WebLogic Server automatically adds new servers to the dynamic server list when they become part of the cluster.

Important Points:
  • WLS sends the dynamic server list as a part of a response to the proxy (example Apache) NOT to the client
  • Only the cluster master would send the list after collecting the details which servers are up and read to servers client request, NOT each servers sends the list.
  • If you Shutdown or Create and Start new Managed Server (also not defined in WebLogicCluster parameter of the httpd.conf file) the oldest Active Managed Server is always the Cluster Master
Try to put DebugConfigInfo  On (Disable It on Production Environment) inside the httpd.conf file, like this:

<IfModule weblogic_module>  
   <Location />  
    SetHandler    weblogic-handler  
    DebugConfigInfo On  

Now try to call your Application adding in the URL this parameter:

In my case, if I call:

I receive this output in the Browser:

WebLogic Server Plugin version, <WLSPLUGINS_12.>
Query String: '?__WebLogicBridgeConfig'
WebLogic Cluster List:
  1. Host: '' Port: 7101 SecurePort: 0 *Primary*
WLRetryAfterDroppedConnection: 'ALL'
WLRetryOnTimeout: 'NONE'
    General Server List:
    1. Host: '' Port: 7101 SecurePort: 0 Status: OK
    2. Host: '' Port: 7102 SecurePort: 0 Status: OK
    ConnectRetrySecs: '2'
    ConnectTimeoutSecs: '10'
    WLCookieName: JSESSIONID
    DebugConfigInfo: 'ON'
    DefaultFileName: ''
    DisableCookie2Server: OFF
    DynamicServerList: 'ON'
    ErrorPage: ''
    FileCaching: ON
    Idempotent: ON
    KeepAliveEnabled: ON
    KeepAliveSecs: 20
    MaxPostSize: 0
    MaxSkipTime: '10'
    PathPrepend: ''
    PathTrim: ''
    QueryFromRequest: OFF
    WLForwardUriUnparsed: OFF
    WLAllowDoubleEscapedURI: OFF
    SecureProxy: 'OFF'
    StatPath: 'false'
    WLDNSRefreshInterval: '0'
    WLIOTimeoutSecs(old name is HungServerRecoverSecs): '300'
    WLSocketTimeoutSecs: '2'
    WLProxySSL: OFF
    WLProxyPassThrough: OFF
    WLProxySSLPassThrough: OFF
    WLServerInitiatedFailover: ON
    WLMaxWebSocketClients: 32

    Runtime statistics:

    • requests: 7
    • successful requests: 6
    • Exception objects created: 7
    • Exception Objects deleted: 14
    • URL Objects created: 5
    • URL Objects deleted: 4
    • connections recycled: 0
    • UNKNOWN_ERROR_CODE exceptions: 0
    • CONNECTION_REFUSED exceptions: 7
    • CONNECTION_TIMEOUT exceptions: 0
    • READ_ERROR_FROM_CLIENT exceptions: 0
    • READ_ERROR_FROM_SERVER exceptions: 0
    • READ_ERROR_FROM_FILE exceptions: 0
    • WRITE_ERROR_TO_CLIENT exceptions: 0
    • WRITE_ERROR_TO_SERVER exceptions: 0
    • WRITE_ERROR_TO_FILE exceptions: 0
    • READ_TIMEOUT exceptions: 0
    • WRITE_TIMEOUT exceptions: 0
    • UNKNOWN_HOST exceptions: 0
    • NO_RESOURCES exceptions: 0
    • PROTOCOL_ERROR exceptions: 0
    • CONFIG_ERROR exceptions: 0
    • FAILOVER_REQUIRED exceptions: 0
    • POST_TIMEOUT exceptions: 0
    • REQUEST_ENTITY_TOO_LARGE exceptions: 0
    • HALF_OPEN_SOCKET_RETRY exceptions: 0
    • BAD_REQUEST_FROM_CLIENT exceptions: 0
    • UNKNOWN_ERROR_CODE exceptions: 0

    If you are using Apache 2.4 on Windows NT follow this suggestion:

    venerdì 21 ottobre 2016

    How to create a WebLogic Cluster on two different Machines

    Suppose that you have two different Hardware (or Virtual) Machines:

    Machine_A and Machine_B

    To create a WebLogic Horizontal Cluster on these Machines you have to do:

    --- [01] ---
    Verify that there are no limitation on the LAN between the 2 Machines, you must be able to ping Machine_B from Machine_A and Machine_A from Machine_B.

    Verify also that there in not an active firewall.

    For example on Linux:

    service firewalld stop 
    (stop the firewall if it is active)

     systemctl disable firewalld  
    (to permanently disable the firewall)

    Verify that DATE & TIME are the same on both Machines
    Verify that on Machine_A and Machine_B it is installed the same version of JDK
    Verify that you are using the same version of OS with the same patches level on both Machines

    --- [02] ---
    Install the same version of WLS software on both Machines, it is suggested to install WLS under the same PATH on the 2 Machines:

    For examples I have installed WLS in :



    --- [03] ---
    Create a Domain with Admin Server on Machine_A.
    (In my example I have created a "base_domain" with an AdminServer on port 7001)

    To do this you can execute the command:

    --- [04] ---
    Start the Admin Server:

    Open the WLS Console:

    Create a Cluster with 2 Managed Server (ManagedServer_on_A , ManagedServer_on_B)
    (If you prefer you can create the cluster during the creation of the domain)

    --- [05] ---
    Stop the AdminServer and verify that there are no Active Servers and no JVM running in your Domain.

    Now we must create a compressed copy of the Domain ("base_domain") that you have created on Machine_A, transfer and uncompress  it on Machine_B.

    To do this you must:

    Execute the PACK command on Machine_A with the following parameters:

    The complete command is:
    pack -managed=true -domain=c:\FABRIZIO\demo_wls\user_projects\domains\base_domain -template=c:\FABRIZIO\demo_wls\user_projects\domains\basedomain_managed.jar -template_name="MyBaseDomain" 

    The result of this command is the creation of the file:
    under the directory on Machine_A:

    Now transfer the file basedomain_managed.jar on Machine_B under the directory:
    (you need to create the directories "user_projects" and "domains")

    Execute the UNPACK command on Machine_B with the following parameters:

    The complete command is:
    unpack -domain=c:\FABRIZIO\demo_wls\user_projects\domains\base_domain -template=c:\FABRIZIO\demo_wls\user_projects\domains\basedomain_managed.jar  

    The result of this command is the creation, on Machine_B, of a new Domain (in my case "base_domain") under the directory

    --- [06] ---
    Start AdminServer on Machine_A:

    Wait until AdminServer is Running.

    Now we must start the 2 Managed Servers of the Cluster with the command:
    startManagedWebLogic.cmd SERVER_NAME {ADMIN_URL}  

    Start ManagedServer_on_A on Machine_A, to do this execute the command:
    c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\bin\startManagedWebLogic.cmd ManagedServer_on_A http://IP_Machine_A:7001

    Start ManagedServer_on_B on Machine_B, to do this execute the command:
    c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\bin\startManagedWebLogic.cmd ManagedServer_on_B http://IP_Machine_A:7001  

    --- [07] ---
    This is a procedure valid for all the versions of WLS, but starting from WLS 12.1.2, you do not need to execute the nmEnroll() command on WLST  to enroll the node manager:
    • When you use the “pack” command with the “-managed=true” option, the configuration framework includes changes to the file in the template file.
    • When you use the “unpack” command on the remote host where you want to run your Managed Servers, the configuration framework sets up the domain, regenerates the file, generates a file (no need to run nmEnroll!), generates a DemoIdentity.jks keystore, and generates a startNodeManager script.