By Ram V on Aug 02, 2013
OEPE 12c (12.1.2) release supports Coherence Grid Archives (GAR) application development and deployment to WebLogic Server 12c (12.1.2). A Coherence application is a set of artifacts packaged in a jar called Coherence Grid Archive (.gar), which can be deployed to WebLogic Server 12c as a stand-alone module or bundled in an EAR project. This tutorial demonstrates the various GAR features available in OEPE.
Development Environment Set-up
| OEPE 12c (12.1.2)
|| From OTN, download and extract OEPE
| Oracle WebLogic Server 12c (12.1.2)
|| From OTN, download and install WLS RT
GAR Project Configuration
Like in any application development, the first step is to create the project that contains required configuration files and libraries.
- Launch eclipse.exe and switch to a new workspace
- Switch to Java EE perspective
- A new wizard is provided to create GAR project
- From the File | New menu launch "Oracle Coherence Project"
- Type in a name, "GARDemo"
- Create a new 12.1.2 RT selecting WLS home (ex: C:\12.1.2-wls-home\wlserver)
- NOTE: You can create a standalone GAR project or bundle in an EAR
- For demo purpose, make sure to check "Add project to an EAR"
- On the project wizard, navigate to Library management page and note the listing of "Coherence Library in Fusion Middleware Install". And also the option to generate the required configuration files.
- Click Finish
- In project explorer, notice the generation of default coherence configuration files and library jars
- Also note the creation of sample web project that can be used as a view module
Configure Coherence project
- Download and extract CoherenceGARSource.zip to GARDemo | src folder (if required, refresh the project root)
- Define Application Lifecyle listener
- In Project Explorer, GARDemo | src | META-INF, double click on coherence-application.xml
- NOTE: The coherence application file is based on Sapphire based xml editor
- Check Application lifecycle listener, browse and select "LifeCycleReactor"
- Save and close coherence-application.xml file
- Configure Coherence Portable Object Format (POF)
- In Project Explorer, GARDemo | src, open pof-config.xml
- Copy-paste the content of <user-type> , <allow-intefaces> and <allow-subclasses> from sample file
- Save and close pof-config.xml file
- Export "Oracle Coherence Library"
- In Project Explorer, right click on GARDemo | Properties | Java Build Path & switch to "Order and Export" tab
- Make sure to select "Oracle Coherence Library"
- FYI: We will need the libraries to reference coherence classes in web project
- Click OK and dismiss the properties dialog
Configure Web project
- Add JSF Facet and define coherence deployment assembly
- In Project Explorer, right click on GARDemoWeb | Properties | Deployment Assembly
- Click Add and select GARDemo project
- NOTE: The coherence module is recognized as a GAR (.gar) project
- Click Apply
- On the properties dialog, select Project Facets and check JSF Facet version 2.1
- Click OK and dismiss properties dialog
- Download and extract CoherenceGARWebSource.zip to GARDemoWeb | src folder (if required refresh project root)
- Download and extract WebContent.zip to GARDemoWeb | WebContent folder
Deploy Coherence application
- In the Server view, create a new 12c server configuration
- NOTE: The server configuration wizard provides an option to create new domain
- Like any other JSP file, right click on ContactList.jsp and run on 12c server
- On the Browser, click on "Insert 20 Random Contacts" and generate contact list
- Optional: You can also exercise other operations, Create, Delete and Update Contact info
- In the Server view, right click on GARDemoEar and remove the project (un-deploy) from the server
GAR Deployment Support
- Similar to other Java EE module, the GAR project can be deployed in any of the three WLS supported modes
- Split source (default mode, also known as Virtual deployment)
- Exploded archive (packaged in a EAR)
- In addition to local server, the GAR project can also be deployed to remote server instance
Packaging GAR Project
- Similar to WAR, the GAR project can be added to WLS 12c instance as a stand-alone module (supported only in Exploded archive)
- In the above demo we packaged GAR module in an EAR project
- On creating GAR project bundled in an EAR, the weblogic-application.xml is auto configured with GAR module
- A validation in weblogic-application.xml ensures only one GAR module can be bundled in an EAR
- NOTE: As a special case, GAR project bundled in EAR can be deployed both as a stand-alone module and packaged in EAR
Export project as GAR module
- Similar to Web project .war file, a GAR project can be exported to a .gar file