簡體   English   中英

嘗試從命令行執行 JDTLS(Java 語言服務器)時無法獲取應用程序服務

[英]Unable to acquire application service when trying to execute JDTLS (Java language server) from command line

我一直在嘗試使JDTLS(java 語言服務器)與 nvim LSP 功能一起使用,但在解決了一些問題后,我遇到了日志文件中寫入的以下錯誤:

注意:在評論中發現了一個線索,它正在嘗試導入 org. E clipse.core.runtime 而不是全小寫版本。

!SESSION 2021-12-12 19:01:39.652 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=es_ES
Framework arguments:  -configuration ./config_win/config.ini -data /LanguageServers/data --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED
Command-line arguments:  -configuration ./config_win/config.ini -data /LanguageServers/data --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED

!ENTRY org.eclipse.osgi 4 0 2021-12-12 19:01:39.988
!MESSAGE Bundle org.Eclipse.core.runtime not found.

!ENTRY org.eclipse.osgi 4 0 2021-12-12 19:01:39.995
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:81)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1440)

正如日志建議的那樣,我檢查了./config_win中的config.ini ,以驗證服務器是否具有正確啟動 org.eclipse.core.runtime 包的配置文件:

#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Fri Nov 26 15:16:43 UTC 2021
eclipse.product=org.eclipse.jdt.ls.core.product
osgi.bundles=reference\:file\:ch.qos.logback.classic_1.2.3.v20200428-2012.jar@4,reference\:file\:ch.qos.logback.core_1.2.3.v20200428-2012.jar@4,reference\:file\:ch.qos.logback.slf4j_1.2.3.v20200428-2012.jar@4,reference\:file\:com.google.gson_2.8.8.v20211029-0838.jar@4,reference\:file\:com.google.guava_30.1.0.v20210127-2300.jar@4,reference\:file\:javax.inject_1.0.0.v20091030.jar@4,reference\:file\:org.apache.ant_1.10.12.v20211102-1452/@4,reference\:file\:org.apache.commons.lang3_3.1.0.v201403281430.jar@4,reference\:file\:org.apache.felix.scr_2.1.24.v20200924-1939.jar@2\:start,reference\:file\:org.apache.log4j_1.2.15.v201012070815.jar@4,reference\:file\:org.eclipse.ant.core_3.6.200.v20210907-1007.jar@4,reference\:file\:org.eclipse.buildship.compat_3.1.6.v20211108-1823-s.jar@4,reference\:file\:org.eclipse.buildship.core_3.1.6.v20211108-1823-s.jar@4,reference\:file\:org.eclipse.compare.core_3.6.1000.v20201020-1107.jar@4,reference\:file\:org.eclipse.core.commands_3.10.100.v20210722-1426.jar@4,reference\:file\:org.eclipse.core.contenttype_3.8.100.v20210910-0640.jar@4,reference\:file\:org.eclipse.core.expressions_3.8.100.v20210910-0640.jar@4,reference\:file\:org.eclipse.core.filebuffers_3.7.100.v20210909-1906.jar@4,reference\:file\:org.eclipse.core.filesystem_1.9.200.v20210912-1851.jar@4,reference\:file\:org.eclipse.core.jobs_3.12.0.v20210723-1034.jar@4,reference\:file\:org.eclipse.core.net_1.3.1100.v20210424-0724.jar@4,reference\:file\:org.eclipse.core.net.win32.x86_64_1.1.500.v20190925-1337.jar@4,reference\:file\:org.eclipse.core.resources_3.16.0.v20211001-2032.jar@4,reference\:file\:org.eclipse.core.runtime_3.24.0.v20210910-0750.jar@4\:start,reference\:file\:org.eclipse.core.variables_3.5.100.v20210721-1355.jar@4,reference\:file\:org.eclipse.debug.core_3.18.300.v20211104-1443.jar@4,reference\:file\:org.eclipse.equinox.app_1.6.100.v20211021-1418.jar@4,reference\:file\:org.eclipse.equinox.common_3.15.100.v20211021-1418.jar@2\:start,reference\:file\:org.eclipse.equinox.frameworkadmin_2.2.0.v20210315-2042.jar@4,reference\:file\:org.eclipse.equinox.frameworkadmin.equinox_1.2.100.v20210703-1540.jar@4,reference\:file\:org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar@4,reference\:file\:org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.400.v20211116-1129/@4,reference\:file\:org.eclipse.equinox.preferences_3.9.100.v20211021-1418.jar@4,reference\:file\:org.eclipse.equinox.registry_3.11.100.v20211021-1418.jar@4,reference\:file\:org.eclipse.equinox.security_1.3.800.v20211021-1418.jar@4,reference\:file\:org.eclipse.equinox.security.win32.x86_64_1.1.300.v20211021-1418.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.4.0.v20210315-2228.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator.manipulator_2.2.0.v20210315-2228.jar@4,reference\:file\:org.eclipse.jdt.apt.core_3.7.50.v20210914-1429.jar@4,reference\:file\:org.eclipse.jdt.apt.pluggable.core_1.3.0.v20210618-1653.jar@4,reference\:file\:org.eclipse.jdt.compiler.apt_1.4.50.v20210914-1429.jar@4,reference\:file\:org.eclipse.jdt.compiler.tool_1.3.50.v20210925-0955.jar@4,reference\:file\:org.eclipse.jdt.core_3.28.0.v20211106-1940.jar@4,reference\:file\:org.eclipse.jdt.core.manipulation_1.15.100.v20211115-1252.jar@4,reference\:file\:org.eclipse.jdt.debug_3.19.0.v20211112-1303/@4,reference\:file\:org.eclipse.jdt.junit.core_3.11.100.v20211112-1026.jar@4,reference\:file\:org.eclipse.jdt.junit.runtime_3.6.100.v20210708-1502.jar@4,reference\:file\:org.eclipse.jdt.launching_3.19.400.v20211011-0920.jar@4,reference\:file\:org.eclipse.jdt.ls.core_1.6.0.202111261512.jar@4\:start,reference\:file\:org.eclipse.lsp4j_0.11.0.v20210319-1406.jar@4,reference\:file\:org.eclipse.lsp4j.jsonrpc_0.11.0.v20210319-1406.jar@4,reference\:file\:org.eclipse.ltk.core.refactoring_3.12.100.v20210926-1112.jar@4,reference\:file\:org.eclipse.m2e.archetype.common_1.18.1.20211011-2139/@4,reference\:file\:org.eclipse.m2e.core_1.18.2.20211011-2139.jar@4,reference\:file\:org.eclipse.m2e.jdt_1.18.2.20211002-1029.jar@4,reference\:file\:org.eclipse.m2e.lifecyclemapping.defaults_1.17.1.20210115-1536.jar@4,reference\:file\:org.eclipse.m2e.logback.configuration_1.16.3.20211002-1029.jar@4\:start,reference\:file\:org.eclipse.m2e.maven.indexer_1.18.1.20211011-2139/@4,reference\:file\:org.eclipse.m2e.maven.runtime_1.18.1.20211011-2139/@4,reference\:file\:org.eclipse.m2e.maven.runtime.slf4j.simple_1.18.1.20211008-0657/@4,reference\:file\:org.eclipse.m2e.workspace.cli_0.3.1.jar@4,reference\:file\:org.eclipse.osgi.services_3.10.200.v20210723-0643.jar@4,reference\:file\:org.eclipse.osgi.util_3.6.100.v20210723-1119.jar@4,reference\:file\:org.eclipse.text_3.12.0.v20210512-1644.jar@4,reference\:file\:org.eclipse.xtend.lib_2.25.0.v20210301-0821.jar@4,reference\:file\:org.eclipse.xtend.lib.macro_2.25.0.v20210301-0821.jar@4,reference\:file\:org.eclipse.xtext.xbase.lib_2.25.0.v20210301-0821.jar@4,reference\:file\:org.gradle.toolingapi_7.1.1.v20211108-1823-s.jar@4,reference\:file\:org.hamcrest.core_1.3.0.v20180420-1519.jar@4,reference\:file\:org.jboss.tools.maven.apt.core_1.5.3.201911081053.jar@4,reference\:file\:org.junit_4.13.2.v20211018-1956.jar@4,reference\:file\:org.slf4j.api_1.7.30.v20200204-2150.jar@4
eclipse.p2.data.area=@config.dir/../p2
eclipse.p2.profile=DefaultProfile
osgi.bundles.defaultStartLevel=4
eclipse.application=org.eclipse.jdt.ls.core.id1
osgi.framework=file\:plugins/org.eclipse.osgi_3.17.100.v20211104-1730.jar
osgi.framework.extensions=reference\:file\:org.eclipse.osgi.compatibility.state_1.2.500.v20210730-0750.jar

我嘗試將丟失的捆綁包作為參數傳遞,但錯誤仍然存在。

此事的相關資料:

  • Windows 10(由於我團隊的外部限制,沒有使用 WSL)
  • 使用的JDK版本:17.0.1(我試過其他的結果相同)
  • PowerShell 7.2.0 中使用以下命令執行:

java“-Declipse.application=org.eclipse.jdt.ls.core.id1”
“-Dosgi.bundles.defaultStartLevel=4” “-Declipse.product=org.eclipse.jdt.ls.core.product” “-Dlog.level=ALL” “-Xmx1G” -jar./plugins/org.eclipse。 equinox.launcher_1.6.400.v20210924-0641.jar "-configuration./config_win/config.ini" "-data /LanguageServers/data" "--add-modules=ALL-SYSTEM" "--add-opens Z93F725A47423FED21F486F /java.util=ALL-UNNAMED" "--add-opens java.base/java.lang=ALL-UNNAMED"

最后,我通過在cmd上使用以下命令使其工作(這可能是 PowerShell 如何處理參數或這些行上的東西的問題):

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar ./plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration ./config_win -data ./myworkspace --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM