For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

How to Deploy Code With UriDeploymentSpi

Deploy and redeploy Java compute tasks, services, and POJOs to a running GridGain 8 cluster without restarting nodes, using UriDeploymentSpi.

Prerequisites

  • A running GridGain 8 cluster

  • A network folder accessible by all cluster nodes

  • JDK 17 and Maven to build the deployment JAR

Overview

"Deploying code" means putting your application code in a remote environment where your app can run and serve your users. In Java, you usually deploy your app code by yourself, by updating the classpath and restarting the application to apply the changes.

Some web servers, such as TomCat, can deploy web applications using JAR and WAR files. When these files are updated, they deploy a new version of the web application without restarting the entire web server.

You can use a similar concept in Java. The Java classloaders feature enables you to load classes from different sources. By default, all the classes are loaded from the system classloader, which usually gets classes from the application classpath. However, it is possible to load classes that are not included in the JAVA classpath from another location.

With UriDeploymentSpi, you can deploy new versions of Java classes used by GridGain. This lets you update your Java classes without having to restart the Java application that runs the GridGain server.

What can be Deployed via UriDeploymentSpi

Unfortunately, not everything can be deployed via UriDeploymentSpi. Here is the list of supported items:

  • GridGain compute tasks

  • GridGain services

  • Java POJO that aren't included in the classpath

This guide reviews all the relevant cases.

GridGain Configuration

Every GridGain node should have UriDeploymentSpi configured as follows:

You need to prepare two folders:

  • temporaryDirectoryPath - GridGain will unzip the new classes here for further loading

  • uriList - set of URI addresses to be scanned for JARs

You are advised to use a network folder which all nodes can access inside uriList. It will help avoid the situation where different nodes have different versions of the classes.

Note the freq=2000 parameter. Its value, in milliseconds, defines how often the location will be checked for new classes. You can set this parameter to a low value to avoid delay in class loading. The default is 5000 ms for the file: scanner and 300000 ms for the HTTP scanner (http: and https:).

Out of the box, this SPI supports the following protocols:

  • file: - file protocol

  • http: - HTTP protocol

  • https: - secure HTTP protocol

UriCodeDeployment Limitations

UriDeploymentSpi has the following limitations:

  • You must prepare JAR files that contain all the related classes together (constructor parameters, classes used in compute tasks and services, etc.).

  • Each JAR file must contain the ignite.xml file that lists the names of all the deployed classes. Otherwise, only compute tasks will be deployed.

  • All nodes should use the same URI location to avoid delays when updating the scannable files.

  • Service redeployment relies on the event-driven service processor, which is enabled by default. Set -DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=false only if you want to turn it off, and note that redeployment then does not work.

  • You cannot have the same class in the JVM classpath and in UriDeploymentSPI. In such a case, the JVM one will be used because Java does not allow multiple versions of the same class.

Prepare the JAR File

Your JAR must have the following structure:

To build a JAR with the above structure:

  1. Create a Maven project with the following pom.xml:

  2. Inside the Maven resources folder, create the META-INF/ignite.xml file with the following content:

  3. Create a network folder (common for all hosts) named deployment_folder.

  4. On every host, create a tmp folder named tmp_folder.

  5. Build your project with the mvn clean package command.

  6. Put the generated JAR into deployment_folder.

Add the ignite-urideploy Dependency

The ignite-urideploy dependency is optional. This is why you need to add it explicitly, in one of the following ways:

  1. If you run the node from the binaries, copy the ignite-urideploy dependency from optional libraries:

  2. If you use Maven, add the ignite-urideploy dependency to pom.xml:

Now you can start your server node and use the classes from deployment_folder as described below.

How to use the Deployed Classes

POJO Classes

In Java, to use classes that are not included in the classpath, you have to load them from a special classloader. UriDeploymentSPI has its own classloader that you can get like this:

The limitation of the above approach is that you need to use the Java reflection to create objects and work with them. This can be a little tricky. For example, here is the code where you create a ModelClass object and call its method:

However, typically you only need to use this approach for POJO classes and services if you intend to deploy them from your code. Compute tasks can be deployed by name. Services can also be deployed using compute tasks.

Compute Tasks

Here is how you can deploy a compute task:

Compute tasks can be loaded by name. See example of this compute task in the sample project.

Services

You can deploy services in two ways:

  1. From the compute task called by name:

  2. Using a reflection:

This page is: Copyright © 2026 MariaDB. All rights reserved.

Last updated

Was this helpful?