53642 Cloud Apps

download 53642 Cloud Apps

of 49

Transcript of 53642 Cloud Apps

  • 8/11/2019 53642 Cloud Apps

    1/49

    http://www.oracle-developer-days.com

    Copyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved

    Cloud Application Foundationusing Oracle WebLogic Suite

    11 g

    Lab Guide

  • 8/11/2019 53642 Cloud Apps

    2/49

    Cloud Application Foundation using Oracle WebLogic Suite 11 g

    http://www.oracle-developer-days.com

    Copyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved

    TABLE OF CONTENTS

    Introduction ...................................................................................................................................... 3

    Lab 1 .................................................................................................................................................. 5

    Install WebLogic Server ................................................................................................................. 5

    Install Oracle Web Tier Utilities ...................................................................................................... 5

    Lab 2 .................................................................................................................................................. 8

    First Pass Configuration ................................................................................................................. 8 Create new WebLogic Server Domain ....................................................................................... 8

    Configure Oracle HTTP server ..................................................................................................... 14

    Deploying the first version of the application................................................................................ 17

    Lab 3 ................................................................................................................................................ 25

    Deploy the second version of the Application .............................................................................. 25

    Lab 4 ................................................................................................................................................ 27

    Automatically Starting and Stopping Managed Servers with Node Manager .............................. 27

    Lab 5 ................................................................................................................................................ 30

    Deploy the third version of the application with Coherence*Web for HTTP session management

    ...................................................................................................................................................... 30 Lab 6 ................................................................................................................................................ 37

    Deploy Fourth version of the Application Includes Java Message Service Configuration. ....... 37

    Lab 7 ................................................................................................................................................ 45

    JMS automatic singleton service migration .................................................................................. 45

    Lab 8 ................................................................................................................................................ 49

    Side by Side Deployment ............................................................................................................. 49

  • 8/11/2019 53642 Cloud Apps

    3/49

    Cloud Application Foundation using Oracle WebLogic Suite 11 g

    http://www.oracle-developer-days.com

    Copyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved

    INTRODUCTION

    This lab guide is intended to guide you through the use of WebLogic Suite and some application gridfeatures.

    This course will use host laptops running Oracle Enterprise Linux. The lab work will take place in an OracleVirtualBox virtual machine running Oracle Enterprise Linux as the guest operating system.

    Once Oracle VirtualBox is started you will see a Virtual machine called WLS Workshop - This is the virtualmachine we will use for the rest of the day.

    The hostname of the virtual machine is wlsdevday

    The userid is oracle

    The password is welcome1

    To start the virtual machine, highlight wlsdevday and click Start

    This will open a new window, and you should see the virtual machine starting, it is likely to present you withsome information dialog, just click OK to continue (It is possible to switch these off, you might not see themat all).

    Useful tips when using Oracle VirtualBox:

    Oracle VirtualBox has a concept called the host key by default this is the right Ctrl Key

    To make the window full screen press host key and f (You might see an information dialog justpress the switch button

    To exit full screen mode press host key and f again

    If you want to use seamless mode, which makes the virtual machines desktop blend with the hostsystem press host key and L

  • 8/11/2019 53642 Cloud Apps

    4/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 4

    To exit seamless mode press host key and L again

    Once the Virtual machine has started, it is advisable to login in ( oracle/welcome1 ) and find the dhcpallocated IP address. Follow the instructions and note down the IP address you may need it later.

    Open a Terminal Command

    type /sbin/ifconfig (click Enter ), note down the ip address for eth0

  • 8/11/2019 53642 Cloud Apps

    5/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 5

    LAB 1

    Install WebLogic Server

    1. To install WebLogic Server, open a Terminal Window and type in the command :

    /home/oracle/Desktop/InstallationFiles/wls1034_linux32.bin

    2. This will open a graphical installation window

    3. Click Next ; you should now see the screen below asking you to create a new middleware home.

    4. Choose Create a new Middleware Home , and type in as the new home :

    /u01/middleware

    Click Next

    5. Uncheck the I wish to receive security updates via My Oracle Support Request screen. Acknowledge the do you wish to proceed dialog.

    6. Choose Typical as the install type.7. Review the details on the next screen and click Next

    8. Review the Installation Summary and click Next

    9. WebLogic Server will now install.

    Install Oracle Web Tier Utilities

    We will use Oracle HTTP server (OHS) to load balance requests into the WebLogic Cluster.

    1. To install Oracle Web Tier Utilities type the following command into a Terminal Window :

    /home/oracle/Desktop/InstallationFiles/WebTier/PS2/Disk1/runInstaller

  • 8/11/2019 53642 Cloud Apps

    6/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 6

    2. Confirm location and user.

    3. On the first screen, you will see a pop up window like the one below :

    You must follow the instructions in the above before accepting this pop-up.

    Note from Steve: Otherwise you will feel as silly as I did following these instructions and not reading themfully.

    Please open a new Terminal Window, and follow the instructions in the pop up window.

    To change user to root type su -, the password is welcome1 .

    Once complete, you can click OK to continue with the installation.

    4. Click Next on the welcome screen

    5. On the Select Installation Type please choose the Install Software Do Not Configure option.We will perform the configuration later.

  • 8/11/2019 53642 Cloud Apps

    7/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 7

    6. Click Next until you reach the Specify Installation Location . Please choose the middleware homeyou just created /u01/middleware . Accept the Oracle Home Directory default and click Next .

    7. Uncheck I wish to receive security updates via My Oracle Support and click Next

    8. Review the installation summary and click Install, once complete, click Next then Finish 9. Now we need to patch Webtier to raise the Patch level to the same version as WebLogic server.

    In a terminal window type:

    /home/oracle/Desktop/InstallationFiles/WebTier/PS3/Disk1/runInstaller

    Follow the on screen instructions..

  • 8/11/2019 53642 Cloud Apps

    8/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 8

    LAB 2

    First Pass Configuration

    Create new WebLogic Server Domain A WebLogic Server domain is an administrative unit, this administrative unit consists of one AdministrationServer, one or many clusters containing one or more managed servers. This administrative unit ismaintained, and monitor through one administration console and an Enterprise Manager FusionMiddleware Control instance.

    Best practise states that we should never perform our configuration work within the middleware homeyouve just created. This middleware home is reserved for the Fusion Middleware binaries only. The bestpractise folder structure we will use today looks like:

    Note: Make sure you DO NOT install WebLogic Server as the root user - if you are unsure please ask.

    1. To configure a new Domain, run the WebLogic Configuration Wizard:

    /u01/middleware/wlserver_10.3/common/bin/config.sh

    2. Choose Create a new WebLogic domain

    3. Choose the WLS template functionality to include in this domain; we want Oracle EnterpriseManager, and Oracle JRF.

    u01

    projects

    domains jmsjtanodemanager

    wlsdevday

    wlsdevdaynode wlsdevdaynode

    ms1 ms2

    All Domainscreated here.

  • 8/11/2019 53642 Cloud Apps

    9/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 9

    4. Click Next , enter the domain name wlsdevDomain

    Change domain location to

    /u01/projects/wlsdevday/domains

    Change Application location to

    /u01/projects/wlsdevday/applications

    and click Next (Note: You should never create your domains/applications in Oracle Middlewarehome as discussed earlier).

    5. Enter user name Weblogic and password welcome1 , click Next

    6. We are not planning on doing any development work (hopefully!!). The development work hasbeen don e for you. Lets create a Production Domain running JRockit , this is recommended byOracle. Click Next

  • 8/11/2019 53642 Cloud Apps

    10/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 10

    7. We are going to be creating a Cluster on WebLogic. The configuration wizard allows us to do thebasic configuration work; therefore we will choose to configure Managed Servers, Clusters, andMachines.

    8. The next screen allows us to configure the required managed servers. We require 2 servers thatwe'll cluster together :

    Managed ServerName

    Listen Address ListenPort

    wlsdevManaged1 All Localaddresses

    7003

    wlsdevManaged2 All Local

    addresses

    7004

  • 8/11/2019 53642 Cloud Apps

    11/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 11

    9. Next, we create a cluster. We will choose to use Unicast clustering. This is the recommendedapproach by Oracle; it avoids multicast storms, and doesn't require any additional networkconfiguration. We will use the host name of the computer to resolve the IP address for the cluster.

    Name Clustering Message Mode Cluster Address

    wlsdevCluster Unicast wlsdevday:7003,wlsdevday:7004

    10. Both Managed servers will form the Cluster. Shuttle both of the managed servers to the right pane,underneath the cluster name.

  • 8/11/2019 53642 Cloud Apps

    12/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 12

    11. Create new Machine, running on localhost as below. In a distributed environment, this machineconfiguration is used to communicate with the remote node manager. More on that later.

    12. Target all WebLogic Server instances to the machine. Typically in a distributed environment, themanaged servers in particular would be targeted to different machines for load balancing, fail over

    and resilience.

  • 8/11/2019 53642 Cloud Apps

    13/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 13

    13. Review the configuration summary, then click Create

    14. Please edit the file

    /u01/projects/wlsdevday/domains/wlsdevDomain/bin/setDomainEnv.sh

    Locate the line:

    EXTRA_JAVA_PROPERTIES="-Dcommon.components.home=${COMMON_COMPONENTS_HOME} -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=${DOMAIN_HOME} -Djrockit.optfile=${COMMON_COMPONENTS_HOME}/modules/oracle.jrf_11.1.1/jrocket_optfile.txt -Doracle.server.config.dir=${ORACLE_DOMAIN_CONFIG_DIR}/servers/${SERVER_NAME} -

    Doracle.domain.config.dir=${ORACLE_DOMAIN_CONFIG_DIR} -Digf.arisidbeans.carmlloc=${ORACLE_DOMAIN_CONFIG_DIR}/carml -Digf.arisidstack.home=${ORACLE_DOMAIN_CONFIG_DIR}/arisidprovider -Doracle.security.jps.config=${DOMAIN_HOME}/config/fmwconfig/jps-config.xml -Doracle.deployed.app.dir=${DOMAIN_HOME}/servers/${SERVER_NAME}/tmp/_WL_user -Doracle.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=${ALT_TYPES_DIR} -Djava.protocol.handler.pkgs=${PROTOCOL_HANDLERS} ${WLS_JDBC_REMOTE_ENABLED}${EXTRA_JAVA_PROPERTIES}

    Please change the line to (The new piece is highlighted below in bold):

    EXTRA_JAVA_PROPERTIES="-

    Dcommon.components.home=${COMMON_COMPONENTS_HOME} -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=${DOMAIN_HOME} -Djrockit.optfile=${COMMON_COMPONENTS_HOME}/modules/oracle.jrf_11.1.1/jrocket_optfile.txt -Doracle.server.config.dir=${ORACLE_DOMAIN_CONFIG_DIR}/servers/${SERVER_NAME} -Doracle.domain.config.dir=${ORACLE_DOMAIN_CONFIG_DIR} -Digf.arisidbeans.carmlloc=${ORACLE_DOMAIN_CONFIG_DIR}/carml -Digf.arisidstack.home=${ORACLE_DOMAIN_CONFIG_DIR}/arisidprovider -Doracle.security.jps.config=${DOMAIN_HOME}/config/fmwconfig/jps-config.xml -Doracle.deployed.app.dir=${DOMAIN_HOME}/servers/${SERVER_NAME}/tmp/_WL_user -Doracle.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=${ALT_TYPES_DIR} -Djava.protocol.handler.pkgs=${PROTOCOL_HANDLERS} ${WLS_JDBC_REMOTE_ENABLED}${EXTRA_JAVA_PROPERTIES} -Duser.timezone=GMT"

    15. Confirm that the WebLogic Server Administration Server is configured correctly by starting it. To dothis, in a terminal window type:

    /u01/projects/wlsdevday/domains/wlsdevDomain/startWebLogic.sh

  • 8/11/2019 53642 Cloud Apps

    14/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 14

    You will be prompted to enter the user name and password of the admin user, if you followed theinstructions this should be weblogic/welcome1.

    You will know the server has started, once you see:

    16. Start a browser instance; you can either do this on the host system, or within the guest operatingsystem.

    Go to Enterprise Manager by typing the following URL:

    http://:7001/em (Instructions are in the introduction for finding your ip address)

    Login to Enterprise Manager user name Weblogic , password welcome1

    Welcome to Enterprise Manager 11g!

    17. For now, we just need to apply JRF to the cluster.

    The pre-built application we'll be using is built using Oracle ADF. This requires Oracle Java Required Files(JRF) to be installed on the cluster

    Navigate the tree on the left hand side, and select the cluster as in the picture below.

    Click the Apply JRF Template

    Leave the Administration server running.

    Configure Oracle HTTP server

    Oracle HTTP server (OHS) will be required to load balance requests into the WebLogic Cluster. To do thiswe need to configure OHS to ensure it passes requests through to WebLogic Server. Also, OHS can bemanaged, configured and administered through Enterprise Manager. As part of the configuration, we'llregister OHS with Enterprise Manager.

    1. Configure OHS by executing the following configuration wizard in a terminal window:

    /u01/middleware/Oracle_WT1/bin/config.sh

    Press this button

  • 8/11/2019 53642 Cloud Apps

    15/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 15

    2. Click Next , you will now see the Configure Components dialog. Uncheck Oracle Web Cache we don't have time to look at this product during the day. The screen should look like:

    3. Fill in the WebLogic domain details as below (this should be filled in for you, except the password)

    4. Accept defaults on Specify Component Details dialogue.

    5. On Configure Ports , accept the defaults (Auto Port Configuration) this should give you port 7777for OHS to listen on. If not, we can find the port through Enterprise Manager.

    6. Uncheck the option to receive email security alerts.

    7. On the next screen click Configure .

    The configuration will register OHS with Enterprise Manager, and start OHS.

  • 8/11/2019 53642 Cloud Apps

    16/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 16

    For reference, if you shutdown OHS, or reboot OHS can be restarted through EnterpriseManager or by typing the following command in a terminal window.

    /U01/middleware/Oracle_WT1/instances/instance1/bin/opmnctl startall

    8. Log back into Enterprise Manager:http://:7001/em

    You should now see a new entry on the navigation tree called Web Tier.

    Select Web Tier / ohs1. You should now be able to see the monitoring information from OHS.

    Now we need to edit the WLS configuration for OHS. To do this click on http server near the top ofthe screen. Follow the picture below for navigation. Oracle HTTP Server / Administration /mod_wl_ohs Configuration.

    9. Now fill in the form with the values below, then click Apply :

    WebLogic Cluster: wlsdevday:7003,wlsdevday:7004 (Note: no spaces please!)

    WebLogic Host : blank

    WebLogic Port : blank

    Dynamic Server List on : checked

    Error Page: blank

    Debug: blank

    Log file: blank

    WebLogic TMP directory : blank

    Exclude Path or Mime Type: blank

    Click Plus Add Row under Match Expressions

  • 8/11/2019 53642 Cloud Apps

    17/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 17

    Expression = *

    Having clicked Apply , you should get a warning notifying you that OHS needs to be restarted. Todo this click on:

    Oracle HTTP Server , then Control , then Restart . (Wait while OHS restarts)

    You can perform a quick test to see if OHS is routing to WebLogic.

    Start your cluster, to do this, open 2 terminal commands, into the first type:

    /u01/projects/wlsdevday/domains/wlsdevDomain/bin/startManagedWebLogic.shwlsdevManaged1 http://wlsdevday:7001

    into the second type:

    /u01/projects/wlsdevday/domains/wlsdevDomain/bin/startManagedWebLogic.shwlsdevManaged2 http://wlsdevday:7001

    Note : Don't make the same mistake that we always make, the starting servers will ask you for username and login (weblogic / welcome1). Many people start their servers, disappear for a while, andcome back only to find the instances waiting for you to authenticate.

    Wait until the managed servers, have joined the cluster, and are running

    Type in a browser http://YourIPAddress>:7777/

    You should see a lovely Error 404 Not Found. This is WebLogic server returning the error,which also proves that the request is being passed back to WebLogic.

    Deploying the first version of the application

    We are going to deployment the first version off the application. This application is a Database orientatedapplication that is built using ADF.

    Through, the developer day we will deploy various versions of this application.

    Note: As the application is in your virtual environment, you should use a browser there to or you may haveissues finding the applications to deploy!

  • 8/11/2019 53642 Cloud Apps

    18/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 18

    1. This application replies on a connection to the database. First job is to create a new datasourceand connection pool, then deploy this to the wlsdevCluster.

    2. You need to open a browser, and start the WebLogic Console:

    http://:7001/console (As you have seen before this is the main configurationconsole used by WebLogic server).

    Login to the console using your administration userid weblogic / welcome1

    You should now see the screen below:

    3. Click Lock & Edit in the change center (This allows you to make a number of changes, then applythem all at once, this is transactional, once you commit ('activate') you can do nothing to stop thechanges being deployed, yet)

    4. Expand Services in the Domain Structure Window.

    5. Click on Data Sources underneath Services in the Domain Structure Window.

    6. Your screen should look like the one below :

  • 8/11/2019 53642 Cloud Apps

    19/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 19

    7. We are going to create a connection to the HR schema on Oracle XE (which is installed andautomatically starts up when you start the VM).

    8. Click New and choose Generic Data Source to create a new Datasource:

    Datasource name = hr

    JNDI name = hr

    Leave database type as default\Click Next

    Leave database driver as default

    Click Next

    and click Next again

    Database Name = xe

    Hostname = wlsdevday

    Port = 1521

    Database User Name = hr

    Password = hr

    Click Next

    Click Test Configuration , this should return Connection test succeeded . If it doesn't, please goback and check the values entered.

    Click Next

    Deploy the datasource to the wlsdevCluster:

    Check the check box next to wlsdevCluster

    Click Finish

    Activate the changes by clicking the Activate Changes button in the control center.

  • 8/11/2019 53642 Cloud Apps

    20/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 20

    9. Deploy the first version of the application. This version has HTTP session replication set to

    Memory. This means that session data will not be copied to any other WebLogic instance in thecluster.

    MEMORY

    false

    10. The application we are going to use has been made available as an Enterprise Application Archive(EAR).

    The applications live in a sub directory of:

    /home/oracle/Desktop/InstallationFiles/Applications/WebApplication Within this directory you will see 5 subdirectories v1, v2, v3, v4, v5

    We will start with version v1.

    At this stage, make sure you use the Browser within the virtual machine (The EAR is on the virtualmachines local file system).

    Open the WebLogic Console again:

    http://:7001/console

    Login as weblogic / welcome

    Use the Domain Structure window to open DeploymentsClick Lock and Edit in the change center to allow changes to be made.

    Your screen should look like:

  • 8/11/2019 53642 Cloud Apps

    21/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 21

    TIP : When you first look at the deployments, the console shows all libraries and applications withonly 10 items per page. To make life easier (unless you are deploying libraries!), you can switchlibraries off and increase the number of items per page by clicking the Customize this table link.

    11. To deploy the first version of the application click Install

    We are going to deploy the application into the WebLogic application staging area, this will allowWebLogic to distribute the application to all servers within the cluster. This is without the need tocreate a shared file system for the deployments.

    First we need to Upload the application , to do this click Upload your files (as shown in thepicture below):

    Click Browse , next to the Deployment Archive input box. In the file upload dialog, navigate to:

    /home/oracle/Desktop/InstallationFiles/Applications/WebApplication/v1

    Select the EAR file called WLSDevDayApp.ear and click Open

    This should return you back to the main browser window.

    Click Next

    The next screen will show your EAR file, already checked.

    Upload your files

  • 8/11/2019 53642 Cloud Apps

    22/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 22

    Click Next

    The next screen should have Install this deployment as an application checked (if not, makesure you choose this option).

    Click Next; this will take you to targeting the application.

    Click the check box next to wlsdevCluster and click Next

    Ensure the DD only is selected and click Finish

    As normal, click Active Changes in the Change Center.

    This will deploy the application out to all managed servers in the cluster. At this point theapplication is still not ready to accept requests.

    To start the application you need to select the application using the check box in the applicationsummary window (if you didn't follow the tip in section 11 then you may need to scroll down).

    Then click the start button (at the top or bottom of the table). Select Servicing All Requests andclick Yes in Start Deployments window.

    The application might take a few minutes to fully deploy. Once its status has changed to Active then it is fully running and ready to accept request.

    12. Use Enterprise Manager to ensure that OHS is still running:

    http://:7001/em

    Note: If your Firefox like mine was not showing tabs on the toolbar, you will find them in the Filemenu.

    Click Web Tier , then ohs1 . If the server is down, you'll see a Red Arrow image (Not the Air Display

    team!!) next to ohs1 on a terminal window and type:/u01/middleware/Oracle_WT1/instances/instance1/bin/opmnctl startall

  • 8/11/2019 53642 Cloud Apps

    23/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 23

    Once opmn is started you can use Enterprise Manager to start and stop your ohs instances butopmn must be started first.

    13. We are ready to start using the application.

    Start a browser instance, either in the guest operating system, or the host operating system willwork. Go to:

    http://YourIPAddress:7777/devday/faces/home.jspx

    14. Above is a screen shot of the application. Click around and explore the application, click the tabs,click the buttons in the department view, and select the employees in the table.

    For the purpose of the developer day you will see some key information in the header section:

    Number of Hits in this session This is the count of clicks you perform in the browser.

    Named server name This is the physical WebLogic server instance you are using in the cluster.

    Title Display the description of the application we are using.

    Make sure you stop and start the browser a few times to ensure you warm up both WebLogicManaged servers. Each time you restart the browser, the web server should load balance the

    request to another instance.

    http://youripaddress:7777/devday/faces/home.jspxhttp://youripaddress:7777/devday/faces/home.jspxhttp://youripaddress:7777/devday/faces/home.jspx
  • 8/11/2019 53642 Cloud Apps

    24/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 24

    Have a look around Enterprise Manager and the WebLogic Console you should find lots of usefulinformation regarding the use of your application.

    15. Failover

    Part of Grid is the ability to handle High Availability and deal with either physical server, orWebLogic server failure without disruption to the user community.

    Look at the server name you are currently using in the application.

    This will either be wlsdevManaged1, or wlsManaged2

    Find the terminal window that is running this instance and perform an uncontrolled shutdown press CTRL-C .

    What happens to the application?

    What has happened to the Number of Hits?

    What has happened to the Server Name?

    This doesn't look like Grid Qualities to us.......

  • 8/11/2019 53642 Cloud Apps

    25/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 25

    LAB 3

    Deploy the second version of the Application

    WebLogic server allows applications to be deployed and redeployed at run time; this means we can re-deploy the application without the need to bring the application servers down. This time we are going todeploy the second version of the application.

    The only difference in this version is the WebLogic web application deployment descriptor now has:

    REPLICATED

    false

    This version can be found at:

    /home/oracle/Desktop/InstallationFiles/Applications/WebApplication/v2

    1. If it's not already open, open a browser in the virtual machine and login to the WebLogic Console:

    http://:7001/console

    2. As before click Lock & Edit in the change center.

    3. This time we are going to Update the existing application that we deployed earlier.

    4. Select Deployments from the Domain Structure pane.

    5. Select the Check box next to the wlsdevday.ear, then click Update :

    6. This will take you to the Update Application Assistant ; you will see the path to the currentlydeployed application.

    Click Source Path, Change Path

  • 8/11/2019 53642 Cloud Apps

    26/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 26

    We need to the new version of the application, to do this click Upload your files

    Click Browse , next to the Deployment Archive input box. In the file upload dialog, navigate to:

    /home/oracle/Desktop/InstallationFiles/Applications/WebApplication/v2

    Select the EAR file called WLSDevDayApp.ear and click Open

    This should return you back to the main browser window.

    Click Next

    The next screen will show your EAR file, already checked.

    Click Next

    The next screen will show you the path to the uploaded EAR.

    Question: Have you noticed a difference between this deployment and the last?

    The next screen will allow you to review the changes you have made.Click Finish .

    As normal, click Active Changes in the Change Center.

    This will deploy the application to all managed servers in the cluster.

    The application will automatically be started since you are updating an existing application, rather thandeploying a new one.

    7. Fire up a Browser and go to the application:

    http://YourIPAddress:7777/devday/faces/home.jspx

    As before open and shut the browser a couple of times to ensure you see the application runningon both WebLogic Managed servers,

    As before perform an uncontrolled shutdown of the managed server that your browser is currentlyaccessing. Continue to use the application.

    What is different this time? And why?

    This is what we see as Grid like behavior. The application continues to run, without any disruption to theuser.

    http://youripaddress:7777/devday/faces/home.jspxhttp://youripaddress:7777/devday/faces/home.jspxhttp://youripaddress:7777/devday/faces/home.jspx
  • 8/11/2019 53642 Cloud Apps

    27/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 27

    LAB 4

    Automatically Starting and Stopping Managed Servers withNode Manager

    So far during the exercises we have been stopping and starting managed server instances manually byopening up a terminal window and typing in the appropriate command.

    WebLogic Server has a process called the Node Manager, Node Manager allows Managed Servers to bestarted remotely through the WebLogic Console, or Enterprise Manager. In the case of WebLogic Serverfailure, Node Manager can be configured to automatically restart the instance.

    In a typical production instance Node Manager will be configured to automatically start on the physicalservers, a script is created using the WebLogic Scripting Tool (WLST). This script will automatically start allof the WebLogic Servers instances on their appropriate physical servers (including the Admin Server).Remember right back at the beginning (pause for thought) we created a machine configuration calledwlsdevMachine ; we then targeted all 3 of our WebLogic Server instances to the machine. The machinesconfiguration points to the IP address and port of the running Node Manager on a physical server.

    1. Lets configure Node Manager:

    As previously mentioned, we shouldnt edit files inside the Oracle middleware home.

    Please copy:

    /u01/middleware/wlserver_10.3/server/bin/startNodemanager.sh

    to

    /u01/projects/wlsdevday/nodemanager/wlsdevdaynode/startNodemanager.sh

    Edit the copied file (nodemanager.sh) and change the line :

    NODEMGR_HOME="${WL_HOME}/common/nodemanager"

    To

    NODEMGR_HOME="/u01/projects/wlsdevday/nodemanager/wlsdevdaynode "

    We need to create properties file called nodemanager.properties , this file is created the first timeyou run Node Manager.

    Start Node Manager by executing the following script in a terminal window:

    /u01/projects/wlsdevday/nodemanager/wlsdevdaynode/startNodemanager.sh

    You will see that Node Manager has created a default nodemanager.properties file in

    /u01/projects/wlsdevday/nodemanager/wlsdevdaynode

    Open the property file, we now need to make some edits to the file.

    Locate StartScriptEnabled and change the value to True

    Locate StopScriptEnabled and change the value to True

    Locate CrashRecoveryEnabled and change the value to True

  • 8/11/2019 53642 Cloud Apps

    28/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 28

    Add the following 3 properties to the bottom of the file:

    RestartInterval =1000

    RestartMax=3

    DomainsDirRemoteSharingEnabled=true

    Save the file.

    Restart Node Manager by pressing CTRL-C in the terminal window and re-executing the NodeManager script.

    2. Now we need to enroll the wlsdevDomain we created earlier with this machine (server). This isntso important for a single server cluster, however, in the real world its important to enroll and makethe decision about access to the domain files.

    Ensure your Nodemanager and Admin Server are running before performing the next steps

    To do this we will using WLST (WebLogic Scripting Tool)

    In a terminal window type:

    /u01/middleware/wlserver_10.3/common/bin/wlst.sh

    Once WLST is running, connect to the Admin Server by typing:

    connect('weblogic','welcome1','t3://YourIPAddress:7001')

    Enroll the Nodemanager with the domain by typing:

    nmEnroll('/u01/projects/wlsdevday/domains/wlsdevDomain','/u01/projects/wlsdevday/nodemanager/wlsdevdaynode')

    To exit WLST type:

    exit()

    Now stop your Managed Servers (Either CTRL-C, through WebLogic Console or EnterpriseManager)

    Make sure you also restart the Nodemanager

    Now we need to start the Managed Servers, we can do this through WebLogic Console orEnterprise Manager. We'll use the WebLogic Console

    Login to the WebLogic Server console

    In the Domain Structure choose Environment / Servers then click on the control tab

    Click the check boxes next to wlsdevManaged1, and wlsdevManaged2 then click Start .Refresh the screen until both servers are started or click the circular arrows and the screen willcontinually refresh.

    You might want to check that your application is running ok.

    Now test that Node Manager will automatically restart a failed server.

    Note: This isn't quite as easy now; think about it, the Managed Servers are running as backgroundprocesses!!

    To kill one of the java processes open System Monitor . You'll find this under System /Administration on the menu bar of the desktop.

  • 8/11/2019 53642 Cloud Apps

    29/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 29

    Once the System monitor is running, click on the Processes tab. Click the View menu bar andcheck the Dependencies option.

    You should now be able to see the Java processes running under the node managers Javaprocess.

    Select one of the java processes underneath the startWebLogic.s processes, right click and killit....

    Go back to the WebLogic console, you should see that server status as Starting - Node Manageris automatically restarting the failed server.

    Note: If you used the End Process button then the server will be reported as SHUTDOWN and willnot restart. Why would this be? Have a look in your Node Manager terminal window; this may giveyou a clue.

  • 8/11/2019 53642 Cloud Apps

    30/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 30

    LAB 5

    Deploy the third version of the application withCoherence*Web for HTTP session management

    Whilst HTTP session replication is a powerful way to enable applications to continue running even in theevent of server failure, the main issue is that the HTTP session information is held in the JVM memory ofthe running WebLogic server. If your application has lots or users, and or large HTTP session objects thismeans the application server could soon run out of memory and therefore stop your applications fromscaling well. A solution to this problem is to off load the HTTP session management into an external Cache.

    In our case we are going to off load the HTTP sessions into Coherence. Version 3 of the application usesCoherence*Web to achieve this.

    Since this is the 3rd time of deploying the application the instructions for this are going to get slightly vague!We are hoping you have learned from performing the deployments above. If you are stuck, please refer tothe instructions above, or ask a friendly Oracle person.

    Since WebLogic Server 11g PS2 (10.3.3), Coherence is installed as part of WebLogic. Coherence is alsointegrated with the WebLogic Management console and Nodemanager. We are going to use thisintegration to configure, and start a Coherence Cluster.

    1. Login to the WebLogic Console

    Click on Environment / Coherence Clusters

    2. Create a new Coherence Cluster

    Make sure you have clicked Lock and Edit

    Click New in the Coherence Cluster table (as above in screenshot)

    Name: wlsdevdayCohCluster

  • 8/11/2019 53642 Cloud Apps

    31/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 31

    Click Next

    Enter Unicast Listen Address as You IP Address

    Unicast Listen Port as 8088

    Make sure Unicast Port Auto Adjust is checked

    Click Next and Target the Cluster at the wlsDevCluster

    Make sure you active your changes

    3. Create the Coherence Servers

    Login to the WebLogic Console (If youre not there already)

    Navigate to Environment / Coherence Servers

    Make sure you Lock and Edit , create a new Coherence Server

    Name: wlsdevCache1

    Machine: wlsdevMachine

  • 8/11/2019 53642 Cloud Apps

    32/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 32

    Cluster: wlsdevCohCluster

    Unicast Listen Address: Your IP Address

    Listen Port: 8088

    Unicast Port Auto Adjust: Checked

    Screen should look like this:

    Click Finish

    Repeat the steps above to create another new Coherence Server:

    Name: wlsdevCache2

    Machine: wlsdevMachine

    Cluster: wlsdevCohCluster

    Unicast Listen Address: Your IP Address

    Listen Port: 8088

    Unicast Port Auto Adjust: Checked

    Make sure you click Finish and Activate your changes

    In the List of Coherence servers, click on wlsdevCache1

    Click on the Server Start tab

    Enter into the Classpath

    /u01/middleware/coherence_3.6/lib/coherence.jar:

    /u01/middleware/coherence_3.6/lib/coherence-web-spi.war:

    /u01/middleware/modules/features/weblogic.server.modules.coherence.server_10.3.4.0.jar

  • 8/11/2019 53642 Cloud Apps

    33/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 33

    Enter into the Arguments

    -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml

    -Dtangosol.coherence.session.localstorage=true

    -Dtangosol.coherence.wka=YourIPAddress

    -Dtangosol.coherence.wka.port=8088

    Make sure you click Save and Activate your changes

    Please repeat the steps above for wlsdevCache2

    4. Start the Coherence Cluster

    To do this click on Coherence Servers under Environment

    Click the Control tab above the list of Coherence Servers

    You should now see a screen like this:

    Select one of the Coherence servers and click Start .

    Now start the other cache server.

    Congratulations, you now have a running Coherence Cluster

    5. Deploy the coherence-web-spi.war to the wlsdevCluster. This library enables Coherence to takecontrol of the HTTP sessions when requested by the Web Applications

    Go to the WebLogic Console

    In the Domain Structure , choose Deployments

    Click Lock and Edit

    Click Install

    In Current Location , navigate to:

    /u01/middleware/ coherence_3.6 / lib

  • 8/11/2019 53642 Cloud Apps

    34/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 34

    In the list of available deployments, choose:

    coherence-web-spi.war

    Click Next ,

    Install as a Library

    Target to the wlsdevCluster, Finish and make sure you activate your changes

    Question: Assuming your deployment completed, can you see the library in your deployments, ifyou can't, why not?

    6. Perform required change to WebLogic Servers setDomainEnv.sh script

    Before WebLogic Server is able to connect to the cluster, we need to edit the setDomainEnv.shscript and add:

    -Dtangosol.coherence.wka=YourIPAddress -Dtangosol.coherence.wka.port=8088

    Edit the file:

    /u01/projects/wlsdevday/domains/wlsdevDomain/bin/setDomainEnv.shSearch for the line

    EXTRA_JAVA_PROPERTIES="-Dcommon.components.home=${COMMON_COMPONENTS_HOME} -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=${DOMAIN_HOME} -Djrockit.optfile=${COMMON_COMPONENTS_HOME}/modules/oracle.jrf_11.1.1/jrocket_optfile.txt -Doracle.server.config.dir=${ORACLE_DOMAIN_CONFIG_DIR}/servers/${SERVER_NAME} -Doracle.domain.config.dir=${ORACLE_DOMAIN_CONFIG_DIR} -Digf.arisidbeans.carmlloc=${ORACLE_DOMAIN_CONFIG_DIR}/carml -Digf.arisidstack.home=${ORACLE_DOMAIN_CONFIG_DIR}/arisidprovider -Doracle.security.jps.config=${DOMAIN_HOME}/config/fmwconfig/jps-config.xml -Doracle.deployed.app.dir=${DOMAIN_HOME}/servers/${SERVER_NAME}/tmp/_WL_user -Doracle.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=${ALT_TYPES_DIR} -

  • 8/11/2019 53642 Cloud Apps

    35/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 35

    Djava.protocol.handler.pkgs=${PROTOCOL_HANDLERS} ${WLS_JDBC_REMOTE_ENABLED}${EXTRA_JAVA_PROPERTIES} -Duser.timezone=GMT"

    add the coherence properties, the line should now look like:

    EXTRA_JAVA_PROPERTIES="-Dcommon.components.home=${COMMON_COMPONENTS_HOME} -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=${DOMAIN_HOME} -Djrockit.optfile=${COMMON_COMPONENTS_HOME}/modules/oracle.jrf_11.1.1/jrocket_optfile.txt -Doracle.server.config.dir=${ORACLE_DOMAIN_CONFIG_DIR}/servers/${SERVER_NAME} -Doracle.domain.config.dir=${ORACLE_DOMAIN_CONFIG_DIR} -Digf.arisidbeans.carmlloc=${ORACLE_DOMAIN_CONFIG_DIR}/carml -Digf.arisidstack.home=${ORACLE_DOMAIN_CONFIG_DIR}/arisidprovider -Doracle.security.jps.config=${DOMAIN_HOME}/config/fmwconfig/jps-config.xml -Doracle.deployed.app.dir=${DOMAIN_HOME}/servers/${SERVER_NAME}/tmp/_WL_user -Doracle.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=${ALT_TYPES_DIR} -Djava.protocol.handler.pkgs=${PROTOCOL_HANDLERS} ${WLS_JDBC_REMOTE_ENABLED}${EXTRA_JAVA_PROPERTIES} -Duser.timezone=GMT - Dtangosol.coherence.wka=YourIPAddress -Dtangosol.coherence.wka.port=8088"

    If your Managed Servers are running, at this point its importa nt that you restart them to pick up the parameters youve just added to the setDomainEnv.sh script.

    7. You might want to tail the Coherence logs to see whats going on

    You might want to tail the Coherence Servers log file to see whats going on, its quite us eful to lookat this information.

    Hint : The nodemanager output will tell you the location of the log files. Use the Linux tail fcommand to view the log in real time.

    2010-09-20 15:56:28.638/7.061 Oracle Coherence GE 3.5.3/465 (thread=DistributedCache:DistributedSessions, member=2): Asking member 1 for 128 primarypartitions

    member 2 is the second Coherence node to join the cluster.

    8. Now deploy v3 of the application. If you get stuck refer to the deployment of v2 of the application.

    or

    If you really want to take a walk on the wild side, why not try the deployment through EnterpriseManager rather than WebLogic Server Console.

    Access the application by using the same URL as before:

    http://:7777/devday/home.jspx

    9. Let do some testing

    As before, close the browser a couple of times to make sure you warm up the web application onboth WebLogic Managed Servers.

    Perform an uncontrolled shutdown of the managed server currently holding your session, as beforeyou should failover to the other managed server.

    To perform the uncontrolled shutdown follow the procedure used when testing Nodemanagersability to restart a managed server.

    Hint: To identify the Managed Server you are currently using, In the system monitor window, rightclick on the startWebLogic.s process, choose Open Files , scroll to the right and you should beable to identify the managed server by its log file,

    Note : Make sure you kill the java process

  • 8/11/2019 53642 Cloud Apps

    36/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 36

    Lets test Coherence out.....

    Having failed over, now perform an uncontrolled shutdown of the other managed server.

    Why does the WebLogic Server keep restarting? You might need to perform these operations fast,or alternatively shutdown the WebLogic Managed Servers cleanly (How could you do this?)

    You should now have no managed servers running.

    In the WebLogic Console, under Coherence Servers, clone one of the cache servers. Do this bycreating a Lock and Edit session, in the table of Coherence Servers, put a tick in one of the CacheServers check boxes, and Clone .

    Start the newly clone Cache server.

    One at a time, shutdown the original Cache Servers (There are now no original servers running),and restart at l east one of the managed servers (If they didnt automatically restart)

    Note: Please leave at least one Coherence cache server running or you are asking for miracles!

    Once your managed server(s) are running again, continue to use the web application The webapplication will remember your session state even though every JVM running before the failureshave been restarted, and indeed a new cache instance created on the fly Thats application grid!

  • 8/11/2019 53642 Cloud Apps

    37/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 37

    LAB 6

    Deploy Fourth version of the Application Includes JavaMessage Service Configuration.

    This version of the application has a Java Message Service (JMS) producer. Another tab is introduced intothe application that will allow you to send JMS messages. This tab also contains a table of processedmessages, t he browser displays the messages that were processed by the message driven bean. TheEnterprise Application that we will deploy later has the JMS Message Driven Bean in, this bean reads theJMS message and stores the message along with the managed server that processed it onto a database.

    1. This version of the application starts to introduce a concept called side by side deployment (we'lltalk more about this later). This means we have to put a version annotation into the EAR's manifestfile. WebLogic server does not allow you to change the versioning strategy using hot deployment.So as an example if you have an unversioned application and want to deploy a versioned copy,you will have to undeploy the original first, you cannot update or hot deploy.

    So you will now have to undeploy the currently deployed Coherence version.

    2. To undeploy the application, stop all the managed servers through the WebLogic Console.

    3. Go to the WebLogic Console ( http://:7001/console ) and delete the wlsdevdayapplication. To do this click Lock and Edit in the change center, make sure you are viewing the listof deployments, click the check box next to the application, and click Delete .

    Don't forget to activate your changes.

    4. At this point you can restart your managed servers.

    5. Deploy the 4 th version of the application to the wlsdevCluster , you can find this version at:

    /home/oracle/Desktop/InstallationFiles/Applications/WebApplication/v4

    Hint: This time you will need to install the application, rather than update the application ( not theone called JMSConsumer.ear).

    6. Make sure the application is running and working correctly by going to URL:

    http://:7777/devday/faces/home.jspx

    (Do not try and send a message, we haven't configured JMS yet)

    We will now use the WebLogic console to configure JMS, this is performed under Services /Messaging . See screenshot below:

  • 8/11/2019 53642 Cloud Apps

    38/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 38

    7. We need to create 2 JMS servers, one for each Managed Server

    Click on JMS Servers (Make sure you have clicked Lock & Edit and look for the arrow or expandmessaging in the Domain Structure window)

    Click New

    Enter JMS Server Name as: JMSDevDayServerMS1

    Click Create a new Store Button

    8. Choose a type of File Store from the selection box and click Next Name = MS1

    Target to wlsdevManaged1(migratable)

    Directory = /u01/projects/wlsdevday/jmsjta/wlsdevdaynode/ms1

    Click OK

    Select the Persistent store that you just created as per the screen shot below:

  • 8/11/2019 53642 Cloud Apps

    39/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 39

    Click Next

    Target the JMS Server to wlsdevManaged1(migratable)

    Click Finish

    9. Create a new JMS Server following exactly the same procedure as above, except..... :

    Replace JMS Server Name with: JMSDevDayServerMS2

    Persistent Store Name: MS2

    Target the persistent store to wlsdevManaged2(migratable)

    Directory = /u01/projects/wlsdevday/jmsjta/wlsdevdaynode/ms2

    Make sure you select the newly create MS2 persistent store for the JMS ServerJMSDevDayServerMS2

    Target the JMS Server to wlsdevManaged2(migratable)

    10. Active your changes, your JMS Server list should now look similar to the image below (You willonly have 2 JMS Servers though):

    11. We are now going to create a JMS Module to hold our Connection Factory and Queue

    To do this, go back JMS Service Summary

  • 8/11/2019 53642 Cloud Apps

    40/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 40

    Select JMS Modules

    Create a new JMS Module

    Note: If you are interested a JMS Module and Subdeployment can be used to group resources, includingqueue and topic destinations, connection factories, JMS templates, destination sort keys, destination quota,distributed destinations, foreign servers, and store-and-forward parameters. Consider how much easier it isto manage and deploy using a Module and Subdeployments rather than remembering the relationshipsbetween the JMS resources you are creating and their targeting.

    Call the JMS Module jmsDevDayModule ,

    Click Next

    Now target the module to the cluster.

    Check the box next to Would you like to add resources to this JMS system module? and clickFinish

    You should now see a screen like the one below:

    Click New to add artefacts to the module

    Select the Connection Factory radio button and click Next

  • 8/11/2019 53642 Cloud Apps

    41/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 41

    Connection Name: DevDayCF

    Connection Factory JNDI name: DevDayCF

    Click Next

    Click on the Advanced Targeting (all will become clear later!)

    Click on Create a new Subdeployment

    Name: DevDaySub

    Click OK

    Target the subdeployment to both JMS Servers

    Click Finish

    Now we need to create a queue in the JMS Module, this Queue will be a Distributed Destination,

    and this means the queue will run across the whole cluster.In the JMS Module settings, click New

    Check the Distributed Queue radio button and click Next

    Queue Name: DevDayQueue

    Queue JNDI name: DevDayQueue

    Make sure Destination Type is Uniform.

    Your distributed queue configuration should look like below:

  • 8/11/2019 53642 Cloud Apps

    42/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 42

    Click Next

    Click Advanced Targeting , and choose the Subdeployment created earlier (DevDaySub)

    Click Finish

    Active your changes

    We now need to deploy the JMS Consumer EAR. Follow the same procedure as before to deploythe application. You'll find the application here:

    /home/oracle/Desktop/InstallationFiles/Applications/WebApplication/v4/

    The application is called JMSConsumer.EAR (use the knowledge you have gained on theDeveloper Day so far, to deploy the application).

    Once deployed, and activated test out the new capability in the Web Application.

    Click on the Send Message tab

    Enter some text in the input box and click Send Message

    NOTE: The Refresh Messages button isn't working correctly, you'll need to click the arrows a longside the column name to get the table to refresh.

  • 8/11/2019 53642 Cloud Apps

    43/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 43

    12. Having run this a few times (including closing your browser) you'll probably notice that the JMSconsumer managed server is the same as the Web applications managed server. This is becausethe connection factory, by default, is configured with server affinity (will always try the currentserver instance first), if you are interested, try see if you can change this behavior.

    To prove that the queue is actually clustered we can Pause the JMS servers message productionon WebLogic server, this will force the RMI client to transparently failover to the alternative server.

    To do this, make a note of the Managed server your web application is currently running on. Thiswill be either wlsdevManaged1 or wlsdevManaged2.

    Log in to the WebLogic Console.

    Navigate to the JMS servers (From the Domain structure, click Services / Messaging / JMS Servers

    Click on the corresponding JMS Server to the Managed server that your web application iscurrently running on. e.g. wlsdevManaged1 = JMSDevDayServerMS1

    Click Control

    Click the check box next to the JMS Server and then click Production / Pause

    This will stop the JMS server from being able to receive new JMS messages.

  • 8/11/2019 53642 Cloud Apps

    44/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 44

    Question: Why have you just stopped the producer and not the consumer?

    Go back to the Web Application, and Send another JMS Message.

    This time, you should see that the message was processed by the other managed server.

    Don't forget to resume message production on the JMS server otherwise this JMS server will juststay out of action

    13. Optional exercise

    You can also pause production and consumption on the individual queues that make up thedistributed destination. When pausing consumption you are also able to view the messages on thequeue.

    See if you can pause message consumption.

    See if you can view messages on the queue

    Note: if you do this exercise, don't forget to resume message consumption.

  • 8/11/2019 53642 Cloud Apps

    45/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 45

    LAB 7

    JMS automatic singleton service migration

    Some of the services offered by WebLogic server operate as singleton services. These are typically JMSqueues, and the transaction logic. To avoid JMS messages and/or transactions being stuck on a failedWebLogic Server, the Cluster can automatically fail these services over to another healthy runninginstance.

    Just for your interest, the singleton service capability of WebLogic Server is a published API that you couldimplement in your application. If you have a requirement for one instance of a service executing in theenvironment, but still want HA capabilities then the API will allow you to achieve this. A good example ofthis is a file poller, if you were to write a simple file reader service, reading files from shared storage, thenfor ease of development you might choose to use the singleton service API to ensure you only have oneservice reading the files. Then if you suffer a failure you would probably want this service to failover toanother healthy instance of WebLogic Server.

    Since we are only running two managed servers and to avoid confusion we will reconfigure our JMS queueto be a single queue pinned to a managed server. Single service migration is supported for DistributedQueues, but in our case this would be both instances of the queue running on the same WebLogic Serverinstance confusing, it would be!

    1. Force the deployment JMSConsumer (V4.JMSConsumerV4) to stop. This is because it iscurrently bound to the JMS Queue and we are about to reconfigure this Queue.

    Go to the list of deployments; check the check box next to V4.JMSConsumerV4.

    Click Stop / Force Stop Now

    2. Go to the JMS Module jmsDevDayModule and delete the distributed queue called DevDayQueue

    Activate your changes

    3. In the same JMS Module, create a new Queue called DevDayQueue :

    Name: DevDayQueue

    JNDI Name: DevDayQueue

    Click Next

    Create a new subdeployment called DevDaySingle and target this to JMS ServerJMSDevDayServerMS1

    Click Finish

    Active your changes

    Restart the deployment JMSConsumer (V4.JMSConsumerV4 by going back to the Deploymentslist.

    Click the check box next to the deployment and click Start / Servicing All Requests

    You will see a Warning next to the application, this is because the MDB is configured only to bindto local queues, therefore the instances running on wlsdevManaged2 are currently not bound to aqueue.

  • 8/11/2019 53642 Cloud Apps

    46/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 46

    Send a test message to the application to make sure the queue is deployed correctly.

    4. Set up Consensus Based leasing. Leasing in the cluster allows one instance of WebLogic Serverto have exclusive ownership of the singleton service (in this case the JMS Queue). Leasing is usedfor both service migration and whole server migration.

    WebLogic Server has two strategies for leasing;

    Consensus based leasing.

    With Consensus based leasing, one cluster member becomes the cluster master responsible for managingthe leasing table in memory (this leasing table is replicated in memory to another instance for failover).Consensus based leasing requires the use of Node Manager.

    Database leasing

    With Database leasing, the leasing table should be stored on a highly available database, such as OracleRAC. Database leasing does not rely on Node Manager, but does required more configuration.

    In the Domain Structure panel, choose Environment / Clusters , and then click on thewlsdevCluste r.

    Click on Migration and click Lock & Edit

    In Candidate for Migration Servers move the wlsdevMachine to the chosen box.

    Change the Migration Basis selection box to Consensus

    Click Save and active changes

    At this point you will need to shut down your managed services and Admin Server, and then restartthem.

    Note: Make sure you use Node Manager to start the Managed Servers via one of the consoles

    They will not restart themselves as they have been shutdown gracefully.5. Remove JMSDevDayServerMS2 , we will only be hosting the queue on one JMS server with

    service migration; therefore this JMS server is not required.

    Untarget JMSDevDayServerMS2 from the Subdeployment DevDaySub

    To do this, in the Domain Structure panel, click Services / JMS Modules / jmsDevDayModule (inthe table)

    Click on Subdeployments

    Click on DevDaySub

    Uncheck the check box next to JMSDevDayServerMS2

    (Remember to activate your changes)

    Now we can delete the JMS Server JMSDevDayServerMS2

    Click Lock & Edit

    In the Domain Structure panel, click Services / JMS Servers

    In the table click the check box next to JMSDevDayServerMS2 and click Delete

    (Remember to activate your changes)

    Restart the Managed Servers

    6. Before we define automatic service migration for the JMS Server, we need to untarget them.

    To do this click Lock & Edit

  • 8/11/2019 53642 Cloud Apps

    47/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 47

    In Domain Structure panel, click Messaging / JMS Server

    Click JMSDevDayServerMS1 and untarget it. To do this click on Target tab and change theselection box to None and click Save .

    7. Configure the Managed Servers for Service MigrationClick Lock & Edit

    In the Domain Structure panel click Environment / Servers

    Click on wlsdevManaged1

    Click on Migration

    Make Sure that Auto matic Server Migration Enabled is NOT checked this will require furtherconfiguration, we havent got time for this today.

    Move wlsdevMachine to chosen on Candidate Machines

    Move wlsdevManaged1 and wlsdevManaged2 to chosen on JMS Service Candidate ServersRepeat these steps for wlsdevManaged2

    Active Changes and restart the Managed Servers using the WebLogic Console

    8. Configure the Migratable targets as Automatic Click Lock & Edit

    In the Domain Structure pane click Environments / Migratable Targets

    Select wlsdevManaged1 (migratable)

    Click on Migration

    In the Selectbox change the Manual Service Migration Only to Auto-Migrate Exactly-OnceServices . This setting ensures that the JMS Server will be running on only one Managed server.

    Note: The preferred server; this is where the JMS Server will prefer to run but not necessarilywhere it will run!

    Repeat steps for wlsdevManaged2 (migratable)

  • 8/11/2019 53642 Cloud Apps

    48/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    http://www.oracle-developer-days.comCopyright 2009 - 2012, Oracle and/or its affiliates. All rights reserved 48

    Active Changes

    9. Target the JMS Servers again

    Lock & Edit

    In the Domain Structure Pane select Services / Messaging / JMS Servers

    Select JMSDevDayServerMS1

    Click on Targets

    Target the JMS Server to wlsdevManaged1 (migratable)

    Activate Changes.

    If your Managed Servers are running, restart them using the WebLogic Console.

    10. Check to see what managed server the migratable targets are running on.

    Whilst we created a preferred server, if the other server comes up first, it will get the lease for theservice.

    To do this, in the Domain Structure pane click on Environment / Migratable Targets

    Click on Control

    You should now be able to see the list of migratable targets.

    If wlsdevManaged1 (migratable) is current hosted on wlsdevManaged2 then perform a manualmigration to move it to wlsdevManaged1

    Note: You might see WebLogic Server console present an error, just refresh the screen and themigration should succeed.

    11. Test the application.Send some JMS Messages, through they could only ever be processed by wlsdevManaged1

    12. Lets test Automate migration.

    Pause Consumption of messages on the queue DevDayQueue

    To do this, from the Domain Structure choose Services / Messaging / JMS Modules

    Click on the jmsDevDayModule

    Click on the queue name DevDayQueue

    Click on Control and pause message consumption

    Go back to the application and send a couple more messagesGo back to the console and click the monitoring tab you should see your messages on thequeue.

    Shutdown wlsdevManaged1.

    Go back to your application, refresh the message table, you should now see the messages fromthe queue have now been processed on wlsdevManaged2.

    Restart the Managed server

  • 8/11/2019 53642 Cloud Apps

    49/49

    Oracle WebLogic Suite: Application Grids, Virtualisation and Clouds

    LAB 8

    Side by Side Deployment

    As you have gone through the exercises you may have noticed that deploying the new versions of theapplication is actually pretty disruptive to the users. Whilst we can redeploy the application without anyproblems there are quite large consequences for users who are currently using the system. Any userscurrently using the application will be thrown out of their session (we have already seen the ramifications oflosing our session), if the application required the user to login, they would have to login into the applicationagain, and any work they were doing would be lost. This of course is assuming that the new version goesinto the live environment correctly. For these reasons most customers will incur controlled downtime to

    upgrade the application, therefore avoiding the loss of work, but incurring downtime to the application.Side by Side deployment in WebLogic Server is a capability that lets you deploy the application intoproduction; make it available only to administrators (so they can test it, whilst the users continue to use theold version). Once the administrators are happy that the application is working they can put it live, and theusers will gradually migrate from the old version to the new version. The users will continue to use the oldversion until their session ends, either from shutting the browser, logging off, or hitting the timeout thresholdfor the old version of the application).

    1. Make sure you have the application open in a Browser; if possible try to run the Browser on thehost system. You should note that the application you are running says v4 in the Header.

    2. Lock & Edit

    3. Go to the WebLogic console and click on Deployments in the Domain Structure Pane

    Choose to update the application called WLSDevDayApp (V4.WithHTTPSessionAndJMSV4)

    As previously done, we need to Upload the new version of the application by clicking on ChangePath , then clicking the upload your file(s) anchor.

    The application to upload is in the folder:

    /home/oracle/Desktop/InstallationFiles/Applications/WebApplication/v5 /

    still called WLSDevDayApp.EAR

    As you click through the screens, you should notice that this is versionV5.WithHTTPSessionAndJMSV5

    You should also note the retire strategies we'll stick with the default one.

    Make sure you click Finish , then active your changes.

    When you look in the list of deployments, you should now see 2 versions of the same application.

    The old version will change to Stop running

    The new version will change to Active

    If you go back to the Browser, you can continue to use the application, and this is still v4.

    If you open the Browser within the virtual machine, and go to the application. You should see that