1

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?

1 Answers1

1

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 :-)

JustDanyul
  • 13,813
  • 7
  • 53
  • 71
  • Thanks for tips. I set the enviroment variable in /etc/default/tomcat7, System.getenv("TREETAGGER_HOME") gives correct output. As of the privileges, I allowed read, write and execute for the binary, but that didn't work. Turns out, it was the bin directory itself, for witch the tomcat didn't have the privilege. Thanks again, I will check the maven package later :) – Jaroslav Loebl Apr 30 '16 at 22:37