2

我想在 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但没有发现有用的输出。我该怎么做才能让它运行?

顺便提一句。我已经用 the 进行了测试,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)
4

1 回答 1

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 选择的主机名是我笔记本电脑的本地网络名称。但我不认为这是你的情况,因为上面命令行中的主机名是London,并且根据Apple“本地网络名称是您的计算机名称,添加了.local ”:由于您的命令行中的主机名不是London.local,显然在您的情况下JDI正在尝试为您的计算机使用另一个非本地网络名称。

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

127.0.0.1    localhost

127.0.0.1    localhost    London

我知道必须/etc/hosts在 2019 年进行修改并不理想……

于 2019-04-30T16:38:47.173 回答