title: Apache Tika : Settting classpath for opennlp models on tika-server
body: <p>I can't seem to set the classpath for the tika-server so that the opennlp models are detected correctly.</p>
  
  <p>I've followed the instructions here:</p>
  
  <p><a href="https://wiki.apache.org/tika/TikaAndNER" rel="nofollow noreferrer">https://wiki.apache.org/tika/TikaAndNER</a></p>
  
  <p>(substituting app for -server, seen as that looked like it contained everything required)</p>
  
  <p>I have created the following folder structure</p>
  
  <pre><code>tika
  `-- tika-ner-resources
      `-- org
          `-- apache
             `-- tika
                `-- parser
                    `-- ner
                      `-- opennlp
                         |-- ner-location.bin
                         |-- ner-organization.bin
                         `-- ner-person.bin
  </code></pre>
  
  <p><strong>Running</strong>:</p>
  
  <p>java -classpath tika/tika-ner-resources -jar tika-server-1.18.jar --config /etc/tika-config.xml -enableUnsecureFeatures -h 0.0.0.0</p>
  
  <p><strong>and issuing</strong> 
  {{ curl -v -XPUT --data-binary @test.pdf <a href="http://localhost:9998/tika" rel="nofollow noreferrer">http://localhost:9998/tika</a> --header "Accept: text/plain" --header "Content-Type: application/pdf"}}</p>
  
  <p><strong>results in</strong></p>
  
  <p>INFO going to load, instantiate and bind the instance of org.apache.tika.parser.ner.opennlp.OpenNLPNERecogniser
  WARN Couldn't find model from org/apache/tika/parser/ner/opennlp/ner-location.bin using class loader
  INFO LOCATION NER : Available for service ? false
  WARN Couldn't find model from org/apache/tika/parser/ner/opennlp/ner-organization.bin using class loader
  INFO ORGANIZATION NER : Available for service ? false
  WARN Couldn't find model from org/apache/tika/parser/ner/opennlp/ner-date.bin using class loader
  INFO DATE NER : Available for service ? false
  WARN Couldn't find model from org/apache/tika/parser/ner/opennlp/ner-money.bin using class loader
  INFO MONEY NER : Available for service ? false
  WARN Couldn't find model from org/apache/tika/parser/ner/opennlp/ner-person.bin using class loader
  INFO PERSON NER : Available for service ? false
  WARN Couldn't find model from org/apache/tika/parser/ner/opennlp/ner-percentage.bin using class loader
  INFO PERCENT NER : Available for service ? false
  WARN Couldn't find model from org/apache/tika/parser/ner/opennlp/ner-time.bin using class loader
  INFO TIME NER : Available for service ? false
  INFO org.apache.tika.parser.ner.opennlp.OpenNLPNERecogniser is available ? false
  INFO going to load, instantiate and bind the instance of org.apache.tika.parser.ner.regex.RegexNERecogniser
  INFO org.apache.tika.parser.ner.regex.RegexNERecogniser is available ? false
  INFO Number of NERecognisers in chain 0</p>
  
  <p>The only thing that seems to work is re-packing the jar by adding the contents of the tika/tika-ner-resources directory (i.e. org/blah/blah/*.bin). The curl command then executes without any issues. I've also tried almost every combination of setting the classpath.</p>
  
  <p>Does anyone have any ideas ?</p>