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:
FabryManaged-1: fmarini-it.it.oracle.com:7101
FabryManaged-2: fmarini-it.it.oracle.com:7102

It is recommended to enable the WLS settings "WebLogic Plugin Enabled":
http://www.ateam-oracle.com/wls-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 WLSPlugin12.2.1.1.0-Apache2.2-Apache2.4-Win64-12.2.1.1.0.zip 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 WLSPlugin12.2.1.1.0-Apache2.2-Apache2.4-Win64-12.2.1.1.0.zip:


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\mod_wl_24.so  
 <IfModule weblogic_module>  
   <Location />  
    SetHandler    weblogic-handler  
    WebLogicCluster fmarini-it.it.oracle.com:7101,fmarini-it.it.oracle.com:7102  
   </Location>  
 </IfModule>  


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:

http://fmarini-it.it.oracle.com:7101/MyApp
http://fmarini-it.it.oracle.com:7102/MyApp

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):

http://localhost/MyApp

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  
    WebLogicCluster fmarini-it.it.oracle.com:7101,fmarini-it.it.oracle.com:7102  
    DebugConfigInfo On  
   </Location>  
 </IfModule>  

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

In my case, if I call:
http://localhost/MyApp?__WebLogicBridgeConfig

I receive this output in the Browser:

WebLogic Server Plugin version 12.2.1.1.0, <WLSPLUGINS_12.2.1.1.0_WINDOWS.X64_160606.1942>
Query String: '?__WebLogicBridgeConfig'
WebLogic Cluster List:
  1. Host: '192.168.56.1' Port: 7101 SecurePort: 0 *Primary*
WLRetryAfterDroppedConnection: 'ALL'
WLRetryOnTimeout: 'NONE'
    General Server List:
    1. Host: '192.168.56.1' Port: 7101 SecurePort: 0 Status: OK
    2. Host: '192.168.56.1' 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 :

    Machine_A:
    c:\FABRIZIO\demo_wls  

    Machine_B:
    c:\FABRIZIO\demo_wls  

    --- [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:
    c:\FABRIZIO\demo_wls\oracle_common\common\bin\config.cmd  

    --- [04] ---
    Start the Admin Server:
    c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\startWebLogic.cmd 

    Open the WLS Console:
     http://IP_Machine_A:7001/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:
    c:\FABRIZIO\demo_wls\oracle_common\common\bin\pack.cmd  
     -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 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:
    basedomain_managed.jar
    under the directory on Machine_A:
    c:\FABRIZIO\demo_wls\user_projects\domains

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

    Execute the UNPACK command on Machine_B with the following parameters:
    c:\FABRIZIO\demo_wls\oracle_common\common\bin\unpack.cmd  
     -domain=c:\FABRIZIO\demo_wls\user_projects\domains\base_domain  
     -template=c:\FABRIZIO\demo_wls\user_projects\domains\basedomain_managed.jar  

    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
    c:\FABRIZIO\demo_wls\user_projects\domains

    --- [06] ---
    Start AdminServer on Machine_A:
    c:\FABRIZIO\demo_wls\user_projects\domains\base_domain\startWebLogic.cmd  

    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:

    https://blogs.oracle.com/WebLogicServer/entry/new_node_manager_configuration_model
    • When you use the “pack” command with the “-managed=true” option, the configuration framework includes changes to the nodemanager.properties 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 nodemanager.properties file, generates a nodemanager.domains file (no need to run nmEnroll!), generates a DemoIdentity.jks keystore, and generates a startNodeManager script.

    venerdì 13 maggio 2016

    Oracle Rest Data Service & Oracle Cloud (Second Part): How to INSERT (POST) data with REST

    In the [FIRST] part you have learned how to create a REST Data Service in Oracle Database (in Cloud)

    We have create a SELECT (GET), now we will see how to create an INSERT (POST).

    You can use the "auto rest" (more info here) but with this you can do only simple insert, with primary key and only a "select * ..." if you would like to specialized your INSERT (or UPDATE or DELETE) you must do what I will explain in this post.

    We will create a Data Service that will insert a row in the "emp" table of the HR user:


    This is the configuration:
    Insert in the Source field your preferred insert:

    begin  
        insert into emp (empno,ename,job,hiredate,sal,deptno) values   
        (:empno,:ename,:job,:hiredate,:sal,:deptno);  
     end; 

    This is an example, you can write every kind of complex insert.


     Now you can test it, I suggest to use something like "Postman":

    use your url in the POST field:
    https://yourIP/ords/pdb1/mariniws/hr/emp/

    Set in the Headers tab:
    Content-Type: application/json



    Select the Body tab and put here the data to send:

     {  
      "empno":1234,  
      "ename":"Marini",  
      "job":"PRESIDENT",  
      "hiredate":"2003-02-01T08:00:00Z",  
      "sal":5000,  
      "deptno":10  
     }  

    Click the "Send" button:
    If all It is ok, you will receive a Status 200 OK


    If you refresh SQL Developer you can find the new row:




    giovedì 12 maggio 2016

    Oracle Rest Data Service & Oracle Cloud (First Part): how to expose your data with REST in a very simple and fast way

    In this post I'll present ORDS (Oracle Rest Data Services) we will work on Oracle Cloud, but if you are interested in It you can download ORDS and install It on premise, you can find HERE all the informations.

    In Oracle Database Cloud Service, ORDS is already installed and running and it is very simple to create a Rest Data Service using as starting point a table tha already exist in the Database.

    In this example I'll use the EMPLOYEE table under the HR user:

    (some images captured from my SQL Developer connected to my Oracle Database Cloud Service )



    I'll cretae a REST service that is able to receive in the URL the employee_id, execute the query "select * from employees where employee_id = : employee_id" and that return a JSON object.

    To be able to create the Rest Data Service we will use the APEX (Application Express) console from the Oracle Database Cloud Service, this console respond in HTTPS so we need to open that protocol and port from the Oracle Cloud Compute Node:

    Connect to your Oracle Database Cloud Service and select Oracle Compute Cloud Service:


    Select Network and enable https for the DB service:


    Now return in your Oracle DBCS and open the APEX console:


    The first time you need to use the following information to connect as Administartor:
    INTERNAL
    ADMIN
    your ADMIN password (the one that you use also in SQL Developer to connect)


    As ADMIN you can create now a workspace where you can create all the Rest Data Services that you need, so click on "Create Workspace":


    Choose a name for your workspace (this will appear in the Rest URL).
    Click the Next Button:


    I'll use an existing schema and table , so I have selected YES on the field "Re-use existing schema?", then click on the field "Schema Name" to choose which table expose via REST:


    a popup will appear with the existing tables names, choose your one:


    Click the Next button:


    Choose an Admin username & password.
    Click on the Next button:


    Review all the inserted data then click on the "Create Workspace" button:


    Your workspace is created, click on "Done" button:


    Logout from the console:


    Now you can login in your new workspace with your new credentials:


    Use the name of your new workspace, the new ADMIN and PASSWORD:


    After the first login in the new workspace you must change the password:


    Choose a new password then click on "Apply Changes":


    Now select "SQL Workshop", here we can create REST Data Services:


    Select "RESTful Services":


    Click on the "Create" button:


    Choose a Name for your REST Data Service, this will appear in the console, Choose an URI Prefix, this will appear in the REST URL:

    Name: hr
    URI Prefix: hr/

    Choose an URI Template, this will appear in the REST URL, if you whant to pass parameter use {}

    URI Template: employees/{employee_id}

    Example, the REST URL:
    https://myIP/ords/pdb1/mariniws/hr/employees/101
    will return a JSON with the resul of the query:
    "select * from employees where employee_id = : employee_id

    Scroll down the page:


    Select:
    GET as Method
    Source Type=Query
    Format=JSON

    Insert you Query in the Source field:
    select * from employees where employee_id = : employee_id

    Click on Create Module:


    You have created your REST Data Service.
    To test It click on the GET link on the left panel:


    Scroll down the page and click on the "Set Bind Variables" button:


    Put 101 in the EMPLOYEE_ID field and then click on the Test button:


    You will receive a popup with the JSON response:

    I have installed the "JSONView" plugin for Chrome to have a readable answer:


    This is the JSONView plugin.


    As soon as possible I'll write some example of code on how to call those kind of Rest data Services from Java and Node.js.



    lunedì 9 maggio 2016

    Meetup DevOps - Rome, 31 May 2016 - Oracle, Via Bombay 1 - Eur (Torrino) - 5:00 PM to 7:15 PM

     MeetUp DevOps

    In you are interested on DevOps & Cloud, this MeetUp is for you, no slide and a lot of hands-on :-)

    We will see:
    • Oracle Developer Cloud Service
    • Oracle Java Cloud Service
    • Oracle Application Container Cloud Service
      • JavaSE Container
      • Node.js Container

    For more information click [HERE]

    Meetup DevOps
    Rome, 31 May 2016
    Oracle, Via Bombay 1 - Eur (Torrino)
    5:00 PM to 7:15 PM

    martedì 26 aprile 2016

    WebLogic 12.2.1 & Multitenancy - (Document in Italian Language)

    Definizione:

    WebLogic 12.2.1 ha introdotto il concetto di Multitenancy nelle architetture Middleware basate su Application server.

    La multi-tenancy si riferisce ad un principio nell’architettura del software o dell’hardware in cui una singola istanza del software viene eseguita su un server, offrendo il proprio servizio a più client (i tenant). Il concetto di multi-tenancy non deve essere confuso con quello di architettura multi-istanza, in cui istanze software separate o sistemi hardware separati sono resi disponibili a diverse organizzazioni. In un’architettura multi-tenant un’applicazione software è progettata per partizionare virtualmente i suoi dati e la sua configurazione, ed ogni tenant opera con una di queste istanze applicative personalizzate.

    La multi-tenancy costituisce una conseguenza fondamentale della tecnologia di virtualizzazione, grazie alla quale possiamo concretizzare un approccio multi-tenant sulle risorse infrastrutturali, in quanto si assiste alla creazione di ambienti virtuali logicamente separati sui medesimi componenti fisici condivisi. L’aggettivo virtuale vuole evidenziare come tale tecnologia consenta di costruire una separazione logica delle risorse.
    Nonostante il concetto di multi-tenancy indichi che ci sono delle infrastrutture condivise, ciò che fa la differenza è il livello nel quale le risorse diventano multi-tenant, con una infrastruttura Oracle si è multi-tenant sia a livello applicativo che a livello dei dati/DB e, con riferimento al cloud anche a livello Hardware.

    Componenti necessari per la Multitenancy in Weblogic 12.2.1:

    Per poter configurare ed utilizzare la Multitenancy in Weblogic 12.2.1 è necessario avere solo un JDK 1.8 (consigliato dalla release/patch-set update 65 in su) con il garbage collector G1 configurato.

    WLS 12.2.1 sarà in tal modo in grado di rendere “multitenant” la JVM (partizionamento della JVM) e su di essa baserà la sua multitenancy.

    L’unione di un tenant su WLS unito ad un tenant su JVM viene chimamato Domain Partition.

    Partizionamento della JVM, le Domain Partitions:

    Una JVM quando viene eseguita in una Macchina fisica, consumerà, in base al carico,  tutti i core (cpu) presenti su quella macchina.

    Per evitare questo problema e con il nuovo HW multicore che si trova sul mercato, solitamente vengono create immagini virtuali, ad ognuna di esse si assegnano risorse HW quali Cpu e Memoria, vi si reinstalla parte del software e vi si esegue almeno una JVM.

    Oltre che per suddividere meglio le risorse presenti su una macchina, tali opersazioni risultano necessarie in alcuni contesti applicativi per separare e/o isolare fisicamente e logicamente le applicazioni.

    WLS 12.2.1 è in grado di suddividere una singola JVM in piu zone chiamate domain partitions.

    Tramite la Console di Amministrazione di WLS 12.2.1, si è in grado di assegnare  la quantità di CPU, Memoria e file descrittori consumabili da ogni Domain Partition.

    Ogni domain partition è fisicamente isolata da un’altra ed ha:

    ·         una o più applicazioni deployate
    ·         le sue regole di consumo cpu, memoria e file descrittori
    ·         un suo proprio JNDI, non ci possono essere quindi conflitti se si usano gli stessi nome logici in domain partition differenti
    ·         il suo web context root
    ·         le sue librerie ed il suo classloader
    ·         le sue configurazioni di JMS, JDBC etc
    ·         il suo sistema di autenticazione

    Ne consegue che è possibile deployare una stessa applicazione piu volte su una stessa jvm ma in domain partitions diverse.

    Nel caso ad esempio di architetture a microservizi, una stessa applicazione può essere specializzata rideployandola in domain partitions diverse, assegnando ad ognuna di esse un suo datasource ed un suo pluggable database (Oracle DB multitenancy) ed assegnando ad ogni domain partition uno specifico Authentication Provider. In tale modo ogni applicazione avrà un diverso bacino di utenza ed un diverso sistema di persistenza.

    Architettura e funzionalità di WLS 12.2.1 & Domain Partitions:


    Nella precedente immagine viene rappresentata una tipica architettura basata su Weblogic 12.2.1 con Multitenancy.

    Nela caso della presenza di un cluster e di domain partitions configurate, ogni singola jvm di ogni Managed Server del cluster verrà partizionata nella stessa maniera.

    Le applicazioni, quindi, saranno in cluster, dentro ogni singola domain partition.

    Tramite la console di amministrazione si potranno definire delle policy di resource sharing e di resource consumption.

    Ogni regola applicata su una domain partition può attivare degli eventi quali:

    · Notify : l’applicazione di una domain partition sta consumando piu di un primo limite fissato e ne viene data notifica
    · Slow : l’applicazione di una domain partition sta consumando piu di un secondo limite fissato e viene rallentata dal sistema diminuendogli i thread di esecuzione.
    · Shutdown : l’applicazione di una domain partition sta consumando piu di un terzo limite fissato e viene “spenta” dal sistema. E’ infatti possibile fare stop o start di una domain partition senza che le altre ne siano coinvolte

    E’ evidente quindi che con un semplice wizard sulla console di Amministrazione si può decidere quante risorse assegnare ad una domain partition ed alla sua (o sue) applicazioni deployate e quindi se una applicazione inizia a dare problemi, può essere disattivata (automaticamente o manualmente) prima che rechi problemi alle altre applicazioni deployate sulla stessa jvm. Inoltre l’applicazione che viene “spenta”, verrà spenta solo su quella partizione dello specifico Managed su cui creava problemi e continuerà a funzionare nel cluster delle altre partizioni sugli altri Managed.

    Nel caso di presenza di cluster dinamico e di regole di scale-up (e/o scale-down), per ogni nuovo managed aggiunto la sua jvm verrà automaticamente partizionata e riconfigurata come le precedenti.

    Il nuovo bilanciatore software di Oracle denominato Oracle Traffic Director (OTD) viene aggiornato in automatico nel caso di nuove domain partitions create in un dominio.

    Grazie a questa funzionalità di autoaggiornamento dell’OTD si può avere la live-migration delle Domain Partitions.

    La live-migration delle domain partitions, consente di spostare a caldo le domain partitions configurate su delle jvm, su nuove JVM (sullo stesso o su nuovo HW). Questo consente ad esempio di aggiornare l’HW (o in generale di eseguire operazioni di manutenzione ordinaria e/o straordinaria) senza dare disservizi.

    Le domain partitions una volta che sono configurate possono essere esportate in un file zip con un semplice click dalla console di Amministrazione.

    In una domain partition esportata è presente oltre che l’applicazione in essa deployata anche tutte le sue configurazioni come ad esempio, JMS, JDBC, Datasources ... etc.

    E’ ovviamente anche possibile importare uno di questi file zip e replicare quindi con un semplice click una complessa configurazione di una qualsiasi applicazione configurata in precedenza.

    L’export e l’import delle domain partitions semplifica e rende immediato il passaggio di applicazioni da on-premise sul cloud, oppure da ambienti di test ad ambienti di produzione.

    Vecchie configurazioni di domini Weblogic, dalla versione 10.3.6 in poi, possono essere trasformate in Domain Partitions ed essere importate su WebLogic 12.2.1, tramite il tool D-PCT (Domain to Partition Conversion Tool) scaricabile da Oracle Technology Network.

    Benefici delle Architetture basate sulle Domain Partitions:

    Oltre a tutti i benefici descritti in precedenza, una configurazione basata su Domain Partitions rispetto ad una equivalente senza Domain Partitions, risulta leggermente piu veloce ma con un lieve incremento di consumo di memoria.

    Solitamente si installa meno software ed in un mondo puramente Java si può evitare di installare ambienti di virtualizzazione (risparmio licenze) e si riduce drasticamente il numero di processi running di JVM, con conseguente minor consumo di RAM e CPU.

    Piu domini possono essere consolidati in un unico dominio wls 12.2.1, semplificando nel tempo le eventuali operazioni di patching e/o upgrade.

    Nel caso di ambienti di sviluppo, ogni sviluppatore può fare i suoi test su una specifica Domain Partition, sapendo in tal modo di non arrecare problemi o conflitti con Domain Partition dedicate ad altri sviluppatori. Gli ambienti di sviluppo collassano quindi in una unica installazione di prodotto.

    sabato 2 aprile 2016

    Maven & Oracle: "How To" & "maven.oracle.com"

    In the last days a lot of developers/customers, has asked to me how to use maven during the development of projects with Oracle artifacts so I have decided to summarize here some solutions:

    In this [POST] I have explained for example:
    1. How to use the local Maven Repository to push/get Oracle Jdbc drivers; The default path value is ${user.home}/.m2/repository/.
    2. Hot to use the remote Maven Repository on DevCS (Developer Cloud Service) to push/get Oracle Jdbc drivers
    Now is time to introduce the maven.oracle.com: (Oracle documentation)

    Suppose that you are developing an application that requires and uses Oracle Jdbc Driver ojdbc7.jar, and that you would like to get it directly from internet from the remote Maven Repository maven.oracle.com.

    We need to write/update 2 files:
    1. pom.xml (inside your maven project)
    2. settings.xml
      • this file is inside the conf directoy of your maven installation.
      • can be also in  ${user.home}/.m2/) - Tools like Eclipse are searching it in this directory
    To access to the Oracle Maven Repositoy - maven.oracle.com you need an user and a password, if you are already registered on OTNOracle Technology Network you can use the same user and password.

    For the autentication we need to use HTTP Wagon, this is already inside Maven:

    You must verify that the Maven that you are using has in his lib directory the wagon-http-shared-x.xx.jar and that the version (x.xx) is > 2.8

    For examples I have installed Maven 3.3.9 and I'm using wagon-http-shared-2.10.jar.


    If you are using an old version of Maven you cal download the HTTP Wagon (2.8) from [HERE] and put the jar in MAVEN_HOME/lib/ext/.

    This is a sample of minimal pom.xml that you must use for example to get from the remote maven.oracle.com the ojdbc7.jar version 12.1.0.2

     <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
      <modelVersion>4.0.0</modelVersion>  
      <groupId>demo</groupId>  
      <artifactId>maven1</artifactId>  
      <version>0.0.1-SNAPSHOT</version>  
      <repositories>  
       <repository>  
        <id>maven.oracle.com</id>  
        <releases>  
         <enabled>true</enabled>  
        </releases>  
        <snapshots>  
         <enabled>false</enabled>  
        </snapshots>  
        <url>https://maven.oracle.com</url>  
        <layout>default</layout>  
       </repository>  
      </repositories>  
      <pluginRepositories>  
       <pluginRepository>  
        <id>maven.oracle.com</id>  
        <url>https://maven.oracle.com</url>  
       </pluginRepository>  
      </pluginRepositories>  
      <dependencies>  
       <dependency>   
        <groupId>com.oracle.jdbc</groupId>   
        <artifactId>ojdbc7</artifactId>   
        <version>12.1.0.2</version>   
       </dependency>  
      </dependencies>  
     </project>  

    You must write also a settings.xml where you must insert your user and password:

    edit your settings.xml that is inside the directory MAVEN_HOME/conf

      <!-- servers  
       | This is a list of authentication profiles, keyed by the server-id used within the system.  
       | Authentication profiles can be used whenever maven must make a connection to a remote server.  
       |-->  
      <servers>  
       <server>  
       <id>maven.oracle.com</id>  
       <username>username</username>  
       <password>password</password>  
       <configuration>  
        <basicAuthScope>  
         <host>ANY</host>  
         <port>ANY</port>  
         <realm>OAM 11g</realm>  
        </basicAuthScope>  
        <httpConfiguration>  
         <all>  
          <params>  
           <property>  
            <name>http.protocol.allow-circular-redirects</name>  
            <value>%b,true</value>  
           </property>  
          </params>  
         </all>  
        </httpConfiguration>  
       </configuration>  
       </server>  
      </servers>  

    That's all :)

    Now some Tips & Tricks:
    1. Setting a proxy in Maven
    2. Setting your Maven installation on Eclipse
    3. Browsing the remote maven.oracle.com
    - [1] - If you are using a proxy update the pre-configured part <proxies>...</proxies> in the file settings.xml

    - [2] - If you are working with Eclipse and you have also maven installed it is convenient to says to Eclipse to use your maven installation and not the embedded one. 

    How to use from Eclipse an external maven installation:

    I have created a simple maven project and I have dragged inside the previous described pom.xml file with the ojdbc7 dependency:


    Righy click with the mouse on the pom.xml file and select: Run As-> Maven build ...
    Choose a name (maven1 - package) and a Goal (package):
    As you can see we are using the embedded Maven Runtime, click on Configure to change it:


    Click the Add button:


    Select the Directory where you have installed Maven on your local disk:
    Click on Finish:


    Check only the local maven installation:
    Click on Apply then on OK:


    Now your maven Runtime is changed, you can click on Run to execute the package goal:


    In the console you can see that you are dowloading some files:


    If you go in the ${user.home}/.m2/repository/ directory you can find what you have downloaded:


    - [2] - How to browse the remote maven.oracle.com:

    I suggest to use: Nexus Repository OSS - I have downloaded and installed the version : nexus-2.12.1-01-bundle.zip (light, fast and simple)

    Unzip it in a directory:


    Go into the directory nexus-2.12.1-01:
    Open a Command Console and execute "nexus console", this will start an http server on port 8081:


    Open in a Broser the URL: http://localhost:8081/nexus


    Login with the default user admin/admin123:


    Click the Add button and select Add Proxy Repository:


    Copy the following configuration (next 2 images) and insert your OTN User and Password:



    Now you can browse the repository maven.oracle.com:


    You can also search on it, try to search ojdbc7:


    </end>