简体   繁体   中英

NoSuchMethodError when I'm running jar on cluster

When I'm running Unit test's, all works fine, but when I run it on cluster, I'm getting NoSuchMethodError

2015-09-07 16:51:40,143 FATAL [main] org.apache.hadoop.mapred.YarnChild: Error running child : java.lang.NoSuchMethodError: com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/List;

In pom.xml I've included guava: com.google.guava:guava:18.0

And when I set guava version 14.0, I'm getting the same error. What should I do?

Check in your classpath for the class Splitter. Its possible that there are two classes with the same name Splitter class coming from two different jars and one class overwrite the other.

Check in your workspace under what all jars Splitter class is present and remove the one dependency which is not needed. This should work.

According to the change log , public List<String> com.google.common.base.Splitter.splitToList(CharSequence) has been introduced since version 15.0. So you may have to change the version from 14.0 to 15.0 or later. I think 18.0 should also work...

 +   * @since 15.0
 +   */
 +  @Beta
 +  public List<String> splitToList(CharSequence sequence) {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM