javatomcattreetagger

Tomcat unable to locate TreeTagger binary


I have a java application (Ninja framework) which uses TreeTagger. Root directory of TreeTagger is set via enviroment variable TREETAGGER_HOME. When I run application via ninja, everything works fine, however, when i deploy war file to tomcat, it cannot locate Tree Tagger binary:

java.lang.RuntimeException: java.io.IOException: Unable to locate tree-tagger binary in the following locations [/home/jarino/treetagger/bin/tree-tagger]. Make sure the environment variable 'TREETAGGER_HOME' or 'TAGDIR' or the system property 'treetagger.home' point to the TreeTagger installation directory.

The location which is specified in exception (/home/jarino/treetagger/bin/tree-tagger) is valid - the binary file exists. Why Tomcat application can't see existing file?


Solution

  • I'm guessing you are not running the Tomcat application server as the user jarino, so,

    1. Double check that the tomcat user, which the tomcat process is running as, has the environment variable set
    2. If the environment variable is actually set, double check that tomcat user has the correct privileges to access the treetagger directory in your home folder

    TIP: I can see that a maven package exists for treetagger. Using a dependency manager, will make your life much easier :-)