Thanks guys! For reference/other people who might be reading this:
The problem was the fact that my application was actually running two webapps at the same time - an admin webapp and a main webapp. The jar files were in the main webapp, but not the admin webapp class path. When I added the jars to the admin webapp classpath, the application worked fine. On Tue, Dec 30, 2014 at 6:47 AM, Jörn Kottmann <[email protected]> wrote: > You are missing the OpenNLP classes on your classpath. > > Add the OpenNLP jar files for opennlp-tools and opennlp-maxent to your war > file. > > HTH, > Jörn > > > On 12/29/2014 09:54 PM, Tim Hearn wrote: > >> Hi everyone, >> >> I'm relatively new to OpenNLP software. For my project I am using the >> Sentence detector feature of opennlp. When I run the project on my local >> tomcat server through eclipse, the sentence detector feature works great. >> However, when I do a build (through ant) and put it on an internal test >> server, I get the following exception(OpenNLPEvaluator.java is a class >> which I wrote): >> >> ... >> caused by: Java.lang.NoClassDefFoundError:opennlpmodel/MaxentModel >> ... OpenNLPEvaluator.loadSentenceModel(OpenNLPEvaluator.java:223) >> >> ... >> caused by: java.lang.ClassNotFoundException: opennlp.model.MaxentModel >> >> The lines it fails at: >> >> OpenNLPEvaluator.java >> >> 219 InputStream modelIn = null; >> 220 try { >> 221 salsa.getSystemLogger().info("Loading NLP sentence model..."); >> 222 modelIn = new FileInputStream(sentenceModelPath); >> 223 SentenceModel sentenceModel = new SentenceModel(modelIn); >> 224 sentenceDetector = new SentenceDetectorME(sentenceModel); >> 225 } >> 226 catch (IOException ex) { >> 227 salsa.getSystemLogger().debug("OpenNLP sentence model failed to >> load"); >> 228 ex.printStackTrace(); >> 229 return false; >> 230 } >> 231 finally { >> 232 try { >> 233 modelIn.close(); >> 234 >> 235 } >> 236 catch (IOException ignored) { } >> 237 } >> >> It fails at line 223, which is when I try to create a SentenceModel >> object. All three of the opennlp jars are in my class path, build path, >> and build.xml file. Can anyone point me in the right direction as to how >> to fix this issue? >> >> >
