-
Notifications
You must be signed in to change notification settings - Fork 39
Using Reach from a FAT JAR
NOTE: Reach must be minimally configured 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.
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. The creation of such a FAT JAR file could (redundantly) also be specified like this:
sbt -DmainClass=org.clulab.reach.RunReachCLI assembly
NOTE: As of version 1.4.0, Reach now requires a separate Server process to be started before running Reach.
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
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.
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 create a FAT JAR which runs the web service, compile the FAT JAR like this:
sbt -DmainClass=org.clulab.reach.export.server.FileProcessorWebUI assembly
To run the web service from the previously compiled FAT JAR:
java -jar reach-1.4.1-SNAPSHOT-FAT.jar
By default, the web service will run on port 8080 on the localhost. An alternative port and/or host may be specified with additional arguments as follows:
java -jar reach-1.4.1-SNAPSHOT-FAT.jar --host myhost.org --port 8088