Starting with Oracle Coherence and Incubator projects

I had a chance to play with Oracle Coherence and even when everything seems to be documented, it took me a while to find all necessary informations to really get started, so I decided to share my steps. The main goal of this HOWTO will be building all samples from Coherence Incubator project, branch develop-12 (requires latest Coherence – 12.1.2).

Getting Coherence

Coherence 12.1.2 can be downloaded from [here]. I’m using stand-alone install, but I’m pretty sure that everything should be mostly the same (from Coherence point of view). Downloaded zip archive contains coherence_121200.jar, so lets execute that. Oh, and I almost forgot – I’m using Java 8:

$ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

And I’m on Mac OS X 10.9.2 (latest Mavericks). Installation process is pretty straightforward, you just execute java -jar ./coherence_121200.jar and use the wizard to install what you need. I choose samples to be included, but I won’t be referring to them in this post. Remember where you set your Oracle Home directory, it contains all the installed artefacts and we need to use it in next step.

Let’s assume the installation is done without any issues (I did not experienced any) and we are in Oracle_Home directory somewhere on our file system. Another thing I forgot to mention – you will need Apache Maven to be able to compile/execute projects from Incubator. I have Maven 3.1.1:

$ mvn -v
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200)
Maven home: /Users/pavel/opt/apache-maven-3.1.1
Java version: 1.8.0, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"

Following information is taken from document available here:

Firstly, you need to install oracle-maven-sync plugin. It will install Coherence into your local maven repository. It is capable to publishing these artefacts to your company maven repository or something like that, but that won’t be covered here. Please see linked document to see more details about it if required.

The plugin gets installed by executing following command:

mvn install:install-file -DpomFile=./oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.2/oracle-maven-sync.12.1.2.pom -Dfile=./oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.2/oracle-maven-sync.12.1.2.jar

I assume that this command is executed from Oracle_Home directory. You will need to adjust paths if that is not your case. Then you should see something similar to:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /Users/pavel/coherence/Oracle/Middleware/Oracle_Home/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.2/oracle-maven-sync.12.1.2.pom to /Users/pavel/.m2/repository/com/oracle/maven/oracle-maven-sync/12.1.2-0-0/oracle-maven-sync-12.1.2-0-0.jar
[INFO] Installing /Users/pavel/coherence/Oracle/Middleware/Oracle_Home/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.2/oracle-maven-sync.12.1.2.pom to /Users/pavel/.m2/repository/com/oracle/maven/oracle-maven-sync/12.1.2-0-0/oracle-maven-sync-12.1.2-0-0.pom
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.349s
[INFO] Finished at: Fri Mar 21 15:26:37 CET 2014
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------

Now we are ready to install Coherence binaries to our local maven repository:

Oracle_Home $ mvn -X -Doracle-maven-sync.oracleHome=.  -Doracle-maven-sync.testingOnly=false

Output is quite long, but if you see “BUILD SUCESS”, you can be sure that coherence jars are now installed in local maven repository. If there is some error, it is most likely related to incorrect directory, so try to play with “-Doracle-maven-sync.oracleHome” property and get it right.

Getting Coherence Incubator projects

This is an easy part. Coherence incubator is hosted on github – you obviously need git for that.

git clone

thats it. Git created directory coherence-incubator where all the projects are. Little inconvenient is that the version which we want to get is in the branch, so we need to execute:

git checkout origin/develop-12 -b develop-12

Previous command checkouts remote branch “develop-12″ and saves it as local branch with the same name. It is not a must to create local branch, but it is easier to deal with that. Also, we will need to make some changes to get it running and you can store then in your local branch.

I’m not exactly sure why, but the project references Coherence version 12.1.2-0-1, but oracle-maven-sync plugin installs version 12.1.2-0-0, so the project can’t compile without modifications. Also, coherence-jvisualvm references binaries deployed on netbeans maven repository which is not mentioned anywhere, so we need to add it for maven to be able to download these dependencies. My complete patch is:

diff --git a/pom.xml b/pom.xml
index 785741e..c4d951a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -137,11 +137,18 @@
-        <oracle.coherence.version>12.1.2-0-1</oracle.coherence.version>
+        <oracle.coherence.version>12.1.2-0-0</oracle.coherence.version>
+    <repositories>
+        <repository>
+            <id>netbeans</id>
+            <url></url>
+        </repository>
+    </repositories>

Now, we are finally ready for

mvn -fae clean install

The “-fae” is here for trying to build everything possible, even when some project fails to build or test, which unfortunately happens. See my current results:

[INFO] Coherence Incubator ............................... SUCCESS [1.284s]
[INFO] Coherence Incubator Common ........................ SUCCESS [30.717s]
[INFO] Coherence Incubator Command Pattern ............... SUCCESS [7.556s]
[INFO] Coherence Incubator Command Pattern (examples) .... SUCCESS [3.357s]
[INFO] Coherence Incubator Functor Pattern ............... SUCCESS [3.828s]
[INFO] Coherence Incubator Functor Pattern (examples) .... SUCCESS [2.577s]
[INFO] Coherence Incubator JVisualVM Plugin .............. SUCCESS [18.846s]
[INFO] Coherence Incubator Processing Pattern ............ SUCCESS [14.535s]
[INFO] Coherence Incubator Processing Pattern (examples) . SUCCESS [2.018s]
[INFO] Coherence Incubator Messaging Pattern ............. SUCCESS [8.903s]
[INFO] Coherence Incubator Messaging Pattern (functional tests)  SUCCESS [1:52.155s]
[INFO] Coherence Incubator Event Distribution Pattern .... SUCCESS [44.490s]
[INFO] Coherence Incubator Push Replication Pattern ...... SUCCESS [2.198s]
[INFO] Coherence Incubator Push Replication Pattern (functional tests)  FAILURE [6:49.643s]
[INFO] Coherence Incubator Push Replication Pattern (examples)  SUCCESS [1.645s]
[INFO] Coherence Incubator Push Replication Pattern *Web (examples)  SUCCESS [0.013s]
[INFO] Coherence Incubator Web Server .................... SUCCESS [2.058s]
[INFO] Coherence Incubator Web Application ............... SUCCESS [6.210s]
[INFO] Coherence Incubator Web Application Test .......... FAILURE [1:27.214s]
[INFO] Coherence Incubator Distribution .................. SUCCESS [13.540s]
[INFO] Coherence Incubator Site .......................... SUCCESS [0.019s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:53.648s
[INFO] Finished at: Fri Mar 21 16:30:09 CET 2014
[INFO] Final Memory: 58M/210M
[INFO] ------------------------------------------------------------------------

Anyway, as you can see, most of the projects can compile and are working properly. I was interested mainly in Messaging pattern, which works as expected, so I did not do any further inquiries about in Replication pattern and Web app tests.

And that’s it. If you are interested in any of these patterns or project, see sources and tests, there are usually “hello world” like samples which are perfect for learning. Also, if you happen to discover the reason for test failures I’m getting, feel free to add comment or send me a note to pavel.bucek [at] and I’ll update the article.

This entry was posted in java and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>