-1

i have an Exception in lemmatization code in java by using Netbeans 8.0 (that exists in the following link) when put it in my project which consists of many classes. the Exception is

Exception in thread "main" java.lang.NoSuchMethodError: edu.stanford.nlp.process.Morphology.lemma(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    at edu.stanford.nlp.pipeline.MorphaAnnotator.addLemma(MorphaAnnotator.java:72)
    at edu.stanford.nlp.pipeline.MorphaAnnotator.annotate(MorphaAnnotator.java:56)
    at edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:69)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:684)
    at summerization.StanfordLemmatizer.lemmatize(StanfordLemmatizer.java:64)
    at summerization.StanfordLemmatizer.main(StanfordLemmatizer.java:100)
Community
  • 1
  • 1
  • 1
    It would be helpful if you provided the code that leads to this stack trace. – mschrimpf May 25 '14 at 09:04
  • this.pipeline.annotate(document); System.out.println(slem.lemmatize(text)); the Exception appeared in the previous lines. Thank you for your interest – user3673315 May 25 '14 at 09:07

1 Answers1

1

Usually NoSuchMethodError implies you're using a different version in compile time and runtime. Make sure that you have the same jar (version) in the classpath that this method comes from.

You didn't provide enough information but if you use maven you can run dependency:tree to see your dependencies. Make sure the jar does not repeat itself twice and that the version is correct. Afterwards, make sure that in the runtime environment you use the same jar as in dev.

Avi
  • 21,182
  • 26
  • 82
  • 121