Search code examples
apache-felixjbossfusemaven-bundle-pluginstanford-nlp

Cannot get CoreNLP models files from JBoss Fuse ESB


I have a problem with CoreNLP using in JBoss Fuse ESB. I installed CoreNLP with it's models on ESB by

install wrap:mvn:edu.stanford.nlp/stanford-corenlp/3.6.0
install wrap:mvn:edu.stanford.nlp/stanford-corenlp/3.6.0//models-english

Then, when my module tries to use models-english I have error log message

Caused by: java.io.IOException: Unable to open "edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger" as class path, filename or URL
    at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:485)[275:org.opengravity.camel.nlp:1.0.0.SNAPSHOT]
    at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:765)[275:org.opengravity.camel.nlp:1.0.0.SNAPSHOT]
    ... 69 more

I tried to solve this problem by maven-bundle-plugin configurations

<Embed-Dependency>stanford-corenlp</Embed-Dependency>

but unfortunately it didn't help.


Solution

  • First of all I install two modules

    install wrap:mvn:edu.stanford.nlp/stanford-corenlp/3.6.0
    install wrap:mvn:edu.stanford.nlp/stanford-corenlp/3.6.0//models-english
    

    and then, as it was advised by Claus Ibsen, I enabled dynamic import on the first bundle dev:dynamic-import XXX where XXX is the stanford-corenlp-3.6.0 bundle id. It solved my problem.