29 Deploying Coherence REST

This chapter provides instructions for deploying Coherence REST to an embedded HTTP server, WebLogic server, and GlassFish server. Generic servlet container instructions are also provided.

The following sections are included in this chapter:

29.1 Deploying with the Embedded HTTP Server

Coherence provides two embedded HTTP servers that can be used to host RESTful Web services: com.tangosol.coherence.rest.server.DefaultHttpServer (backed by Oracle's lightweight HTTP server) and com.tangosol.coherence.rest.server.GrizzlyHttpServer (backed by Grizzly). See "Changing the Embedded HTTP Server" for details on changing the default HTTP server.

The HTTP server must be enabled on a Coherence proxy server. To enable the HTTP server, edit the proxy's cache configuration file and add an <http-acceptor> element, within the <proxy-scheme> element, and include the host and port for the HTTP server.

The following example configures the HTTP server to accept requests on localhost and port 8080.


The above configuration explicitly defines the HTTP server class and Jersey resource configuration class. However; these are default values and need not be included. See Oracle Coherence Developer's Guide for a detailed reference of all <http-acceptor> subelements.

29.2 Deploying to a Java EE Server

This section provides instructions for deploying Coherence Rest to a Java EE environment:

The following topics are included in this section:

29.2.1 Packaging Coherence REST for Deployment

To package a Coherence REST application:

  1. Create a basic Web application directory structure as follows:

  2. Copy the following JARs from the COHERENCE_HOME/lib directory to the /WEB-INF/lib directory:

    • coherence.jar

    • coherence-rest.jar

    • jackson-all-1.8.1.jar

    • jersey-core-1.7.jar

    • jersey-json-1.7.jar

    • jersey-server-1.7.jar

  3. Create a Web application deployment descriptor (web.xml) and include the following servlet definition:

          <servlet-name>Coherence REST</servlet-name>
  4. Save the web.xml file to the /WEB-INF/ directory.

  5. Copy the coherence-rest-config.xml file to the /WEB-INF/classes directory.

  6. Copy your coherence-cache-config.xml file and tangosol-coherence-override.xml file to the WEB-INF/classes directory.

  7. Create a Web ARchive file (WAR) using the jar utility. For example, issue the following command from a command prompt at the root of the Web application directory:

    jar -cvf coherence_rest.war *

    The archive should contain the following files


29.2.2 Deploying to WebLogic Server

To deploy Coherence REST to WebLogic server:

  1. Package Coherence REST as a WAR file as described in "Packaging Coherence REST for Deployment". To ensure the correct version of Coherence is used, add the following WebLogic-specific deployment descriptor to the /WEB-INF directory:

    <?xml version="1.0" encoding="UTF-8"?>
  2. Deploy the WAR using the WebLogic administration console (http://localhost:7001/console).

  3. From a browser, access the data in a Coherence cache by navigating to http://localhost:7001/{cacheName}.

29.2.3 Deploying to GlassFish

To deploy Coherence REST to GlassFish server:

  1. From GlassFish administration console, click Configuration->JVM Settings. switch to the JVM Options tab and add the following option:

  2. Click the JVM Options tab and add the following option:


  3. Package Coherence REST as a WAR file as described in "Packaging Coherence REST for Deployment". In addition, override the version of Jersey distributed in GlassFish with the version of Jersey distributed with Coherence REST by setting the class loader delegation to false in WEB-INF/sun-web.xml or WEB-INF/glassfish-web.xml. For example:

    <sun-web-app error-url="">
       <class-loader delegate="false"/>
  4. Deploy the WAR using the GlassFish administration console. (http://localhost:4848/).

  5. From a browser, access the data in Coherence caches by navigating to http://localhost:8080/{cacheName}.

29.2.4 Deploying to a Servlet Container

Coherence REST can be deployed to any servlet container by packaging Coherence REST as a WAR file. See "Packaging Coherence REST for Deployment" for details. Refer to your vendors documentation for details on deploying WAR files. In addition, See the Jersey user guide for additional servlet container deployment options: