'Problematic custom reporter' fingered in failure of ScalaTest

2,109 views
Skip to first unread message

Eric Fowler

unread,
Jan 1, 2015, 7:58:59 PM1/1/15
to scalate...@googlegroups.com
I have been trying to get Intellij IDEA, Scala, and ScalaTest to work happily together. To that end I have created an SBT project using the IDEA defaults, then created a single file in the test tree. I copied the sample code from scalatest.org into that, compiled, and ran. 


When I run, I get a stack trace: 

An exception or error caused a run to abort. This may have been caused by a problematic custom reporter.
java.lang.NoClassDefFoundError: scala/xml/MetaData
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:2581)
at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1044)
at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1043)
at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:2722)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1043)
at org.scalatest.tools.Runner$.run(Runner.scala:883)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:137)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ClassNotFoundException: scala.xml.MetaData
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more


Here is my build.sbt:
name := "untitled"

version := "1.0"

scalaVersion := "2.11.4"

libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.2.1" % "test"
..

I have also used : 
libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.1" % "test"

With the same result. (2.10 vs. 2.11). 

When I run it from sbt, all is good. 

I am using the latest scala (2.11.4) and scalatest (2.2.1) and IDEA. 

I have google-hunted for a solution and found nothing that helps. 

What is happening here?

Thanks

Eric

Eric Fowler

unread,
Jan 1, 2015, 8:27:17 PM1/1/15
to scalate...@googlegroups.com
I'm gonna answer my own question for posterior, um, posterity. And for the search engines. 

Problem was the IDEA has it's own idea about which scala version to use, and for some reason, it defaulted to 10.4 libraries all over the place. When I manually changed all the libraries to point to 11.2 versions, and weeded out everything else, it started working. 

Wonders never cease. 

Eric

Bill Venners

unread,
Jan 1, 2015, 8:37:00 PM1/1/15
to scalate...@googlegroups.com
Hi Eric,

Glad you found the answer while I was out jogging. I suspect the
actual error had to do with IDEA not including the extra dependency on
the XML jar. But that's moot.

Bill
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalate...@googlegroups.com
> To unsubscribe from this group, send email to
> scalatest-use...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scalatest-use...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com

Marco Massenzio

unread,
Jan 3, 2015, 2:45:14 AM1/3/15
to scalate...@googlegroups.com
Actually, IntelliJ's handling of scalac, standard libraries and the project setup is confused and confusing.

Having spent countless hours during an epic fight (Bill probably still remembers that :) between sbt, IntelliJ, Play and ScalaTest (the latter an unfortunate victim of the former two hating each other...) trying to figure out the "proper" way of doing things the IDEA-way I must confess that I'm still unsure what goes where.

Maybe it's just a case of RTFM (wish there were one, though... the Scala plugin's doc are non-existent) but the settings are a real riddle inside an enigma...
IMO the plugin should just read the build.sbt, do as it's told there (eg, use scala 2.11) and not try to be too clever by half.

end of rant :)

Zuzanna Kruszczyńska

unread,
Apr 5, 2016, 11:33:36 AM4/5/16
to scalatest-users
Hi Eric!

I'm having exactly the same issue today (you're probably not following this post a year later though). My code works through sbt in the command line but not in the IDEA and I don't understand what you mean by 'manually changing all the libraries to point to 11.2 versions'. Wherever I look in the IDEA or folders of libs they all say 11.2 not 10 even though I did use the 10th version at first but then changing the build.sbt automatically updated all visible libraries to 11.

My build.sbt looks like:

name := "Test"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.1.3" % "test"

I'd be super grateful for your help!

Zuzia

Noé Rglez

unread,
Mar 3, 2017, 10:33:20 AM3/3/17
to scalatest-users
Hi I have been experimenting same problem with 2.12 for a different reason.

The default Scala Library in intellij was set to 2.12.1 but the version used thay that has came from Ivy has no scala.xml library. Solution was pretty , just download lasted version of scala 2.12.1 install int on a directory (for example /opt/scala_2.12.1) and add it as the default library for the projects.

To add it as the default just go to file>>Other setting>>Default project structure>>Global libraries

then add new library (plus button on top of the page) select "scala SDK" then browse the folder where is the new version and add it.

You should see the scala-xml on the list of clases of the library :)

Recompile whole project and execute the test.
Reply all
Reply to author
Forward
0 new messages