Debugging an error with stacktraces that don't seem to touch your code

101 views
Skip to first unread message

Brandon Barker

unread,
Jul 3, 2015, 10:35:56 PM7/3/15
to scala...@googlegroups.com
Hi All,

I'm relatively new to Scala, but I've run into this issue a couple of times. The first time, only my Coursera grade was at stake, but this time I'm trying to do some real work :).

I believe that the error may relate to doing reactive programming in Scala, as both situations employ reactive code. The code I'm using, aside from my build system, was copied directly from the Twitter-Server page, so I don't think it is an obvious programming error. Maybe a build system issue?

Steps to reproduce:



git clone https
://github.com/bbarker/TwitterServerTest.git
cd
TwitterServerTest/
gradle build

gradle copyToLib
cd build
/libs/
scala
-cp ./*.jar  edu.cornell.comm.twitter.server.Basic
Server
java.lang.NullPointerException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at scala.reflect.internal.util.ScalaClassLoader$$anonfun$tryClass$1.apply(ScalaClassLoader.scala:43)
        at scala.reflect.internal.util.ScalaClassLoader$$anonfun$tryClass$1.apply(ScalaClassLoader.scala:43)
        at scala.util.control.Exception$Catch$$anonfun$opt$1.apply(Exception.scala:119)
        at scala.util.control.Exception$Catch$$anonfun$opt$1.apply(Exception.scala:119)
        at scala.util.control.Exception$Catch.apply(Exception.scala:103)
        at scala.util.control.Exception$Catch.opt(Exception.scala:119)
        at scala.reflect.internal.util.ScalaClassLoader$class.tryClass(ScalaClassLoader.scala:42)
        at scala.reflect.internal.util.ScalaClassLoader$class.tryToInitializeClass(ScalaClassLoader.scala:39)
        at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.tryToInitializeClass(ScalaClassLoader.scala:101)
        at scala.reflect.internal.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:63)
        at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
        at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:22)
        at scala.tools.nsc.JarRunner$.run(MainGenericRunner.scala:13)
        at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:29)
        at scala.tools.nsc.JarRunner$.runJar(MainGenericRunner.scala:25)
        at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:69)
        at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:87)
        at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:98)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)



I've tested this on both Cygwin64 and Linux64, so it seems to not be a platform issue. I've also tested using Gradle 2.3 and 2.4.

Thanks in advance for any suggestions or insights.

Som Snytt

unread,
Jul 4, 2015, 12:29:44 AM7/4/15
to Brandon Barker, scala-user
Your class path should be expressed "*" or "./*", with quotes to avoid expansion and without a .jar suffix.

This is described at the jdk doc path technotes/tools/windows/classpath.html


--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Som Snytt

unread,
Jul 4, 2015, 12:56:38 AM7/4/15
to Brandon Barker, scala-user
Not a gradle user at this point, but:

$ scala -cp "../classes/main:*" edu.cornell.comm.twitter.server.BasicServer

However, the build/libs dir contains

scala-library-2.11.6.jar
scala-reflect-2.11.2.jar

which it seems to me can't be correct.


Brandon Barker

unread,
Jul 4, 2015, 3:14:01 PM7/4/15
to scala...@googlegroups.com, brandon...@gmail.com
Thanks, both of your suggestions work!

I'm not sure what causes the version mismatch for scala jars. Neither of those versions are exactly what I have installed on my system either, nor are they want is specified in my gradle file.
I'm not very proficient with gradle, but I do know it a bit better than sbt (which I know not at all). 
Reply all
Reply to author
Forward
0 new messages