Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/_docs/quick-start/restapi.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/_docs/restapi.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
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;
Expand All @@ -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;

Expand All @@ -93,6 +97,11 @@ public GridJettyRestProtocol(GridKernalContext ctx) {
@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 {
Expand Down Expand Up @@ -330,6 +339,20 @@ private AbstractNetworkConnector getJettyConnector() throws IgniteCheckedExcepti
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.
*/
Expand Down
Loading