Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scala 2.10.2 fails first try on Mac OS/X #7882

Closed
scabug opened this issue Sep 28, 2013 · 22 comments
Closed

scala 2.10.2 fails first try on Mac OS/X #7882

scabug opened this issue Sep 28, 2013 · 22 comments

Comments

@scabug
Copy link

scabug commented Sep 28, 2013

Unpacked scala and try to run it. Fails, giving this output:

./scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.

scala> [init] error: error while loading , error in opening zip file

Failed to initialize compiler: object scala.runtime in compiler mirror not found.

  • Note that as of 2.8 scala does not assume use of the java classpath.
  • For the old behavior pass -usejavacp to scala, or if using a Settings
  • object programatically, settings.usejavacp.value = true.

Failed to initialize the REPL due to an unexpected error.
This is a bug, please, report it along with the error diagnostics printed below.
java.lang.NullPointerException
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.applyRule(ExprTyper.scala:24)
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.stmts(ExprTyper.scala:35)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:43)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:42)
at scala.tools.nsc.reporters.Reporter.withIncompleteHandler(Reporter.scala:51)
at scala.tools.nsc.interpreter.ExprTyper$class.parse(ExprTyper.scala:42)
at scala.tools.nsc.interpreter.IMain$exprTyper$.parse(IMain.scala:1074)
at scala.tools.nsc.interpreter.IMain.parse(IMain.scala:1078)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain.beSilentDuring(IMain.scala:238)
at scala.tools.nsc.interpreter.IMain.showCodeIfDebugging(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:800)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:761)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:618)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:661)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain.beQuietDuring(IMain.scala:232)
at scala.tools.nsc.interpreter.IMain.quietBind(IMain.scala:660)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1$$anonfun$apply$mcZ$sp$2.apply$mcV$sp(ILoop.scala:838)
at scala.tools.nsc.interpreter.ILoopInit$class.runThunks(ILoopInit.scala:122)
at scala.tools.nsc.interpreter.ILoop.runThunks(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$class.postInitialization(ILoopInit.scala:95)
at scala.tools.nsc.interpreter.ILoop.postInitialization(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply$mcV$sp(ILoopInit.scala:63)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.io.package$$anon$3.call(package.scala:40)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
.

@scabug
Copy link
Author

scabug commented Sep 28, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7882?orig=1
Reporter: Charlie Martin (chasrmartin)
Affected Versions: 2.10.2

@scabug
Copy link
Author

scabug commented Sep 28, 2013

@paulp said:
You are omitting something relevant; since this isn't what normally happens, reproduction will be impossible without more information.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
Nice try, son.

Script started on Sat Sep 28 19:12:52 2013
�[?1034h501 $ tar xvfz scala-2.10.2.tgz
x scala-2.10.2/
x scala-2.10.2/man/
x scala-2.10.2/man/man1/
x scala-2.10.2/man/man1/scaladoc.1
x scala-2.10.2/man/man1/scalap.1
x scala-2.10.2/man/man1/scalac.1
x scala-2.10.2/man/man1/fsc.1
x scala-2.10.2/man/man1/scala.1
x scala-2.10.2/src/
x scala-2.10.2/src/scala-library-src.jar
x scala-2.10.2/src/scala-swing-src.jar
x scala-2.10.2/src/fjbg-src.jar
x scala-2.10.2/src/scala-reflect-src.jar
x scala-2.10.2/src/scalap-src.jar
x scala-2.10.2/src/msil-src.jar
x scala-2.10.2/src/scala-compiler-src.jar
x scala-2.10.2/src/scala-actors-src.jar
x scala-2.10.2/src/scala-partest-src.jar
x scala-2.10.2/doc/
x scala-2.10.2/doc/README
x scala-2.10.2/doc/tools/
x scala-2.10.2/doc/tools/index.html
x scala-2.10.2/doc/tools/scalap.html
x scala-2.10.2/doc/tools/scalac.html
x scala-2.10.2/doc/tools/fsc.html
x scala-2.10.2/doc/tools/css/
x scala-2.10.2/doc/tools/css/style.css
x scala-2.10.2/doc/tools/images/
x scala-2.10.2/doc/tools/images/scala_logo.png
x scala-2.10.2/doc/tools/images/external.gif
x scala-2.10.2/doc/tools/scaladoc.html
x scala-2.10.2/doc/tools/scala.html
x scala-2.10.2/doc/LICENSE
x scala-2.10.2/examples/
x scala-2.10.2/examples/sort2.scala
x scala-2.10.2/examples/iterators.scala
x scala-2.10.2/examples/monads/
x scala-2.10.2/examples/monads/callccInterpreter.scala
x scala-2.10.2/examples/monads/stateInterpreter.scala
x scala-2.10.2/examples/monads/simpleInterpreter.scala
x scala-2.10.2/examples/monads/directInterpreter.scala
x scala-2.10.2/examples/monads/errorInterpreter.scala
x scala-2.10.2/examples/tcpoly/
x scala-2.10.2/examples/tcpoly/monads/
x scala-2.10.2/examples/tcpoly/monads/Monads.scala
x scala-2.10.2/examples/futures.scala
x scala-2.10.2/examples/boundedbuffer.scala
x scala-2.10.2/examples/sort1.scala
x scala-2.10.2/examples/parsing/
x scala-2.10.2/examples/parsing/ListParsers.scala
x scala-2.10.2/examples/parsing/ListParser.scala
x scala-2.10.2/examples/parsing/ArithmeticParser.scala
x scala-2.10.2/examples/parsing/lambda/
x scala-2.10.2/examples/parsing/lambda/TestParser.scala
x scala-2.10.2/examples/parsing/lambda/Main.scala
x scala-2.10.2/examples/parsing/lambda/TestSyntax.scala
x scala-2.10.2/examples/parsing/lambda/test/
x scala-2.10.2/examples/parsing/lambda/test/test-02.kwi
x scala-2.10.2/examples/parsing/lambda/test/test-07.kwi
x scala-2.10.2/examples/parsing/lambda/test/test-08.kwi
x scala-2.10.2/examples/parsing/lambda/test/test-03.kwi
x scala-2.10.2/examples/parsing/lambda/test/test-04.kwi
x scala-2.10.2/examples/parsing/lambda/test/test-06.kwi
x scala-2.10.2/examples/parsing/lambda/test/test-05.kwi
x scala-2.10.2/examples/parsing/lambda/test/test-01.kwi
x scala-2.10.2/examples/parsing/JSON.scala
x scala-2.10.2/examples/parsing/MiniML.scala
x scala-2.10.2/examples/parsing/ArithmeticParsers.scala
x scala-2.10.2/examples/fors.scala
x scala-2.10.2/examples/patterns.scala
x scala-2.10.2/examples/computeserver.scala
x scala-2.10.2/examples/oneplacebuffer.scala
x scala-2.10.2/examples/sort.scala
x scala-2.10.2/examples/package.scala
x scala-2.10.2/examples/actors/
x scala-2.10.2/examples/actors/seq.scala
x scala-2.10.2/examples/actors/producers.scala
x scala-2.10.2/examples/actors/links.scala
x scala-2.10.2/examples/actors/boundedbuffer.scala
x scala-2.10.2/examples/actors/message.scala
x scala-2.10.2/examples/actors/auction.scala
x scala-2.10.2/examples/actors/channels.scala
x scala-2.10.2/examples/actors/fringe.scala
x scala-2.10.2/examples/actors/pingpong.scala
x scala-2.10.2/examples/actors/looping.scala
x scala-2.10.2/examples/xml/
x scala-2.10.2/examples/xml/phonebook/
x scala-2.10.2/examples/xml/phonebook/phonebook1.scala
x scala-2.10.2/examples/xml/phonebook/phonebook2.scala
x scala-2.10.2/examples/xml/phonebook/embeddedBook.scala
x scala-2.10.2/examples/xml/phonebook/verboseBook.scala
x scala-2.10.2/examples/xml/phonebook/phonebook.scala
x scala-2.10.2/examples/xml/phonebook/phonebook3.scala
x scala-2.10.2/examples/gadts.scala
x scala-2.10.2/examples/maps.scala
x scala-2.10.2/misc/
x scala-2.10.2/misc/scala-devel/
x scala-2.10.2/misc/scala-devel/plugins/
x scala-2.10.2/misc/scala-devel/plugins/continuations.jar
x scala-2.10.2/lib/
x scala-2.10.2/lib/typesafe-config.jar
x scala-2.10.2/lib/akka-actors.jar
x scala-2.10.2/lib/scala-actors.jar
x scala-2.10.2/lib/scala-compiler.jar
x scala-2.10.2/lib/scala-reflect.jar
x scala-2.10.2/lib/scala-library.jar
x scala-2.10.2/lib/diffutils.jar
x scala-2.10.2/lib/scala-swing.jar
x scala-2.10.2/lib/jline.jar
x scala-2.10.2/lib/scala-partest.jar
x scala-2.10.2/lib/scala-actors-migration.jar
x scala-2.10.2/lib/scalap.jar
x scala-2.10.2/bin/
x scala-2.10.2/bin/scaladoc.bat
x scala-2.10.2/bin/scala.bat
x scala-2.10.2/bin/scalac.bat
x scala-2.10.2/bin/scala
x scala-2.10.2/bin/scaladoc
x scala-2.10.2/bin/fsc.bat
x scala-2.10.2/bin/fsc
x scala-2.10.2/bin/scalac
x scala-2.10.2/bin/scalap.bat
x scala-2.10.2/bin/scalap
502 $ export��[K��[K��[K��[K��[K��[Kcd scal�a-2.10.2
503 $ export SCALA_HOME=pwd
504 $ export PATH=${PATH}:${SCAKLA��[K��[K��[KLA_HOME}/bin
505 $ env | grep -i scala
PATH=/usr/local/heroku/bin:/Users/chasrmartin/.rvm/gems/ruby-1.9.3-p448/bin:/Users/chasrmartin/.rvm/gems/ruby-1.9.3-p448@global/bin:/Users/chasrmartin/.rvm/rubies/ruby-1.9.3-p448/bin:/Users/chasrmartin/.rvm/bin:/usr/local/heroku/bin::/usr/local/heroku/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/chasrmartin/Library/Haskell/bin:/Users/chasrmartin/.rvm/bin:/Users/chasrmartin/Downloads/scala-2.10.2/bin
PWD=/Users/chasrmartin/Downloads/scala-2.10.2
SCALA_HOME=/Users/chasrmartin/Downloads/scala-2.10.2
506 $ which scala
/Users/chasrmartin/Downloads/scala-2.10.2/bin/scala
507 $ scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.

scala> [init] error: error while loading , error in opening zip file

Failed to initialize compiler: object scala.runtime in compiler mirror not found.

  • Note that as of 2.8 scala does not assume use of the java classpath.
  • For the old behavior pass -usejavacp to scala, or if using a Settings
  • object programatically, settings.usejavacp.value = true.

Failed to initialize the REPL due to an unexpected error.
This is a bug, please, report it along with the error diagnostics printed below.
java.lang.NullPointerException
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.applyRule(ExprTyper.scala:24)
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.stmts(ExprTyper.scala:35)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:43)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:42)
at scala.tools.nsc.reporters.Reporter.withIncompleteHandler(Reporter.scala:51)
at scala.tools.nsc.interpreter.ExprTyper$class.parse(ExprTyper.scala:42)
at scala.tools.nsc.interpreter.IMain$exprTyper$.parse(IMain.scala:1074)
at scala.tools.nsc.interpreter.IMain.parse(IMain.scala:1078)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain.beSilentDuring(IMain.scala:238)
at scala.tools.nsc.interpreter.IMain.showCodeIfDebugging(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:800)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:761)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:618)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:661)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain.beQuietDuring(IMain.scala:232)
at scala.tools.nsc.interpreter.IMain.quietBind(IMain.scala:660)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1$$anonfun$apply$mcZ$sp$2.apply$mcV$sp(ILoop.scala:838)
at scala.tools.nsc.interpreter.ILoopInit$class.runThunks(ILoopInit.scala:122)
at scala.tools.nsc.interpreter.ILoop.runThunks(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$class.postInitialization(ILoopInit.scala:95)
at scala.tools.nsc.interpreter.ILoop.postInitialization(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply$mcV$sp(ILoopInit.scala:63)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.io.package$$anon$3.call(package.scala:40)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
.
508 $ exit

Script done on Sat Sep 28 19:14:59 2013

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
yeah, like I don't know the "oh, you must be wrong" trick. Attached is a typescript. I've also tried installing using homebrew, and have gotten the same result.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
Oh, and notice your own error message says "this is a bug, report it."

@scabug
Copy link
Author

scabug commented Sep 29, 2013

@paulp said:
It isn't a "trick", it is the application of elementary logic. Thousands of people are somehow using this distribution, so when it doesn't work for one individual, occam's razor applies.

A small amount of googling turns up http://stackoverflow.com/questions/11371252/scala-repl-only-runs-as-root-user-gives-error-when-run-as-non-root where the last comment implicates http://lists.opensuse.org/opensuse-bugs/2012-07/msg00920.html .

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
yeah, and were I running openSUSE, or if I had a gnome-java-bridge.jar, it might have made sense.

Oh, and if I had a dollar for every time a baby programmer told me there couldn't possibly be a bug there in the last 45 years, I'd have retired to Monaco by now.

Now, let's look at the nice bug report (OS/X 10.8.5) and this script, which was run as root, and either handle the bug or forward it to someone who can.

Script started on Sat Sep 28 20:04:21 2013
�[?1034h501 $ sudo bash
�[?1034h501 # cd scal�a-2.10.2
502 # export SCALA_HOME=pwd
503 # export PATH=$SCALA_HOME/bin:$PATH
504 # which scala
/Users/chasrmartin/Downloads/scala-2.10.2/bin/scala
505 # scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.

scala> [init] error: error while loading , error in opening zip file

Failed to initialize compiler: object scala.runtime in compiler mirror not found.

  • Note that as of 2.8 scala does not assume use of the java classpath.
  • For the old behavior pass -usejavacp to scala, or if using a Settings
  • object programatically, settings.usejavacp.value = true.

Failed to initialize the REPL due to an unexpected error.
This is a bug, please, report it along with the error diagnostics printed below.
java.lang.NullPointerException
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.applyRule(ExprTyper.scala:24)
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.stmts(ExprTyper.scala:35)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:43)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:42)
at scala.tools.nsc.reporters.Reporter.withIncompleteHandler(Reporter.scala:51)
at scala.tools.nsc.interpreter.ExprTyper$class.parse(ExprTyper.scala:42)
at scala.tools.nsc.interpreter.IMain$exprTyper$.parse(IMain.scala:1074)
at scala.tools.nsc.interpreter.IMain.parse(IMain.scala:1078)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain.beSilentDuring(IMain.scala:238)
at scala.tools.nsc.interpreter.IMain.showCodeIfDebugging(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:800)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:761)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:618)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:661)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain.beQuietDuring(IMain.scala:232)
at scala.tools.nsc.interpreter.IMain.quietBind(IMain.scala:660)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1$$anonfun$apply$mcZ$sp$2.apply$mcV$sp(ILoop.scala:838)
at scala.tools.nsc.interpreter.ILoopInit$class.runThunks(ILoopInit.scala:122)
at scala.tools.nsc.interpreter.ILoop.runThunks(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$class.postInitialization(ILoopInit.scala:95)
at scala.tools.nsc.interpreter.ILoop.postInitialization(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply$mcV$sp(ILoopInit.scala:63)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.io.package$$anon$3.call(package.scala:40)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
.
506 # exit
502 $ exit

Script done on Sat Sep 28 20:05:36 2013

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
Let's read the bug report, shall we?

@scabug
Copy link
Author

scabug commented Sep 29, 2013

@paulp said:
Based on this exchange, I'm glad it doesn't work. I hope it never does.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
Well, now that that's over -- folks, I'm trying to write an article for Smart Bear about building web services on various platforms. I'd really like to have Scala be an example. Or I can write an article about trying to get help when the software doesn't work. You pick.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Mike Slinn (mslinn) said:
Bears are known for being bad-tempered and unpredictable. Did not know they could read or write.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
Look, dammit, Paul got snippy first. Now do you guys actually have any idea what the bug -- which your own error message says to report -- is? I'm not only interested in writing about Scala, I'm interested in using it for a project, but if it can't even run than I'll use something else.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

@SethTisue said (edited on Sep 29, 2013 7:21:53 PM UTC):
Maybe we don't have all the facts yet, but the clues we have so far seem to indicate that the root cause lies in your JVM installation. Then the problem is compounded by Scala not printing as helpful a diagnostic as it could ("error in opening zip file" — which one?).

A couple things you could try to narrow down the conditions under which this occurs:

  • Try starting Scala as root. Does the problem go away? If so, that suggests permissions problems such as the one in the OpenSUSE bug (which I suspect contains useful clues even though you yourself aren't actually on OpenSUSE).
  • Try running with Java 7 instead of Java 6.

I especially recommend the latter; Java 6 is now basically dead and unsupported on Mac OS X as well as other platforms. I'd add that Java 6's checkered history on Mac OS X in particular means that (blatantly or subtly) broken Java 6 installations on Macs are not uncommon.

Whatever this problem is, it's quite rare; I've never seen it before, even though I've been helping newcomers with Scala (here, on IRC, and elsewhere) for half a decade now. I'm sorry this isn't working for you yet, but I can tell you that this isn't something first-time Scala users commonly hit.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
Thanks. The root trick didn't work, see comment at 8:06PM yesterday.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
I installed java 7. No joy. Here's the results from trying it as root, but it was the same as a user. What file is it trying to load here?

507 $ sudo bash
501 # cd ~/Downloads/scala-2.10.2
502 # export SCALA_HOME=pwd
503 # export PATH=${PATH}:$SCALA_HOME/bin
504 # showp
/bin
/sbin
/usr/sbin
/usr/bin
/usr/local/heroku/bin
/usr/local/bin
/Users/chasrmartin/Library/Haskell/bin
/Users/chasrmartin/Downloads/scala-2.10.2/bin
505 # which scala
/Users/chasrmartin/Downloads/scala-2.10.2/bin/scala
506 # id
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),33(_appstore),61(localaccounts),80(admin),98(_lpadmin),100(_lpoperator),204(_developer),401(com.apple.access_screensharing),402(com.apple.sharepoint.group.1)
507 # scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_40).
Type in expressions to have them evaluated.
Type :help for more information.

scala> [init] error: error while loading , error in opening zip file

Failed to initialize compiler: object scala.runtime in compiler mirror not found.

  • Note that as of 2.8 scala does not assume use of the java classpath.
  • For the old behavior pass -usejavacp to scala, or if using a Settings
  • object programatically, settings.usejavacp.value = true.

Failed to initialize the REPL due to an unexpected error.
This is a bug, please, report it along with the error diagnostics printed below.
java.lang.NullPointerException
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.applyRule(ExprTyper.scala:24)
at scala.tools.nsc.interpreter.ExprTyper$codeParser$.stmts(ExprTyper.scala:35)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:43)
at scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:42)
at scala.tools.nsc.reporters.Reporter.withIncompleteHandler(Reporter.scala:51)
at scala.tools.nsc.interpreter.ExprTyper$class.parse(ExprTyper.scala:42)
at scala.tools.nsc.interpreter.IMain$exprTyper$.parse(IMain.scala:1074)
at scala.tools.nsc.interpreter.IMain.parse(IMain.scala:1078)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$$anonfun$showCodeIfDebugging$1.apply(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain.beSilentDuring(IMain.scala:238)
at scala.tools.nsc.interpreter.IMain.showCodeIfDebugging(IMain.scala:1168)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:800)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:761)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:618)
at scala.tools.nsc.interpreter.IMain.bind(IMain.scala:661)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain$$anonfun$quietBind$1.apply(IMain.scala:660)
at scala.tools.nsc.interpreter.IMain.beQuietDuring(IMain.scala:232)
at scala.tools.nsc.interpreter.IMain.quietBind(IMain.scala:660)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1$$anonfun$apply$mcZ$sp$2.apply$mcV$sp(ILoop.scala:838)
at scala.tools.nsc.interpreter.ILoopInit$class.runThunks(ILoopInit.scala:122)
at scala.tools.nsc.interpreter.ILoop.runThunks(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$class.postInitialization(ILoopInit.scala:95)
at scala.tools.nsc.interpreter.ILoop.postInitialization(ILoop.scala:42)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply$mcV$sp(ILoopInit.scala:63)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.interpreter.ILoopInit$$anonfun$createAsyncListener$1.apply(ILoopInit.scala:60)
at scala.tools.nsc.io.package$$anon$3.call(package.scala:40)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
.
508 #

@scabug
Copy link
Author

scabug commented Sep 29, 2013

@SethTisue said:
Curioser and curioser. Does it work from a freshly created user account on the same machine?

@scabug
Copy link
Author

scabug commented Sep 29, 2013

@retronym said (edited on Sep 29, 2013 8:33:47 PM UTC):
I added a better diagnostic for this issue in Scala 2.11.0-M5. See: scala/scala@5e8bc19

In the meantime, with 2.10.2, you could find out the last JAR opened by the process by tracing system calls with fs_usage.

% sudo fs_usage | grep jar

# in another terminal
% scala

@scabug
Copy link
Author

scabug commented Sep 29, 2013

@SethTisue said (edited on Sep 29, 2013 8:51:35 PM UTC):
Nice; I didn't know about fs_usage. (I tried to get dtruss to show which files were being opened, but failed; even dtruss -f won't follow all of the levels of indirection involved when starting a JVM.)

Looking at the output I get with fs_usage on my own machine, I wonder if the culprit might be something sitting in one of the many extensions directories that the JVM loads jars from: /Library/Java/Extensions, /System/Library/Java/Extensions, and the one in each user's homedir. Charles, when you run scala, you might try running it with -Djava.ext.dirs= (yes, with nothing after the equals sign). When I do that, I no longer see any extensions directories in the output of fsusage.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
Thanks, I'll give it a try in a few minutes. I'm on deadline for a column, but will report back.

@scabug
Copy link
Author

scabug commented Sep 29, 2013

@SethTisue said:
here's a transcript showing that a bad jar in an extensions directory is in fact one way to trigger this:

% mkdir -p ~/Library/Java/Extensions
% echo "ghkjfghjkfhkjgfg" > ~/Library/Java/Extensions/foo.jar
% scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_40).
Type in expressions to have them evaluated.
Type :help for more information.

scala> [init] error: error while loading <root>, error in opening zip file

Failed to initialize compiler: object scala.runtime in compiler mirror not found.
** Note that as of 2.8 scala does not assume use of the java classpath.
** For the old behavior pass -usejavacp to scala, or if using a Settings
** object programatically, settings.usejavacp.value = true.

with 2.11.0-M5, I get Jason's nicer error:

scala> [init] error: error while loading <root>, Error accessing /Users/tisue/Library/Java/Extensions/foo.jar

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
He shoots, he scores. There was a file ctx.jar in my /Library/Java/Extensions/ that was corrupt. I removed it and...

512 $ scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_40).
Type in expressions to have them evaluated.
Type :help for more information.

scala>

scala>

@scabug
Copy link
Author

scabug commented Sep 29, 2013

Charlie Martin (chasrmartin) said:
I'm curious, though -- why does scala load everything in that directory? That file wasn't keeping regular java programs from running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants