title: ScalaTest: QuickStart code fails with java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
body: <p>I am just starting out with ScalaTest and following <a href="http://www.scalatest.org/quick_start" rel="nofollow noreferrer">http://www.scalatest.org/quick_start</a> page</p>
  
  <p>I followed the steps as outlined (by downloading the jar file linked above the code)
  and the code fails</p>
  
  <pre><code> unittest vi ExampleSpec.scala
  ➜  unittest scalac -cp scalatest-app_2.13-3.0.8.jar ExampleSpec.scala
  ➜  unittest scala -cp scalatest-app_2.13-3.0.8.jar org.scalatest.run ExampleSpec
  An exception or error caused a run to abort. This may have been caused by a problematic custom reporter.
  java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
          at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1368)
          at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1033)
          at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1011)
          at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1509)
          at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1011)
          at org.scalatest.tools.Runner$.main(Runner.scala:827)
          at org.scalatest.run$.main(run.scala:120)
          at org.scalatest.run.main(run.scala)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.base/java.lang.reflect.Method.invoke(Method.java:567)
          at scala.reflect.internal.util.ScalaClassLoader.$anonfun$run$2(ScalaClassLoader.scala:105)
          at scala.reflect.internal.util.ScalaClassLoader.asContext(ScalaClassLoader.scala:40)
          at scala.reflect.internal.util.ScalaClassLoader.asContext$(ScalaClassLoader.scala:37)
          at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:130)
          at scala.reflect.internal.util.ScalaClassLoader.run(ScalaClassLoader.scala:105)
          at scala.reflect.internal.util.ScalaClassLoader.run$(ScalaClassLoader.scala:97)
          at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:130)
          at scala.tools.nsc.CommonRunner.run(ObjectRunner.scala:29)
          at scala.tools.nsc.CommonRunner.run$(ObjectRunner.scala:28)
          at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:43)
          at scala.tools.nsc.CommonRunner.runAndCatch(ObjectRunner.scala:35)
          at scala.tools.nsc.CommonRunner.runAndCatch$(ObjectRunner.scala:34)
          at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:70)
          at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:91)
          at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:103)
          at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:108)
          at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
  Caused by: java.lang.ClassNotFoundException: scala.xml.NamespaceBinding
          at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          ... 29 more
  </code></pre>
  
  <p>My Scala Version is</p>
  
  <pre><code>➜  unittest scala -version
  Scala code runner version 2.13.1 -- Copyright 2002-2019, LAMP/EPFL and Lightbend, Inc.
  </code></pre>
  
  <p>I thought the error is because <code>scala-xml</code> is a separate project than Scala, so I downloaded the jar file from <a href="https://mvnrepository.com/artifact/org.scala-lang/scala-xml/2.11.0-M4" rel="nofollow noreferrer">https://mvnrepository.com/artifact/org.scala-lang/scala-xml/2.11.0-M4</a>  </p>
  
  <p>Next, I tried the entire process again and it fails with different error</p>
  
  <pre><code> unittest scala -classpath "scalatest-app_2.13-3.0.8.jar:scala-xml-2.11.0-M4.jar" org.scalatest.run ExampleSpec
  An exception or error caused a run to abort. This may have been caused by a problematic custom reporter.
  java.lang.NoClassDefFoundError: scala/Serializable
          at java.base/java.lang.ClassLoader.defineClass1(Native Method)
          at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
          at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
          at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:515)
          at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:423)
          at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:417)
          at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
          at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:416)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1368)
          at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1033)
          at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1011)
          at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1509)
          at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1011)
          at org.scalatest.tools.Runner$.main(Runner.scala:827)
          at org.scalatest.run$.main(run.scala:120)
          at org.scalatest.run.main(run.scala)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.base/java.lang.reflect.Method.invoke(Method.java:567)
          at scala.reflect.internal.util.ScalaClassLoader.$anonfun$run$2(ScalaClassLoader.scala:105)
          at scala.reflect.internal.util.ScalaClassLoader.asContext(ScalaClassLoader.scala:40)
          at scala.reflect.internal.util.ScalaClassLoader.asContext$(ScalaClassLoader.scala:37)
          at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:130)
          at scala.reflect.internal.util.ScalaClassLoader.run(ScalaClassLoader.scala:105)
          at scala.reflect.internal.util.ScalaClassLoader.run$(ScalaClassLoader.scala:97)
          at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:130)
          at scala.tools.nsc.CommonRunner.run(ObjectRunner.scala:29)
          at scala.tools.nsc.CommonRunner.run$(ObjectRunner.scala:28)
          at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:43)
          at scala.tools.nsc.CommonRunner.runAndCatch(ObjectRunner.scala:35)
          at scala.tools.nsc.CommonRunner.runAndCatch$(ObjectRunner.scala:34)
          at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:70)
          at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:91)
          at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:103)
          at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:108)
          at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
  Caused by: java.lang.ClassNotFoundException: scala.Serializable
          at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          ... 39 more
  
  </code></pre>
  
  <p>Could someone please help me understand what the issue is?</p>
  
  <p>Thank you</p>
  
  <p><strong>UPDATE (SOLVED)</strong>  </p>
  
  <p>As per the comment from @J0HN and answer from @Mario, I was able to solve the issue</p>
  
  <pre><code>➜  unittest ll
  total 17608
  -rw-r--r--  1 harit  staff   504B Nov 21 17:15 ExampleSpec.scala
  -rw-r--r--@ 1 harit  staff   555K Nov 22 10:35 scala-xml_2.13-1.2.0.jar
  -rw-r--r--@ 1 harit  staff   7.9M Nov 21 16:59 scalatest-app_2.13-3.0.8.jar
  ➜  unittest scalac -classpath "scalatest-app_2.13-3.0.8.jar:scala-xml_2.13-1.2.0.jar" ExampleSpec.scala 
  ➜  unittest scala -classpath "scalatest-app_2.13-3.0.8.jar:scala-xml_2.13-1.2.0.jar" org.scalatest.run ExampleSpec 
  Run starting. Expected test count is: 2
  ExampleSpec:
  A Stack
  - should pop values in last-in-first-out order
  - should throw NoSuchElementException if an empty stack is popped
  Run completed in 506 milliseconds.
  Total number of tests run: 2
  Suites: completed 1, aborted 0
  Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
  All tests passed.
  ➜  unittest 
  </code></pre>
  
  <p>I have downloaded <code>scala-xml_2.13-1.2.0.jar</code> from <a href="https://repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_2.13/1.2.0/" rel="nofollow noreferrer">this</a> page</p>