This is an automated email from the ASF dual-hosted git repository.
timoninmaxim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new e27482a327a IGNITE-26385 Add check for ignite-json module is enabled
with ignite-rest-http (#12464)
e27482a327a is described below
commit e27482a327a1ecc45b9a522a44c7e04d436e5948
Author: Andrey Nadyktov <[email protected]>
AuthorDate: Thu Nov 6 20:12:10 2025 +0300
IGNITE-26385 Add check for ignite-json module is enabled with
ignite-rest-http (#12464)
---
docs/_docs/quick-start/restapi.adoc | 2 +-
docs/_docs/restapi.adoc | 4 ++--
.../http/jetty/GridJettyRestProtocol.java | 23 ++++++++++++++++++++++
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/docs/_docs/quick-start/restapi.adoc
b/docs/_docs/quick-start/restapi.adoc
index 6dd2d135a27..0ab718c2263 100644
--- a/docs/_docs/quick-start/restapi.adoc
+++ b/docs/_docs/quick-start/restapi.adoc
@@ -29,7 +29,7 @@ include::includes/prereqs.adoc[]
include::includes/install-ignite.adoc[]
Once that's done, you will need to enable HTTP connectivity.
-To do this, copy the `ignite-rest-http` module from
`{IGNITE_HOME}/libs/optional/` to the `{IGNITE_HOME}/libs` folder.
+To do this, copy the `ignite-rest-http` and `ignite-json` modules from
`{IGNITE_HOME}/libs/optional/` to the `{IGNITE_HOME}/libs` folder.
== Starting a Node
diff --git a/docs/_docs/restapi.adoc b/docs/_docs/restapi.adoc
index 0409ed21223..0eb0f01a60e 100644
--- a/docs/_docs/restapi.adoc
+++ b/docs/_docs/restapi.adoc
@@ -22,8 +22,8 @@ Internally, Ignite uses Jetty to provide HTTP server
features. See <<Configurati
== Getting Started
-To enable HTTP connectivity, make sure that the `ignite-rest-http` module is
enabled.
-If you use the binary distribution, copy the `ignite-rest-http` module from
`IGNITE_HOME/libs/optional/` to the `IGNITE_HOME/libs` folder.
+To enable HTTP connectivity, make sure that the `ignite-rest-http` and
`ignite-json` modules are enabled.
+If you use the binary distribution, copy the `ignite-rest-http` and
`ignite-json` modules from `IGNITE_HOME/libs/optional/` to the
`IGNITE_HOME/libs` folder.
See link:setup#enabling-modules[Enabling modules] for details.
Explicit configuration is not required; the connector starts up automatically
and listens on port `8080`. You can check if it works with curl:
diff --git
a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
index d29d38fb6e6..c1d0319d883 100644
---
a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
+++
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
@@ -49,6 +49,7 @@ import org.eclipse.jetty.xml.XmlConfiguration;
import org.jetbrains.annotations.Nullable;
import org.xml.sax.SAXException;
+import static org.apache.ignite.IgniteCommonsSystemProperties.IGNITE_HOME;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_HOST;
import static
org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_LOG_NO_OVERRIDE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT;
@@ -71,6 +72,9 @@ public class GridJettyRestProtocol extends
GridRestProtocolAdapter {
}
}
+ /** Object mapper class name. */
+ private static final String IGNITE_OBJECT_MAPPER =
"org.apache.ignite.internal.jackson.IgniteObjectMapper";
+
/** Jetty handler. */
private GridJettyRestHandler jettyHnd;
@@ -93,6 +97,11 @@ public class GridJettyRestProtocol extends
GridRestProtocolAdapter {
@Override public void start(GridRestProtocolHandler hnd) throws
IgniteCheckedException {
assert ctx.config().getConnectorConfiguration() != null;
+ if (!checkJacksonEnabled())
+ throw new IgniteCheckedException("Can't find ignite-json module in
classpath, which is required for REST API " +
+ "functionality. Copy ignite-json module from " + IGNITE_HOME +
"/libs/optional/ to " + IGNITE_HOME +
+ "/libs folder.");
+
String jettyHost = System.getProperty(IGNITE_JETTY_HOST,
ctx.config().getLocalHost());
try {
@@ -330,6 +339,20 @@ public class GridJettyRestProtocol extends
GridRestProtocolAdapter {
httpSrv.getConnectors().length + "connectorsExpected=1]");
}
+ /**
+ * Check if ignite-json module enabled.
+ */
+ private static boolean checkJacksonEnabled() {
+ try {
+ Class.forName(IGNITE_OBJECT_MAPPER);
+
+ return true;
+ }
+ catch (Exception e) {
+ return false;
+ }
+ }
+
/**
* Stops Jetty.
*/