ritz-nrepl与lein没有在osx上工作

时间:2013-07-25 14:10:16

标签: macos emacs clojure leiningen nrepl

我想在Emacs中使用ritz-nrepl进行调试。因为lein ritz-nrepl已经失败了,所以我没有进一步了解Emacs集成。

Exception in thread "main" com.sun.jdi.connect.VMStartException: 
   VM initialization failed for: ...

完整的堆栈跟踪显示在帖子的末尾。我知道这个例外已经有一段时间了,并且有可能修复,但这对我的情况没有帮助:

否则,nrepl等人。在我的系统上工作得很好。我正在使用clojure 1.5.1

$> lein version
Leiningen 2.2.0 on Java 1.7.0_25 Java HotSpot(TM) 64-Bit Server VM

我的~/.lein/profiles.clj看起来像这样:

{:user
  {:plugins [[lein-ritz "0.7.0"]]
   :dependencies [[nrepl-inspect "0.3.0"]
             [org.clojure/tools.trace "0.7.5"]
             [ritz/ritz-nrepl-middleware "0.7.0"]
             [ritz/ritz-debugger "0.7.0"]
             [clojure-complete "0.2.3"]]
   :repl-options {:nrepl-middleware
             [ritz.nrepl.middleware.javadoc/wrap-javadoc
              ritz.nrepl.middleware.simple-complete/wrap-simple-complete
              inspector.middleware/wrap-inspect]}}}

在lein项目中,我运行lein ritz-nrepl。但是由于上述异常,这失败了。我已经运行lein ritz-nrepl -l trace但没有找到有用的输出。我该怎么做才能让它运转起来?

顺便说一句。我用ritz 0.7.1-SNAPSHOT对此进行了测试,但错误仍然存​​在。

我错过了一些明显的东西吗?任何帮助是极大的赞赏。

干杯!

完整的堆栈跟踪:

Exception in thread "main" com.sun.jdi.connect.VMStartException: VM initialization failed for: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre/bin/java -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xdebug -Xrunjdwp:transport=dt_socket,address=London:58846,suspend=y -cp /private/tmp/test/test:/private/tmp/test/src:/private/tmp/test/dev-resources:/private/tmp/test/resources:/private/tmp/test/target/classes:/Users/me/.m2/repository/reply/reply/0.1.9/reply-0.1.9.jar:/Users/me/.m2/repository/org/thnetos/cd-client/0.3.6/cd-client-0.3.6.jar:/Users/me/.m2/repository/org/sonatype/aether/aether-connector-wagon/1.13.1/aether-connector-wagon-1.13.1.jar:/Users/me/.m2/repository/quoin/quoin/0.1.0/quoin-0.1.0.jar:/Users/me/.m2/repository/useful/useful/0.8.3-alpha8/useful-0.8.3-alpha8.jar:/Users/me/.m2/repository/org/clojure/java.classpath/0.2.0/java.classpath-0.2.0.jar:/Users/me/.m2/repository/clj-stacktrace/clj-stacktrace/0.2.4/clj-stacktrace-0.2.4.jar:/Users/me/.m2/repository/org/clojure/core.cache/0.6.2/core.cache-0.6.2.jar:/Users/me/.m2/repository/org/apache/maven/indexer/indexer-core/4.1.3/indexer-core-4.1.3.jar:/Users/me/.m2/repository/org/tcrawley/dynapath/0.2.3/dynapath-0.2.3.jar:/Users/me/.m2/repository/classlojure/classlojure/0.6.6/classlojure-0.6.6.jar:/Users/me/.m2/repository/ritz/ritz-nrepl-core/0.7.1-SNAPSHOT/ritz-nrepl-core-0.7.1-SNAPSHOT.jar:/Users/me/.m2/repository/org/clojure/tools.trace/0.7.5/tools.trace-0.7.5.jar:/Users/me/.m2/repository/org/clojure/data.xml/0.0.3/data.xml-0.0.3.jar:/Users/me/.m2/repository/org/apache/maven/wagon/wagon-http/2.2/wagon-http-2.2.jar:/Users/me/.m2/repository/org/sonatype/aether/aether-connector-file/1.13.1/aether-connector-file-1.13.1.jar:/Users/me/.m2/repository/stencil/stencil/0.3.1/stencil-0.3.1.jar:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar:/Users/me/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.2.3/sisu-inject-bean-2.2.3.jar:/Users/me/.m2/repository/org/apache/maven/indexer/indexer-artifact/4.1.3/indexer-artifact-4.1.3.jar:/Users/me/.m2/repository/org/apache/lucene/lucene-memory/3.6.1/lucene-memory-3.6.1.jar:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar:/Users/me/.m2/repository/jakarta-regexp/jakarta-regexp/1.4/jakarta-regexp-1.4.jar:/Users/me/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.7/plexus-utils-2.0.7.jar:/Users/me/.m2/repository/org/apache/httpcomponents/httpclient/4.2.2/httpclient-4.2.2.jar:/Users/me/.m2/repository/slingshot/slingshot/0.8.0/slingshot-0.8.0.jar:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/me/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-smile/2.0.6/jackson-dataformat-smile-2.0.6.jar:/Users/me/.m2/repository/org/apache/httpcomponents/httpcore/4.2.2/httpcore-4.2.2.jar:/Users/me/.m2/repository/org/clojars/trptcolin/sjacket/0.1.0.2/sjacket-0.1.0.2.jar:/Users/me/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.0.6/jackson-core-2.0.6.jar:/Users/me/.m2/repository/org/apache/maven/wagon/wagon-http-shared4/2.2/wagon-http-shared4-2.2.jar:/Users/me/.m2/repository/org/apache/maven/maven-model-builder/3.0.4/maven-model-builder-3.0.4.jar:/Users/me/.m2/repository/org/clojure/tools.macro/0.1.1/tools.macro-0.1.1.jar:/Users/me/.m2/repository/cheshire/cheshire/4.0.3/cheshire-4.0.3.jar:/Users/me/.m2/repository/com/cemerick/pomegranate/0.0.13/pomegranate-0.0.13.jar:/Users/me/.m2/repository/jline/jline/2.8/jline-2.8.jar:/Users/me/.m2/repository/scout/scout/0.1.0/scout-0.1.0.jar:/Users/me/.m2/repository/clj-http/clj-http/0.5.8/clj-http-0.5.8.jar:/Users/me/.m2/repository/leiningen-core/leiningen-core/2.0.0/leiningen-core-2.0.0.jar:/Users/me/.m2/repository/org/apache/maven/maven-aether-provider/3.0.4/maven-aether-provider-3.0.4.jar:/Users/me/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/Users/me/.m2/repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar:/Users/me/.m2/repository/clj-http-lite/clj-http-lite/0.2.0/clj-http-lite-0.2.0.jar:/Users/me/.m2/repository/nrepl-inspect/nrepl-inspect/0.3.0/nrepl-inspect-0.3.0.jar:/Users/me/.m2/repository/ritz/ritz-debugger/0.7.1-SNAPSHOT/ritz-debugger-0.7.1-SNAPSHOT.jar:/Users/me/.m2/repository/org/jsoup/jsoup/1.6.1/jsoup-1.6.1.jar:/Users/me/.m2/repository/org/sonatype/aether/aether-api/1.13.1/aether-api-1.13.1.jar:/Users/me/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar:/Users/me/.m2/repository/net/cgrand/regex/1.1.0/regex-1.1.0.jar:/Users/me/.m2/repository/org/codehaus/plexus/plexus-classworlds/2.4/plexus-classworlds-2.4.jar:/Users/me/.m2/repository/org/sonatype/sisu/sisu-guice/3.0.3/sisu-guice-3.0.3-no_aop.jar:/Users/me/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/Users/me/.m2/repository/trptcolin/versioneer/0.1.0/versioneer-0.1.0.jar:/Users/me/.m2/repository/org/apache/lucene/lucene-highlighter/3.6.1/lucene-highlighter-3.6.1.jar:/Users/me/.m2/repository/org/sonatype/aether/aether-impl/1.13.1/aether-impl-1.13.1.jar:/Users/me/.m2/repository/bultitude/bultitude/0.1.7/bultitude-0.1.7.jar:/Users/me/.m2/repository/robert/hooke/1.3.0/hooke-1.3.0.jar:/Users/me/.m2/repository/ritz/ritz-nrepl/0.7.1-SNAPSHOT/ritz-nrepl-0.7.1-SNAPSHOT.jar:/Users/me/.m2/repository/ritz/ritz-repl-utils/0.7.1-SNAPSHOT/ritz-repl-utils-0.7.1-SNAPSHOT.jar:/Users/me/.m2/repository/org/apache/maven/maven-repository-metadata/3.0.4/maven-repository-metadata-3.0.4.jar:/Users/me/.m2/repository/org/clojure/tools.nrepl/0.2.3/tools.nrepl-0.2.3.jar:/Users/me/.m2/repository/org/apache/lucene/lucene-queries/3.6.1/lucene-queries-3.6.1.jar:/Users/me/.m2/repository/com/cemerick/drawbridge/0.0.6/drawbridge-0.0.6.jar:/Users/me/.m2/repository/org/apache/maven/maven-model/3.0.4/maven-model-3.0.4.jar:/Users/me/.m2/repository/org/clojure/tools.namespace/0.2.3/tools.namespace-0.2.3.jar:/Users/me/.m2/repository/org/clojure/tools.cli/0.2.1/tools.cli-0.2.1.jar:/Users/me/.m2/repository/org/sonatype/aether/aether-spi/1.13.1/aether-spi-1.13.1.jar:/Users/me/.m2/repository/org/apache/httpcomponents/httpmime/4.2.2/httpmime-4.2.2.jar:/Users/me/.m2/repository/org/apache/lucene/lucene-core/3.6.1/lucene-core-3.6.1.jar:/Users/me/.m2/repository/leiningen/leiningen/2.0.0/leiningen-2.0.0.jar:/Users/me/.m2/repository/ritz/ritz-nrepl-middleware/0.7.1-SNAPSHOT/ritz-nrepl-middleware-0.7.1-SNAPSHOT.jar:/Users/me/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar:/Users/me/.m2/repository/org/sonatype/sisu/sisu-inject-plexus/2.2.3/sisu-inject-plexus-2.2.3.jar:/Users/me/.m2/repository/org/apache/maven/wagon/wagon-provider-api/2.2/wagon-provider-api-2.2.jar:/Users/me/.m2/repository/net/cgrand/parsley/0.9.1/parsley-0.9.1.jar:/Users/me/.m2/repository/org/clojure/java.classpath/0.2.0/java.classpath-0.2.0-sources.jar:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14-sources.jar:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5-sources.jar:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar:/Users/me/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1-sources.jar:/Users/me/.m2/repository/org/codehaus/plexus/plexus-classworlds/2.4/plexus-classworlds-2.4-sources.jar:/Users/me/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6-sources.jar:/Users/me/.m2/repository/org/clojure/tools.nrepl/0.2.3/tools.nrepl-0.2.3-sources.jar:/Users/me/.m2/repository/org/clojure/tools.namespace/0.2.3/tools.namespace-0.2.3-sources.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/lib/sa-jdi.jar clojure.main -i /private/var/folders/07/mlnfr3g573g13w374qm17s_c0000gn/T/ritz-init3860568408072505479.clj
at com.sun.tools.jdi.AbstractLauncher$Helper.launchAndAccept(AbstractLauncher.java:192)
at com.sun.tools.jdi.AbstractLauncher.launch(AbstractLauncher.java:132)
at com.sun.tools.jdi.SunCommandLineLauncher.launch(SunCommandLineLauncher.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at ritz.jpda.jdi$launch.invoke(jdi.clj:86)
at ritz.jpda.jdi_vm$launch_vm.invoke(jdi_vm.clj:176)
at ritz.jpda.debug$launch_vm.invoke(debug.clj:59)
at ritz.nrepl$start_jpda_server.invoke(nrepl.clj:259)
at user$eval6209.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)

1 个答案:

答案 0 :(得分:0)

我知道这个问题很古老,但是我有一个可能的答案,因为我有一个类似的问题,所以在2019年仍然有用。问题是您的调试器正在尝试通过JDI连接到要调试的进程,但是它失败了。让我们看一下“ VM初始化失败”消息之后的长长的命令行:

 /.../.../java ... -Xrunjdwp:transport=dt_socket,address=London:58846,suspend=y ... clojure.main ...

这是JDI用于启动JVM的命令行,该JVM反过来运行clojure +要调试的程序。 -Xrunjdwp选项意味着启动后,JVM将尝试通过套接字连接到调试器。确切地说,address=London:58846字符串是调试器进程正在侦听,等待下级连接的网络地址和端口。某些版本的macOS(与Sierra(在我的情况下为Mojave)一起报告)的问题在于macOS无法将主机名(在您的情况下为London)解析为IP地址,从而导致JVM无法连接到调试器。在我的情况下,发生这种情况是因为JDI选择的主机名是笔记本电脑的local network name。但是我不认为这是您的情况,因为上述命令行中的主机名是London,并且根据Apple的说法,“本地网络名称是您的计算机名称,其中添加了 .local ”:由于您命令行中的主机名不是London.local,因此显然您的情况是JDI尝试为您的计算机使用另一个非本地网络名。

现在是解决方案,假设运行调试程序的London机器与运行调试程序的机器相同(这是很常见的情况)。您需要做的是“说服” macOS来注册主机名并将其关联到您计算机的IP地址。仅作记录,就我而言,在this post上提出的解决方法就足够了:我启动了一项共享服务,而macOS注册了我计算机的本地网络名称。在您的情况下,我不太了解您的网络设置,因此只能提出一个丑陋的建议:编辑/etc/hosts文件(您必须sudo vimsudo nano)并映射回送IP通过修改行将地址127.0.0.1更改为您的主机名

127.0.0.1    localhost

127.0.0.1    localhost    London

我知道在2019年不得不修改/etc/hosts并不理想...