Files Prepare Deploy Troubleshooting Related Topics
Managed Coherence Servers provide a tight integration between WebLogic Server and Coherence, allowing for a simplified and streamlined development and management environment for distributed applications. The functionality allows you to build an archive type, called a Grid Archive (GAR), which can be deployed and managed on WebLogic Server in a manner similar to other Java EE artifacts. Developers can now streamline their build artifacts to generate GARs, and the operations departments can have a standardized way of deploying Coherence in the test and production environments.
This example builds a single Administration Server, configures it for Coherence, and deploys the following artifacts:
ExampleGAR.gar
- A GAR containing the classes and configuration required to access Coherence.
ExampleEAR.ear
- An EAR containing the preceding GAR and a WAR file with a simple application to exercise Coherence.
ExampleListenerEAR.ear
- An EAR containing the preceding GAR and an EJB with a MapListener
configured to listen on events in Coherence.
Directory Location: D:\Oracle\Middleware\Oracle_Home\wlserver/samples/server/examples/src/examples/coherence/managed-coherence-servers/single-server
directory.
Grid Archive (GAR) Components | |
DataGenerator.java | Class that generates random contacts. |
Contact.java | Class that defines a contact. |
ContactId.java | Class that defines the key for a contact. |
Address.java | Class that defines an address for a contact. |
PhoneNumber.java | Class that defines a contact. |
LifecycleReactor.java | Class that defines actions that can be invoked pre/post startup and shutdown of the Managed Coherence Server. |
coherence-application.xml | GAR-specific deployment descriptor that contains a pointer to the cache configuration and a number of optional components. |
example-cache-config.xml | Oracle Coherence cache configuration file used in this example. |
Web Archive (WAR) Components | |
ContactComparator.java | Comparator to order the list of contacts. |
ContactBean.java | Bean to hold the state of the current contacts. |
CacheControlBean.java | Bean to hold the logic for controlling page navigation and validation. |
ReferenceDataBean.java | Bean to hold the reference data for the application. |
ContactList.jsp | JSF page to display contact list. |
ContactDetail.jsp | JSF page to insert or update a contact. |
Example.css | Stylesheet. |
Oracle_3d_v3.jpg | Oracle Logo. |
web.xml | web.xml file to define JSF mappings. |
EJB Components | |
SingletonFileWriterStartupBean.java | EJB 3.1 singleton to be initiated on Managed Coherence Server startup to add MapListener to contacts cache. |
ContactFileWriterListener.java | The MapListener called by the singleton EJB to log insert, update, or delete events on the contacts cache to a file. |
Before working with this example, install Oracle WebLogic Server, including the examples, if you have not already done so.
No special configuration is required for this example.
To build the example, complete the following steps:
ORACLE_HOME/wlserver/server/bin
directory, where ORACLE_HOME represents the central support directory for all WebLogic products installed on a machine; for example, c:\Oracle\Middleware\Oracle_Home
.
. ./setWLSEnv.sh
setWLSEnv.cmd
D:\Oracle\Middleware\Oracle_Home\wlserver/samples/server/examples/src/examples/coherence/managed-coherence-servers/single-server
directory.ant all
Using the command shell from which you built the example, complete the following steps:
ant deploy
ORACLE_HOME/user_projects/domains/single_domain
weblogic
. (Note that the password is echoed in the command shell.)The ant task automatically does the following:
[wldeploy] Task 1 completed: [Deployer:149026]deploy application ExampleEAR on AdminServer. [wldeploy] Target state: deploy completed on Server AdminServer [wldeploy] [echo] [echo] Application is now deployed. To access the sample application, go to the following URL: [echo] http://hostname:7001/example-web-app [echo] [echo] To access the AdminServer console, go to the following URL: [echo] http://hostname:7001/console [echo] [echo] To shutdown the server, run "ant shutdownSingleServer" or shutdown from the Admin console.
To run the example and view the GAR deployment artifacts, complete the following steps:
hostname:port/example-web-app
The string hostname:port corresponds to the machine host name and listen port you specified when you ran the deployment ant task.
The Web application UI is displayed in the browser. This is a simple Contacts application which stores its data within a Coherence cache.
LifecycleReactor.java
class above) hostname:port/console
weblogic
and the password you specified when deploying the example.ExampleEAR
contains two modules:
ExampleGAR
WebApp
ORACLE_HOME/user_projects/domains/single_server
directory in the command shell from which you deployed
the example, and view information about the changes to the data that are appended to the file ContactFileWriterListener.log
.
To shut down the WebLogic Server instance in which this example is running, do one of the following:
D:\Oracle\Middleware\Oracle_Home\wlserver/samples/server/examples/src/examples/coherence/managed-coherence-servers/single-server
directory and enter the following command:ant shutdownSingleServer
(Internet connection required.)
Copyright © 2012, 2020, Oracle and/or its affiliates. All rights reserved.