The Scala java.lang.NoSuchMethodError compiler error message

As a quick note today, if you’re working on a Scala project and get a compiler error message like this:

Caused by: java.lang.NoSuchMethodError: 
scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;

that error message may look a lot worse than it is. I stared at it for a little while, and then realized the root cause: I was trying to use a Scala 2.11 library in a Scala 2.12 project. Once I upgraded the library to its 2.12 version, the error message went away.

The key to reading the error message was that it seemed like an almost impossible problem: Getting a java.lang.NoSuchMethodError directly related to a built-in Scala library, specifically scala.Predef$.refArrayOps and scala/collection/mutable/ArrayOps. Since that can’t possibly happen, I realized something else must be the problem.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
4 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.