Back to LanguageTool Homepage - Privacy - Imprint

java.lang.NoSuchMethodError thrown


(Benedict Holland) #1

I run this code:

JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
try {
      List<RuleMatch> matches = langTool.check(text);
} catch (IOException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
}

And I get the following relevant stack trace. I cannot share my text unfortunately unless you can tell me what might be causing it and I can send a snip.

Jan 12, 2018 6:47:22 PM org.apache.uima.collection.impl.cpm.engine.CPMThreadGroup process
SEVERE: The CPM thread group caught the following unhandled error: java.lang.NoSuchMethodError (Thread Name: [Procesing Pipeline#1 Thread]::slight_smile:
java.lang.NoSuchMethodError: org.apache.commons.lang3.StringUtils.equalsAny(Ljava/lang/CharSequence;[Ljava/lang/CharSequence;)Z
at org.languagetool.tokenizers.WordTokenizer.urlEndsAt(WordTokenizer.java:209)
at org.languagetool.tokenizers.WordTokenizer.joinUrls(WordTokenizer.java:158)
at org.languagetool.tokenizers.WordTokenizer.joinEMailsAndUrls(WordTokenizer.java:108)
at org.languagetool.tokenizers.en.EnglishWordTokenizer.tokenize(EnglishWordTokenizer.java:66)
at org.languagetool.JLanguageTool.getRawAnalyzedSentence(JLanguageTool.java:805)
at org.languagetool.JLanguageTool.getAnalyzedSentence(JLanguageTool.java:786)
at org.languagetool.JLanguageTool.analyzeSentences(JLanguageTool.java:604)
at org.languagetool.JLanguageTool.check(JLanguageTool.java:578)
at org.languagetool.JLanguageTool.check(JLanguageTool.java:555)
at org.languagetool.JLanguageTool.check(JLanguageTool.java:512)
at org.languagetool.JLanguageTool.check(JLanguageTool.java:495)


(Daniel Naber) #2

How did you build your code, using Maven or Gradle? Or did you run it inside the IDE? In any case, the dependencies seem to be messed up. I suggest using Maven or Gradle as documented at http://wiki.languagetool.org/java-api


(Benedict Holland) #3

Very strange. I linked the .jar file in eclipse and it didn’t work but the same library downloaded via maven worked fine. Sorry about that. Just a very strange error.