ensime scala errors (class scala.Array not found, object scala not found) - scala

I've installed ensime according to the README.md file, however, I get errors in the inferior-ensime-server buffer with the following:
INFO: Fatal Error: scala.tools.nsc.MissingRequirementError: object scala not found.
scala.tools.nsc.MissingRequirementError: object scala not found.
at scala.tools.nsc.symtab.Definitions$definitions$.getModuleOrClass(Definitions.scala:516)
at scala.tools.nsc.symtab.Definitions$definitions$.ScalaPackage(Definitions.scala:43)
at scala.tools.nsc.symtab.Definitions$definitions$.ScalaPackageClass(Definitions.scala:44)
at scala.tools.nsc.symtab.Definitions$definitions$.UnitClass(Definitions.scala:89)
at scala.tools.nsc.symtab.Definitions$definitions$.init(Definitions.scala:786)
at scala.tools.nsc.Global$Run.(Global.scala:593)
at scala.tools.nsc.interactive.Global$TyperRun.(Global.scala:473)
at scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:535)
at scala.tools.nsc.interactive.Global.reloadSources(Global.scala:289)
at scala.tools.nsc.interactive.Global$$anonfun$reload$1.apply(Global.scala:300)
at scala.tools.nsc.interactive.Global$$anonfun$reload$1.apply(Global.scala:300)
at scala.tools.nsc.interactive.Global.respond(Global.scala:276)
at scala.tools.nsc.interactive.Global.reload(Global.scala:300)
at scala.tools.nsc.interactive.CompilerControl$$anon$1.apply$mcV$sp(CompilerControl.scala:81)
at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:132)
at scala.tools.nsc.interactive.Global$$anon$2.run(Global.scala:192)
also:
INFO: Fatal Error: scala.tools.nsc.MissingRequirementError: class scala.Array not found.
scala.tools.nsc.MissingRequirementError: class scala.Array not found.
at scala.tools.nsc.symtab.Definitions$definitions$.getModuleOrClass(Definitions.scala:516)
at scala.tools.nsc.symtab.Definitions$definitions$.getClass(Definitions.scala:474)
at scala.tools.nsc.symtab.Definitions$definitions$.ArrayClass(Definitions.scala:217)
at scala.tools.nsc.backend.icode.TypeKinds$REFERENCE.(TypeKinds.scala:258)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.(GenICode.scala:55)
at scala.tools.nsc.backend.icode.GenICode.newPhase(GenICode.scala:43)
at scala.tools.nsc.backend.icode.GenICode.newPhase(GenICode.scala:25)
at scala.tools.nsc.Global$Run$$anonfun$4.apply(Global.scala:606)
at scala.tools.nsc.Global$Run$$anonfun$4.apply(Global.scala:605)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:62)
at scala.collection.immutable.List.foreach(List.scala:46)
at scala.tools.nsc.Global$Run.(Global.scala:605)
at scala.tools.nsc.interactive.Global$TyperRun.(Global.scala:473)
at scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:535)
at scala.tools.nsc.interactive.Global.reloadSources(Global.scala:289)
at scala.tools.nsc.interactive.Global.typedTreeAt(Global.scala:309)
at scala.tools.nsc.interactive.Global$$anonfun$getTypedTreeAt$1.apply(Global.scala:326)
at scala.tools.nsc.interactive.Global$$anonfun$getTypedTreeAt$1.apply(Global.scala:326)
at scala.tools.nsc.interactive.Global.respond(Global.scala:276)
at scala.tools.nsc.interactive.Global.getTypedTreeAt(Global.scala:326)
at scala.tools.nsc.interactive.CompilerControl$$anon$2.apply$mcV$sp(CompilerControl.scala:89)
at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:132)
at scala.tools.nsc.interactive.Global$$anon$2.run(Global.scala:192)
Also none of the type identification works for me, I get 'NA' if I get anything at all. C-c t causes emacs to lock up.
I'm running:
Ubuntu 10.04 (64bit version)
emacs 23.1.50.1
ensime from git (as of 3 May 2010)
scala is version 2.8.0.RC1
java is 1.6.0_20 (from sun)
here is a copy of the log: http://dl.dropbox.com/u/5309017/ensime.log
Thanks!
Jeff

"scala.tools.nsc.MissingRequirementError: object scala not found" usually means that the standard Scala libarary cannot be found. Have a look at the inferior ensime server buffer, and it should print the classpath that's being used. Here's an excerpt from mine:
INFO: [Classpath = /usr/lib/jvm/java-6-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/gnome-java-bridge.jar:/home/aemon/src/misc/ensime/lib/jnotify/jnotify-0.93.jar:/home/aemon/src/misc/ensime/lib/scala/scala-library.jar:/home/aemon/src/misc/ensime/lib/scala/scala-compiler.jar]
Notice the scala-library.jar, second from the end. You probably have to modify your .ensime file so that the :classpath field points to the library jar.

Related

How to solve error on docker:layers_calculator to compute the Merkle tree on private tangle?

I want to setup a private tangle on my own virtual machine with Ubuntu 18.04, 4GB RAM and 20GB memory.
I have follow this instructions: https://docs.iota.org/docs/compass/0.1/how-to-guides/set-up-a-private-tangle. Every command works fine until reach this one: bazel run //docker:layers_calculator.
It shows an error as follows:
Starting local Bazel server and connecting to it...
ERROR: /home/istabraq/compass/third-party/maven_deps.bzl:3:5: Traceback (most recent call last):
File "/home/istabraq/compass/WORKSPACE", line 42
maven_jars()
File "/home/istabraq/compass/third-party/maven_deps.bzl", line 3, in maven_jars
native.maven_jar(<4 more arguments>)
type 'struct' has no method maven_jar()
ERROR: error loading package '': Encountered error while reading extension file 'protobuf_deps.bzl': no such package '#com_google_protobuf_deps//': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'protobuf_deps.bzl': no such package '#com_google_protobuf_deps//': error loading package 'external': Could not load //external package
INFO: Elapsed time: 4.743s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
How can I solve this problem? what I have missed?
read carefully the message given after running bazel installer:
Make sure you have "/home/yourusername/bin" in your path. You can also activate bash completion by adding the following line to your :
source /home/yourusername/.bazel/bin/bazel-complete.bash
You can check with: "bazel info" or "bazel version"
Unfortunately, there are further errors:
https://github.com/iotaledger/compass/issues/142
I have solve this issue by using this commands:
Step 3: Set up your environment
If you ran the Bazel installer with the --user flag as above, the Bazel executable is installed in your $HOME/bin directory. It’s a good idea to add this directory to your default paths, as follows:
export PATH="$PATH:$HOME/bin"
You can also add this command to your ~/.bashrc or ~/.zshrc file to make it permanent.
reference:
https://docs.bazel.build/versions/master/install-ubuntu.html

repl hangs for ~15 seconds on each error (emacs + cider + boot)

I'm facing a strange behavior whenever I invoke an error in boot-cljs-repl. The repl (actually the entire emacs) hangs for about 15 seconds and after that I see the following error message below the mode-line:
error in process filter: Lisp nesting exceedsmax-lisp-eval-depth'`
An error would e.g be calling (some-nonexisting-function) from the REPL.
Additionally I get an error message inside the REPL itself. Sorry, for posting the whole thing here - I wouldn't know right now which parts are important:
box.webgl> (some-nonexisting-function)
WARNING: Use of undeclared Var box.webgl/some-nonexisting-function at line 1 <cljs repl>
#object[TypeError TypeError: Cannot read property 'call' of undefined]
TypeError: Cannot read property 'call' of undefined
at eval (eval at <anonymous> (http://localhost:3000/main.out/weasel/repl.js:30:470), <anonymous>:1\
:124)
at eval (eval at <anonymous> (http://localhost:3000/main.out/weasel/repl.js:30:470), <anonymous>:9\
:3)
at eval (eval at <anonymous> (http://localhost:3000/main.out/weasel/repl.js:30:470), <anonymous>:1\
4:4)
at http://localhost:3000/main.out/weasel/repl.js:30:465
at http://localhost:3000/main.out/weasel/repl.js:39:4
at cljs.core.MultiFn.call.G__10839__2 (http://localhost:3000/main.out/cljs/core.js:33327:106)
at cljs.core.MultiFn.call.G__10839 [as call] (http://localhost:3000/main.out/cljs/core.js:33594:20\
)
at .<anonymous> (http://localhost:3000/main.out/weasel/repl.js:184:71)
at goog.events.EventTarget.fireListeners (http://localhost:3000/main.out/goog/events/eventtarget.j\
s:284:23)
at Function.goog.events.EventTarget.dispatchEventInternal_ (http://localhost:3000/main.out/goog/ev\
ents/eventtarget.js:381:26)
recently CIDER was changed to automatically supply it's own cider-nrepl and clj-refactor middleware when starting lein, so you can (should) remove these from your ~/.lein/profifiles.clj file if you have them. This will clear up this warning. (remember to update to the latest cider emacs package.
WARNING: CIDER's version (0.12.0-snapshot) does not match
cider-nrepl's version (not installed). Things will break!
This is a problem and hopefully fixing it clears up your other problems. If not, at least solving this is a prerequisite to debugging it properly.

Using Scala's Runtime

I cd'd into a directory containing two Scala classes.
C:\Kevin\Workspace\>dir
09/08/2013 09:13 PM 331 Max.scala
09/08/2013 09:13 PM 459 Test.scala
2 File(s) 790 bytes
2 Dir(s) 72,008,863,744 bytes free
Then, I opened up REPL:
C:\Kevin\Workspace\>scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import java.lang.Runtime
import java.lang.Runtime
scala> val runtime = Runtime.getRuntime
runtime: Runtime = java.lang.Runtime#55dae09c
Then (with this post's help) I tried to compile my *.scala files via scalac as an argument to Runtime#exec, but it failed.
scala> runtime.exec("scalac Max.scala Test.scala")
java.io.IOException: Cannot run program "scalac": CreateProcess error=2, The system cannot find the file specifie
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at java.lang.Runtime.exec(Runtime.java:617)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)
at .<init>(<console>:12)
at .<clinit>(<console>)
How can I do the above in Scala?
I think this is not so much a Scala thing as it is a Windows thing, which I infer from your first code block.
On my Mac, I find this:
scala> Runtime.getRuntime.exec("scalac")
res2: Process = java.lang.UNIXProcess#24c63dac
On Windows, try providing the fully qualified path to scalac. If that doesn't work, consider using ProcessBuilder instead.

Standard ML syntax error: illegal token on hello world program -- incorrect SML installation?

The SML file: "test.sml"
(* here is a comment *)
val x = 123;
I've installed SMLNJ 110.76 from here: http://www.smlnj.org/dist/working/110.76/, Emacs 24.3.1 from here: http://ftp.gnu.org/gnu/emacs/windows/emacs-24.3-bin-i386.zip, and SML Mode for Emacs through the Emacs GUI.
The Emacs stack trace is this:
test.sml:1.2 Error: illegal token
test.sml:1.3 Error: illegal token
test.sml:1.5 Error: illegal token
test.sml:1.7 Error: illegal token
test.sml:1.9 Error: illegal token
and so on, ending with:
uncaught exception Compile [Compile: "syntax error"]
raised at: ../compiler/Parse/main/smlfile.sml:15.24-15.46
../compiler/TopLevel/interact/evalloop.sml:44.55
../compiler/TopLevel/interact/evalloop.sml:296.17-296.20
I also tried the same program via Sublime Text 3 with the SML and sublimeREPL packages as laid out here: http://developerinmotion.wordpress.com/2013/02/07/sublime-text-2-and-sml/. But I'm getting the same problem: a long list of illegal token syntax errors followed by:
C:\Program Files (x86)\SMLNJ\\bin\.run\run.x86-win32.exe: Fatal error -- Uncaught exception Compile with "syntax error" raised at ../compiler/Parse/main/smlfile.sml:15.24-15.46
What's the problem? Have I installed SMLNJ incorrectly?
I put your two lines in a file (test.sml) and opened in a standard SML REPL. It compiles normally:
- use "test.sml";
[opening test.sml]
val x = 123 : int
val it = () : unit
It seems that you have problems with setting your tools.
This problem may result from creating .sml file using UTF-8 character encoding. pls use ANSI instead.

When I using sublime and emacs as the development tool for scala, there are some errors occured

I use the sublime open the ensime project, the ensime server started normal.
After using it for a short time, the following errors occured.
Handling RPC: (swank:completions D:\Scala\ensime\src\main\scala\Main.scala 52 0)
Writing: 000086(:return (:abort 202 "Malformed swank:completions call: (swank:completions D:\Scala\ensime\src\main\scala\Main.scala 52 0)") 21)
Error in socket reader: java.io.EOFException: End of file reached in socket reader.
Got connection, creating handler...
When i use Emacs,from inside emacs,execute M-x ensime.the following errors occured.
d:\myemacs.emacs.d\ensime>set CLASSPATH="d:\myemacs.emacs.d\ensime\bin\..\lib\ant-1.6.5.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ant-1.8.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ant-launcher-1.8.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\asm-3.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\asm-commons-3.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\asm-tree-3.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\backport-util-concurrent-3.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\classworlds-1.1-alpha-2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\critbit-0.0.4.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ensime_2.9.2-RC1-0.9.3.RC4.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ivy-2.1.0.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-ant-tasks-2.1.0.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-artifact-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-artifact-manager-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-error-diagnostics-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-model-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-plugin-registry-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-profile-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-project-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-repository-metadata-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-settings-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\nekohtml-1.9.6.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\org.eclipse.jdt.core-3.6.0.v_A58.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\org.scala-refactoring_2.9.2-SNAPSHOT-0.5.0-SNAPSHOT.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\plexus-container-default-1.0-alpha-9-stable-1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\plexus-interpolation-1.11.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\plexus-utils-1.5.15.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\scala-compiler.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\scala-library.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\scalariform_2.9.1-0.1.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-file-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-http-lightweight-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-http-shared-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-provider-api-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\xercesMinimal-1.9.6.2.jar"
d:\myemacs.emacs.d\ensime>if "" == "" (set ENSIME_JVM_ARGS=-Xms256M -Xmx1512M -XX:PermSize=128m -Xss1M -Dfile.encoding=UTF-8 )
d:\myemacs.emacs.d\ensime>java -classpath "d:\myemacs.emacs.d\ensime\bin\..\lib\ant-1.6.5.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ant-1.8.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ant-launcher-1.8.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\asm-3.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\asm-commons-3.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\asm-tree-3.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\backport-util-concurrent-3.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\classworlds-1.1-alpha-2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\critbit-0.0.4.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ensime_2.9.2-RC1-0.9.3.RC4.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\ivy-2.1.0.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-ant-tasks-2.1.0.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-artifact-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-artifact-manager-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-error-diagnostics-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-model-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-plugin-registry-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-profile-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-project-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-repository-metadata-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\maven-settings-2.2.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\nekohtml-1.9.6.2.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\org.eclipse.jdt.core-3.6.0.v_A58.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\org.scala-refactoring_2.9.2-SNAPSHOT-0.5.0-SNAPSHOT.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\plexus-container-default-1.0-alpha-9-stable-1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\plexus-interpolation-1.11.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\plexus-utils-1.5.15.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\scala-compiler.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\scala-library.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\scalariform_2.9.1-0.1.1.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-file-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-http-lightweight-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-http-shared-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\wagon-provider-api-1.0-beta-6.jar;d:\myemacs.emacs.d\ensime\bin\..\lib\xercesMinimal-1.9.6.2.jar" -Xms256M -Xmx1512M -XX:PermSize=128m -Xss1M -Dfile.encoding=UTF-8 org.ensime.server.Server c:/Users/zxu/AppData/Local/Temp/ensime_port.5320
'java' is not recognized as an internal or external command,
operable program or batch file.
Process inferior-ensime-server exited abnormally with code 1
This problem troubled me for a long time,I can't sleep if these two problems were not be resolved.
Thanks!
My system environment:
OS: Window 7 64bit
JAVA: 1.7 or 1.6
Scala: 2.9.1 final
Sbt: 0.11.3
Ensime: ensime_2.9.2-RC1-0.9.3.RC4.tar.gz
Try adding your Java's bin directory to the PATH environment variable.