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

Compile bug with javac #3897

Closed
XuPengfei-1020 opened this issue Dec 19, 2024 · 4 comments
Closed

Compile bug with javac #3897

XuPengfei-1020 opened this issue Dec 19, 2024 · 4 comments
Assignees
Labels

Comments

@XuPengfei-1020
Copy link

I get this error after I set javac as compiler.
And compile can not be finished correctly.

{
message: '[Error - 3:02:24 PM] Dec 19, 2024, 3:02:24 PM Failed to initialize the custom compiler factory - org.eclipse.jdt.internal.javac.JavacCompilerFactory\n' +
'org.eclipse.jdt.internal.javac.JavacCompilerFactory cannot be found by org.eclipse.jdt.core_3.40.0.z20241127-1618\n' +
'java.lang.ClassNotFoundException: org.eclipse.jdt.internal.javac.JavacCompilerFactory cannot be found by org.eclipse.jdt.core_3.40.0.z20241127-1618\n' +
'\tat org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562)\n' +
'\tat org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557)\n' +
'\tat org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)\n' +
'\tat org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)\n' +
'\tat java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528)\n' +
'\tat java.base/java.lang.Class.forName0(Native Method)\n' +
'\tat java.base/java.lang.Class.forName(Class.java:462)\n' +
'\tat java.base/java.lang.Class.forName(Class.java:453)\n' +
'\tat org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.newCompiler(AbstractImageBuilder.java:612)\n' +
'\tat org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.(AbstractImageBuilder.java:134)\n' +
'\tat org.eclipse.jdt.internal.core.builder.BatchImageBuilder.(BatchImageBuilder.java:86)\n' +
'\tat org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:313)\n' +
'\tat org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:220)\n' +
'\tat org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)\n' +
'\tat org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)\n' +
'\tat org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)\n' +
'\tat org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)\n' +
'\tat org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)\n' +
'\tat org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)\n' +
'\tat org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)\n' +
'\tat org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)\n' +
'\tat org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)\n' +
'\tat org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)\n' +
'\tat org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)\n' +
'\tat org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)\n' +
'\tat org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)\n',
level: 'info',
timestamp: '2024-12-19 15:02:24.342'
}

@XuPengfei-1020
Copy link
Author

// start java config
    "java.jdt.ls.java.home": "/Library/Java/JavaVirtualMachines/jdk-23.0.1.jdk/Contents/Home",
    "java.project.resourceFilters": [
        "node_modules",
        "\\.git",
        "\\.history"
    ],
    "java.completion.importOrder": [
        "#",
        "com",
        "io",
        "org",
        "",
        "javax",
        "",
        "java",
        "",
        "static"
    ],
    "java.completion.favoriteStaticMembers": [
        "java.util.Objects.*",
        "org.junit.Assert.*",
        "org.junit.Assume.*",
        "org.junit.jupiter.api.Assertions.*",
        "org.junit.jupiter.api.Assumptions.*",
        "org.junit.jupiter.api.DynamicContainer.*",
        "org.junit.jupiter.api.DynamicTest.*",
        "org.mockito.Mockito.*",
        "org.mockito.ArgumentMatchers.*",
        "org.mockito.Answers.*"
    ],
    "java.jdt.ls.androidSupport.enabled": "off",
    "java.jdt.ls.javac.enabled": "on",
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-17",
            "path": "/Library/Java/JavaVirtualMachines/jdk-17.0.7.jdk/Contents/Home"
        }
    ],
    "java.project.outputPath": "${workspaceFolder}/target/jdt_output",
    "java.maxConcurrentBuilds": 2,
    // end java config

@rgrunber rgrunber added the javac label Dec 19, 2024
@rgrunber
Copy link
Member

Looks like its happening at https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/blob/3d3f6fc78f42c66d670a3ecb1bd5a5d9edf1aa26/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java#L612 .

I guess this could happen if the bundle just failed to start correctly due to dependencies.

Would you be able to temporarily add "java.trace.server": "verbose", relaunch to reproduce the error and then attach the contents of Java: Open Java Language Server Log File .

@XuPengfei-1020
Copy link
Author

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:09.323
!MESSAGE >> shutdown

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:09.616
!MESSAGE >> exit

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:10.980
!MESSAGE Shutdown received... waking up main thread

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:11.554
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is stopping:
!SESSION 2024-12-20 09:56:24.591 -----------------------------------------------
eclipse.buildId=unknown
java.version=23.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_CN
Framework arguments:  --pipe=/private/var/folders/c5/7197pcqx71j0v3m185cgsm040000gp/T/lsp-50dc7269b7df29e819952604d6df96e1.sock
Command-line arguments:  -data /Users/xupengfei/Library/Application Support/Cursor/User/workspaceStorage/c19b2484177d43e3bbdcd20fcb784762/redhat.java/jdt_ws --pipe=/private/var/folders/c5/7197pcqx71j0v3m185cgsm040000gp/T/lsp-50dc7269b7df29e819952604d6df96e1.sock

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:30.398
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:30.965
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:31.540
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:31.544
!MESSAGE Initializing Java Language Server 1.42.0.202411280416

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:31.545
!MESSAGE Started org.eclipse.m2e.core 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:31.549
!MESSAGE ProjectRegistryRefreshJob finished 2ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:31.617
!MESSAGE Started org.eclipse.buildship.core 68ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:32.871
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.120
!MESSAGE Non-Static Commands: [java.project.import, java.project.changeImportedProjects, java.navigate.openTypeHierarchy, java.project.resolveStackTraceLocation, java.edit.handlePasteEvent, java.edit.stringFormatting, java.project.getSettings, java.project.resolveWorkspaceSymbol, java.project.upgradeGradle, java.project.createModuleInfo, java.vm.getAllInstalls, java.edit.organizeImports, java.project.refreshDiagnostics, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.updateSettings, java.project.getAll, java.reloadBundles, java.project.isTestFile, java.project.resolveText, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.smartSemicolonDetection, java.project.updateSourceAttachment, java.project.updateClassPaths, java.decompile, java.protobuf.generateSources, java.project.resolveSourceAttachment, java.project.updateJdk, java.project.addToSourcePath, java.completion.onDidSelect]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.120
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.121
!MESSAGE Non-Static Commands: [java.intellicode.enable]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.122
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.123
!MESSAGE Non-Static Commands: [java.gradle.delegateTest]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.124
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.125
!MESSAGE Non-Static Commands: [vscode.java.checkProjectSettings, vscode.java.isOnClasspath, vscode.java.fetchUsageData, vscode.java.validateLaunchConfig, vscode.java.resolveInlineVariables, vscode.java.resolveClassFilters, vscode.java.resolveMainMethod, vscode.java.resolveClasspath, vscode.java.resolveBuildFiles, vscode.java.resolveMainClass, vscode.java.updateDebugSettings, vscode.java.resolveSourceUri, vscode.java.fetchPlatformSettings, vscode.java.buildWorkspace, vscode.java.startDebugSession, vscode.java.inferLaunchCommandLength, vscode.java.resolveElementAtSelection, vscode.java.resolveJavaExecutable]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.126
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.127
!MESSAGE Non-Static Commands: [java.project.refreshLib, java.project.checkImportStatus, java.project.list, java.project.generateJar, java.project.getMainClasses, java.getPackageData, java.resolvePath]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.127
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.128
!MESSAGE Non-Static Commands: [vscode.java.test.jacoco.getCoverageDetail, vscode.java.test.findJavaProjects, vscode.java.test.findTestPackagesAndTypes, vscode.java.test.findTestTypesAndMethods, vscode.java.test.resolvePath, vscode.java.test.findTestLocation, vscode.java.test.get.testpath, vscode.java.test.findDirectTestChildrenForClass, vscode.java.test.navigateToTestOrTarget, vscode.java.test.junit.argument, vscode.java.test.generateTests]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.129
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.129
!MESSAGE Non-Static Commands: [java.maven.initializeSearcher, java.maven.searchArtifact, java.maven.addDependency, java.maven.controlContext]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:33.193
!MESSAGE >> initialized

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:34.515
!MESSAGE RepositoryRegistryUpdateJob finished 1ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:35.281
!MESSAGE Importing Maven project(s)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:35.709
!MESSAGE Workspace initialized in 1189ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:56:35.743
!MESSAGE >> initialization job finished

!ENTRY org.eclipse.buildship.core 2 0 2024-12-20 09:56:42.989
!MESSAGE Could not load Gradle version information
!STACK 0
org.gradle.api.UncheckedIOException: Cannot download published Gradle versions.
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.downloadVersionInformation(PublishedGradleVersions.java:167)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.tryToDownloadAndCacheVersions(PublishedGradleVersions.java:151)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.create(PublishedGradleVersions.java:111)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersionsWrapper$LoadVersionsJob.run(PublishedGradleVersionsWrapper.java:73)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.net.SocketTimeoutException: Read timed out
	at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:278)
	at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:304)
	at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
	at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
	at java.base/java.net.Socket$SocketInputStream.implRead(Socket.java:1116)
	at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1103)
	at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:489)
	at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:483)
	at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1507)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1422)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
	at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:586)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:187)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1691)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1615)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
	at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.downloadVersionInformation(PublishedGradleVersions.java:164)
	... 4 more

!ENTRY org.eclipse.core.resources 4 2 2024-12-20 09:56:53.487
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.IllegalAccessError: superclass access check failed: class org.eclipse.jdt.internal.javac.ProceedOnErrorGen (in unnamed module @0x192a496) cannot access class com.sun.tools.javac.jvm.Gen (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.jvm to unnamed module @0x192a496
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1026)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:293)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:774)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:691)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:657)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:644)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:616)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:348)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:414)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:520)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528)
	at org.eclipse.jdt.internal.javac.JavacCompiler.compile(JavacCompiler.java:111)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:441)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:250)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:372)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:118)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:314)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:226)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.core.resources 4 2 2024-12-20 09:57:09.191
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.IllegalAccessError: superclass access check failed: class org.eclipse.jdt.internal.javac.ProceedOnErrorGen (in unnamed module @0x192a496) cannot access class com.sun.tools.javac.jvm.Gen (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.jvm to unnamed module @0x192a496
	at org.eclipse.jdt.internal.javac.JavacCompiler.compile(JavacCompiler.java:111)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:441)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:250)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:372)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:118)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:314)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:226)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:57:40.872
!MESSAGE >> build jobs finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:57:40.874
!MESSAGE >> registerWatchers'

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-12-20 09:57:40.877
!MESSAGE >> registerFeature 'workspace/didChangeWatchedFiles'

It look like a network issue, What is the destination that 'published gradle version' download from? May be I can proxy it with VPN and try again.

@rgrunber
Copy link
Member

This should be fixed in the pre-releases now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

3 participants