Note that there are some explanatory texts on larger screens.

plurals
  1. POStanford CoreNLP: Building Error (NoSuchMethodError)
    primarykey
    data
    text
    <p>Sorry if this is a newbie's question. I was trying to use maven in Netbeans to build CoreNLP parser.</p> <p>I first added dependency of stanford-corenlp 1.2.0. However, I always got an error while compiling my code. I tried to simplify my code to just create the StanfordCoreNLP object, but it still did not function with the same error message. I guess here might come with the main trouble spot then.</p> <p>My simplified code shows as:</p> <pre><code>import java.util.Properties; import edu.stanford.nlp.pipeline.StanfordCoreNLP; Properties props = new Properties(); props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); </code></pre> <p>The error message:</p> <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: edu.stanford.nlp.process.PTBTokenizer.factory (Ledu/stanford/nlp/process/LexedTokenFactory;Ljava/lang/String;)Ledu/stanford/nlp/objectbank/TokenizerFactory; at edu.stanford.nlp.pipeline.PTBTokenizerAnnotator.&lt;init&gt;(PTBTokenizerAnnotator.java:42) at edu.stanford.nlp.pipeline.StanfordCoreNLP$1.create(StanfordCoreNLP.java:365) at edu.stanford.nlp.pipeline.StanfordCoreNLP$1.create(StanfordCoreNLP.java:355) at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:62) at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:328) at edu.stanford.nlp.pipeline.StanfordCoreNLP.&lt;init&gt;(StanfordCoreNLP.java:194) at edu.stanford.nlp.pipeline.StanfordCoreNLP.&lt;init&gt;(StanfordCoreNLP.java:184) at edu.stanford.nlp.pipeline.StanfordCoreNLP.&lt;init&gt;(StanfordCoreNLP.java:176) at com.mycompany.hellocore.App.main(App.java:26) </code></pre> <p>I also tried the same thing via maven on Eclipse, the error message is still the same. Can anyone give me some suggestions? Thanks!</p> <p>OS: Mac Lion / Java version: 1.6.0_29 </p> <hr> <p>[Update] 01-6-2012 Based on Sri Sankaran's suggestion, i tried <code>mvn dependency: tree</code>:</p> <pre><code>[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building hellocore 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ hellocore --- [INFO] com.mycompany:hellocore:jar:1.0-SNAPSHOT [INFO] +- junit:junit:jar:3.8.1:test [INFO] \- edu.stanford.nlp:stanford-corenlp:jar:1.2.0:compile [INFO] +- xom:xom:jar:1.2.5:compile [INFO] | +- xml-apis:xml-apis:jar:1.3.03:compile [INFO] | +- xerces:xercesImpl:jar:2.8.0:compile [INFO] | \- xalan:xalan:jar:2.7.0:compile [INFO] \- joda-time:joda-time:jar:2.0:compile [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.483s [INFO] Finished at: Fri Jan 06 08:55:06 EST 2012 [INFO] Final Memory: 5M/81M [INFO] ------------------------------------------------------------------------ </code></pre> <p>The setting in my Netbeans:</p> <p><img src="https://i.stack.imgur.com/zSuor.jpg" alt="enter image description here"></p> <p>But it seems like the library in need looks the same as what is already downloaded in Netbeans. The project still stops while <code>Adding annotator tokenize</code>.</p> <hr> <p>[Update] 01-09-2012</p> <p>After i reinstalled my system, the problem was gone. So i think the code and the module are both correct. The classpath directories might be just messed up by me. Thank you for all people's helps.</p> <p>Just a gentle reminder for people using corenlp via Netbeans. In addition to the standard dependency of stanford-corenlp.jar. If you want to inlcude the stanford-corenlp-models.jar into your project. Seems like you also need to specify the <code>&lt;classifier&gt;</code> to add the models to the dependency repository.</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;edu.stanford.nlp&lt;/groupId&gt; &lt;artifactId&gt;stanford-corenlp&lt;/artifactId&gt; &lt;version&gt;1.2.0&lt;/version&gt; &lt;classifier&gt;models&lt;/classifier&gt; &lt;/dependency&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload