Oracle WebLogic Server 12c (12.2.1): Deploying the MedRec Sample Application

 

Overview

Purpose

In this tutorial you learn to configure and deploy the Avitek Medical Records (MedRec) Sample Application to WebLogic Server 12c (12.2.1).

Time to Complete

Approximately 15 minutes.

Introduction

The MedRec sample application demonstrates aspects of the Java Platform, Enterprise Edition (Java EE) and MedRec is designed as an educational tool for all levels of Java EE developers. Configuring and deploying MedRec to WebLogic Server 12c (12.2.1) is a prerequisite for several other tutorials and this tutorial uses a single-server domain.

What Do You Need?

The following is a list of hardware and software requirements:

 

Starting the WebLogic Domain

  1. Open a secure shell terminal session to the Linux development machine and login as the oracle user.

  2. Change to the jrf_restricted_domain directory:
    [oracle@ol71 ~]$ cd /u01/wls1221/user_projects/domains/jrf_restricted_domain
  3. Execute the startWebLogic.sh script to start WebLogic Server:
    [oracle@ol71 ~]$ ./startWebLogich.sh
    After starting the WebLogic Server, it enters the RUNNING state:
    ...
    <Jul 30, 2015 2:20:43 PM MDT> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> <Jul 30, 2015 2:20:43 PM MDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>

    The WebLogic Server is ready for use in this tutorial.

 

Creating the Derby Database

  1. Open a secure shell terminal session to the Linux development machine and login as the oracle user.
  2. Change to the medrec database migration directory:
    [oracle@ol71 ~]$ cd /u01/wls1221/wlserver/samples/server/medrec/database-migration
  3. Edit the project.properties file:
    [oracle@ol71 ~]$ vi ../project.properties
  4. Add a line to the project.properties files to set the property db to derby:
    # --------------- infrastructure info -----------------
    
    database = derby
    db = derby
  5. Save the changes and quit the vi editor:
    # --------------- infrastructure info -----------------
    
    database = derby
    db = derby
    :wq
  6. Set your shell environment by sourcing the setExamplesEnv.sh file:
    [oracle@ol71 database-migration]$ . ../../setExamplesEnv.sh
    The script outputs that the environment has been set:
    Your environment has been set.
    [oracle@ol71 database-migration]$
  7. Execute the Ant target data.import to import the medrec application into the Derby database:
    [oracle@ol71 database-migration]$ ant data.import
    The script outputs that the build is successful:
    data.importer.run:
         [java] [EL Info]: server: 2015-07-30 14:43:23.222--Detected server platform: org.eclipse.persistence.platform.server.NoServerPlatform.
         [java] [EL Info]: server: 2015-07-30 14:43:23.299--ServerSession(1007880005)--Detected server platform: org.eclipse.persistence.platform.server.NoServerPlatform.
         [java] Jul 30, 2015 2:43:23 PM org.hibernate.validator.internal.util.Version <clinit>
         [java] INFO: HV000001: Hibernate Validator 5.1.3.Final
         [java] All the data has been imported successfully!
    
    BUILD SUCCESSFUL
    Total time: 5 seconds
    [oracle@ol71 database-migration]$
 

Creating the Derby Data Source

  1. Open a browser.
  2. In the browser navigate to http://localhost:7001/console.
  3. Open a terminal shell where the files are downloaded and where you want to install; in this exercise, /u01 is the location.

  4. Enter the Username and Password for this domain - this tutorial uses weblogic for the Username and welcome1 for the Password. Click Login.

    WebLogic Administration Console
    Description of this image
  5. In the Domain Structure pane, click Services and Data Sources.

    WebLogic Administration Console - Domain Structure Data Sources
    Description of this image

    The Summary of JDBC Data Sources displays.

    Summary of JDBC Data Sources
    Description of this image
  6. In the Summary of JDBC Data Sources, select Generic Data Source from the New drop down menu.

    Summary of JDBC Data Sources - New Generic Data Source
    Description of this image
  7. Enter MedRecGlobalDataSourceXA for Name, jdbc/MedRecGlobalDataSourceXA for JNDI Name, select Derby from the Database Type drop down menu and click Next.

    Create a New JDBC Data Source - JDBC Data Source Properties
    Description of this image
  8. From the Database Driver drop down menu, select Derby's Driver (Type 4 XA) Versions:Any and click Next.

    Create a New JDBC Data Source - Database Driver
    Description of this image
  9. Click Next.

    Create a New JDBC Data Source - Transaction Options
    Description of this image
  10. Enter medrec for Database Name, localhost for Host Name, 1527 for Port, medrec for Database User Name, medrec for Password, medrec for Confirm Password, and click Next.

    Create a New JDBC Data Source - Connection Properties
    Description of this image
  11. Click the Test Configuration button.

    Create a New JDBC Data Source - Test Configuration
    Description of this image
  12. The connection test succeeds. Click Next.

    Create a New JDBC Data Source - Test Configuration
    Description of this image
  13. In Select Targets page, click AdminServer and click Finish.

    Create a New JDBC Data Source - Select Targets
    Description of this image

    The domain changes activate.

    Summary of JDBC Data Sources - changes have been activated
    Description of this image
 

Deploying the MedRec Sample Application

  1. In the Domain Structure pane, click Deployments.

    weblogic administration console domain structure deployments
    Description of this image
  2. In the Summary of Deployments pane, click Install.

    weblogic administration console summary of deployments
    Description of this image
  3. Navigate to the path that contains the medrec.ear file; this tutorial uses /u01/wls1221/wlserver/samples/server/medrec/dist/standalone/medrec.ear. Select the medrec.ear file and click Next.

    install application assistant locate deployment to install
    Description of this image
  4. Select Install this deployment as an application and click Next.

    install application assistant install deployment as application
    Description of this image
  5. Enter medrec for Name and click Next.

    install application optional settings
    Description of this image
  6. Click Finish.

    install application assistant additional configuration
    Description of this image

    The deployment completes.

    application deploymnet settings
    Description of this image
 

Testing the MedRec Sample Application

  1. In the browser, navigate to the MedRec application URL, http://localhost:7001/medrec and click Getting Started!

    Welcome to the Avitek Medical Records application
    Description of this image
  2. In the Patient section of the page, click Login.

    MedRec application entrance for Administrators and Patients
    Description of this image
  3. Enter fred@golf.com for Email, weblogic for Password, and click Sign In.

    MedRec sign in with e-mail and password.
    Description of this image
  4. In the View Record Summary section of the page, click Go.

    MedRec Patient Summary
    Description of this image
  5. The records for the current patient displays. Click Logout.

    MedRec Patient Visit Records
    Description of this image
  6. Click Logout.

    Log out of the MedRec application
    Description of this image

    The deployed MedRec sample application test is successful.

 

Summary

In this tutorial, you learned to:

  • Create a Derby database for the MedRec Sample Application
  • Create and Configure a JDBC Data Source for the MedRec Sample Application
  • Deploy and Test the MedRec Sample Application

Resources

Credits

Version

  • 02-34-004-DeploySampleApplication