Skip to content

Using Reach from a FAT JAR

Tom Hicks edited this page Nov 21, 2017 · 26 revisions

Reach Configuration

NOTE: Reach must be minimally configured, usually before compilation, to specify where to find input files for processing.

Input and output directories, and many other configuration options, are specified in the application.conf configuration file. For more information on configuring Reach see the Running Reach Wiki page.

Creating a FAT JAR

Reach can be compiled, along with all its required dependencies, into a single JVM JAR file, known as a 'FAT' JAR. To produce a default FAT JAR for Reach:

sbt assembly

The resulting FAT JAR will be located in the target/scala-2.11 subdirectory and will be named with the current project version number and the suffix -FAT.jar (e.g., reach-1.4.1-SNAPSHOT-FAT.jar)

The default Reach FAT JAR runs a main program to do 'batch' mode processing: reading papers from an input directory and producing result files into an output directory. This is equivalent to running the main program org.clulab.reach.RunReachCLI using sbt.

A FAT JAR may also be produced which runs a different main program. For instance, to produce a FAT JAR which runs the interactive Reach Shell, compile it like this:

sbt -DmainClass=org.clulab.reach.ReachShell assembly

As mentioned, compiling a FAT JAR with no mainClass specification produces a FAT JAR which will run the batch mode program. Such a FAT JAR file could also (redundantly) be created like this:

sbt -DmainClass=org.clulab.reach.RunReachCLI assembly

Running the FAT JAR

NOTE: As of version 1.4.0, Reach now requires a separate Server process to be started before running Reach.

Starting the Server process from the FAT JAR

To start the Server process from the FAT JAR, use the following Java runtime command:

java -cp ./reach-1.4.1-SNAPSHOT-FAT.jar org.clulab.processors.server.ProcessorServer

Starting Reach from the FAT JAR

After starting the Server, run Reach from the same FAT JAR, again using the Java runtime system:

java -jar reach-1.4.1-SNAPSHOT-FAT.jar

This command will default to using whichever mainClass you specified when you compiled the FAT JAR (as previously described above). Additional runtime arguments to the embedded main program may be provided on the command line after the JAR name.

Internal Web Service

As an alternative to batch mode, it is possible to create a FAT JAR which runs a small web service to process files via HTTP requests.

NOTE: Do not confuse this internal web service with the separate Server process which Reach now requires.

To use the web service, compile the FAT JAR like this:

sbt -DmainClass=org.clulab.reach.export.server.FileProcessorWebUI assembly

Running the Web Service from the FAT JAR

To run the web service from the previously compiled FAT JAR, you may specify a port for the web service to use as follows:

java -jar reach-1.4.1-SNAPSHOT-FAT.jar --port 8088