Thank you William and Richard for your help and advice. I think I may have discovered something.
My project also references Apache Tika - the *tika-app-1.13.jar *library. I'm not very well-versed in Tika, but it apparently has its own implementation of the OpenNLP files. How did I discover this? *(Please bear with this long anecdotal post, I want to describe how I came across this findings.)* Firstly, I was conducting experiments to try and resolve this issue. One of the measures I took was to create a new Eclipse project. This new project was almost an exact replica of my old project - word-for-word, with the same naming conventions and program structure. It also made use of the same libraries - including the OpenNLP 1.6.0 and Apache Tika libraries. The new program initially worked well. It could load the custom model successfully. I experimented on this new program and decided to remove the OpenNLP 1.6.0 library references, then re-add them. This time, the program no longer worked, instead showing the exact same error as my old program did. I got curious, so I decided to try something. I removed the libraries again and observed the code. I was puzzled to see that the import statements for the OpenNLP classes in use did not show any errors. Then, I tried removing the reference to *tika-app-1.13.jar*. To my surprise, the import statements for the various OpenNLP classes in use showed errors (i.e. red underlines). At that point, I realized that it was in part due to Tika. True enough, upon examining the *tika-app-1.13.jar* file, I saw folders containing OpenNLP packages and files. Given the evidence so far, I strongly suspect that the OpenNLP version that Tika is implementing is 1.5.3. I'll investigate and experiment more throughout this week and the next. *(Please do excuse me; I am rather new to OpenNLP and Tika)* After all that has said, I have a question: *Why is it that when the references to the OpenNLP 1.6.0 libraries are removed, the program "reverts" back to OpenNLP 1.5.3, and how do I undo this? (i.e. when I re-add the 1.6.0 libraries, the program starts using 1.6.0 instead of 1.5.3)* Once again, thanks to all who have answered so far for their insight and advice. Regards, David On Fri, Jan 13, 2017 at 3:32 PM, David Samuel Lim <beitrik2...@gmail.com> wrote: > Oops, I meant *opennlp-tools-1.5.3.jar*. My bad. > > On Fri, Jan 13, 2017 at 3:29 PM, David Samuel Lim <beitrik2...@gmail.com> > wrote: > >> Hi Richard, >> >> Thanks for the reply. I've checked the classpath again and it only shows >> the referenced 1.6.0 libraries. >> >> Though, when I initially faced the issue, one strategy I tried was to >> reference the *opennlp-tools-1.5.0.jar* library. It didn't work, so I >> removed it. None of the methods I've tried so far have given me a solid >> answer, not even re-training the model using 1.6.0. >> >> *> Maybe OpenNLP classes are included in some non-OpenNLP JAR as well >> that you use in your project?* >> >> Sorry, I'm personally not sure what you mean by this. Could you please >> clarify? >> >> Regards, >> David >> >> On Fri, Jan 13, 2017 at 3:14 PM, Richard Eckart de Castilho < >> r...@apache.org> wrote: >> >>> On 13.01.2017, at 02:51, David Samuel Lim <beitrik2...@gmail.com> wrote: >>> > >>> > *To sum up: Unable to load custom trained OpenNLP Name Finder model in >>> code >>> > due to apparent OpenNLP version incompatibility. Model was trained in >>> > OpenNLP 1.6.0, which my project also uses. Other projects also using >>> 1.6.0 >>> > were able to load the model successfully.* >>> >>> Maybe you have OpenNLP twice on the classpath for some reason, once in >>> 1.5.3 >>> and once in 1.6.0. Maybe OpenNLP classes are included in some >>> non-OpenNLP JAR >>> as well that you use in your project? >>> >>> Cheers, >>> >>> -- Richard >>> >> >> >