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

Cannot invoke o.e.j.i.c.u.JrtFileSystem.walkModuleImage() #1212

Closed
TBug001 opened this issue Sep 4, 2022 · 24 comments
Closed

Cannot invoke o.e.j.i.c.u.JrtFileSystem.walkModuleImage() #1212

TBug001 opened this issue Sep 4, 2022 · 24 comments
Assignees
Labels

Comments

@TBug001
Copy link

TBug001 commented Sep 4, 2022

Type: Bug

I'm not much of a GitHub user, so let me briefly describe my problem.

I don't know since when I use VScode to open Java files, I will be prompted to use JDK17, but at this time, I can still use DEBUG. After a period of time, when I use it again, the DEBUG will not be able to use, and the following error will be displayed. I guess it is the problem of the plug-in "Debugger for Java", but I can't solve it after lowering the version.

Cannot invoke "org.eclipse.jdt.internal.compiler.util.JrtFileSystem.walkModuleImage(org.eclipse.jdt.internal.compiler.util.JRTUtil$JrtFileVisitor, int)" because the return value of "org.eclipse.jdt.internal.compiler.util.JRTUtil.getJrtSystem(java.io.File, String)" is null
err1
err2
err3
err4

Extension version: 0.44.0
VS Code version: Code 1.71.0 (784b0177c56c607789f9638da7b6bf3230d47a8c, 2022-09-01T07:36:10.600Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8300H CPU @ 2.30GHz (8 x 2304)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 15.86GB (7.54GB free)
Process Argv --crash-reporter-id d984063b-117c-401c-9522-5dc0346638b3
Screen Reader no
VM 50%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30557514
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vscaat:30438848
pylanb8912:30545647
vsclangdf:30486550
c4g48928:30535728
hb751961:30553087
dsvsc012:30540252
azure-dev_surveyone:30548225
2144e591:30553903

@amwestrich
Copy link

Having the same issue but on Linux with openjdk 17.

@amwestrich
Copy link

The version from two months ago, v1.8.2022062904 doesn't have the issue.

@testforstephen
Copy link
Contributor

@TBug001 @amwestrich Could you please provide more details (e.g. the full exception log) about this error? It's better to provide a sample project for us to reproduce the error.

@bib1963
Copy link

bib1963 commented Sep 8, 2022

I see this as well. It needs nothing special, just create a new java project and the error will appear. The only source file is the default App.java which is automatically created.This is with Linux with java-11-openjdk-devel-11.0.16.0.
error.log
j1.zip

@weberhofer
Copy link

I see exactly the same issue in the new 2022-09 release of eclipse using openSUSE Leap and OpenJDK Runtime Environment 17.0.4+8 as soon as one of my Java projects start building.

@jadavis42
Copy link

@amwestrich is correct. I downgraded Language Support for Java(TM) by Red Hat to older version v1.8.2022062904 and the problem goes away. I'm using VS Code on Windows 10 with jdk 17

@TBug001
Copy link
Author

TBug001 commented Sep 15, 2022

@TBug001
Copy link
Author

TBug001 commented Sep 15, 2022

Here is my configuration file. Can you help me see what's wrong? Now there is a problem with VScode. I need to use IDEA to write an algorithm problem, which is very troublesome

`{
"code-runner.runInTerminal": true,
"code-runner.ignoreSelection": true,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"/.classpath": true,
"
/.project": true,
"/.settings": true,
"
/.factorypath": true
},
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m",
"open-in-browser.default": "{"Open-in-browser: Default":"Chrome"}",
"c-cpp-compile-run.run-in-external-terminal": true,
"eslint.runtime": "",
"files.autoGuessEncoding": true,
"editor.unicodeHighlight.allowedCharacters": {
":": true,
"!": true,
"α": true
},
//"C_Cpp.updateChannel": "Insiders",
"window.zoomLevel": 1,
"editor.unicodeHighlight.allowedLocales": {
"zh-hans": true
},
"update.enableWindowsBackgroundUpdates": false,
"update.mode": "manual",
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
"java.jdt.ls.java.home":"d:\JAVA",
"workbench.editorAssociations": {
".class": "default"
},
"files.associations": {
"
.class": "bat",
"*.java": "java"
},
"workbench.colorTheme": "Visual Studio Dark",
"maven.terminal.useJavaHome": true,
"java.configuration.runtimes": [

{
"name":"JavaSE-13",
"path":"d:\JAVA",
"sources":"D:\JAVA\lib\src.zip",
"default":true
}
],
}`

@testforstephen
Copy link
Contributor

!ENTRY org.eclipse.jdt.ls.core 4 0 2022-09-08 11:16:16.741
!MESSAGE Initialization failed 
!STACK 0
java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.internal.compiler.util.JrtFileSystem.walkModuleImage(org.eclipse.jdt.internal.compiler.util.JRTUtil$JrtFileVisitor, int)" because the return value of "org.eclipse.jdt.internal.compiler.util.JRTUtil.getJrtSystem(java.io.File, String)" is null
	at org.eclipse.jdt.internal.compiler.util.JRTUtil.walkModuleImage(JRTUtil.java:242)
	at org.eclipse.jdt.internal.core.JavaProject.loadModulesInJimage(JavaProject.java:983)
	at org.eclipse.jdt.internal.core.JavaProject.computePackageFragmentRoots(JavaProject.java:782)
	at org.eclipse.jdt.internal.core.JavaProject.computePackageFragmentRoots(JavaProject.java:1103)
	at org.eclipse.jdt.internal.core.JavaProject.computePackageFragmentRoots(JavaProject.java:1048)
	at org.eclipse.jdt.internal.core.JavaProject.computePackageFragmentRoots(JavaProject.java:1025)
	at org.eclipse.jdt.internal.core.JavaProject.buildStructure(JavaProject.java:538)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:266)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:597)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:328)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:314)
	at org.eclipse.jdt.internal.core.JavaElement.getChildren(JavaElement.java:269)
	at org.eclipse.jdt.internal.core.JavaProject.getPackageFragmentRoots(JavaProject.java:2384)
	at org.eclipse.jdt.internal.core.JavaProject.getPackageFragments(JavaProject.java:2408)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.cleanupResources(ProjectsManager.java:278)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:107)
	at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:244)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

The NPE above is the reason for the failure, it occurred when Java extension tried to parse your JDK info such as jrt-fs.jar, release. This issue seems related with the JDK installation.

Could you provide more information about the JDK installation you use?

  • What JDK distribution do you use? How do you install it?
  • If you're using Linux or macOS, check if your JDK related settings (e.g. java.home, java.jdt.ls.java.home, java.configuration.runtimes) point to any JDK location with symlink.

// @TBug001 @amwestrich @bib1963 @weberhofer @jadavis42

@TBug001
Copy link
Author

TBug001 commented Sep 16, 2022

@testforstephen Windows10 JDK13
Snipaste_2022-09-16_13-31-13
image

@testforstephen
Copy link
Contributor

Usually, this folder should include a release file, which contains the JDK vendor info.
image

@TBug001 Could you check if release file is missing in your JDK installation?

@testforstephen
Copy link
Contributor

I think I eventually reproduced the issue. If I manually delete the release file from my JDK installation, then Java extension will throw the NPE error above. Adding it back, then it works again. Java extension does not handle the missing release file well.

As far as I know, most of JDK vendors will include a release file. So I'm wondering what JDK distribution do you use? How do you install it? By Intellij IDEA, http download, package manager?

@TBug001
Copy link
Author

TBug001 commented Sep 16, 2022

The problem was solved according to your method. I re-downloaded a 13.0.2 JDK and copied its release file. Now it works properly. I don't know why the release file is missing, but I think I installed it three years ago via HTTP download

@TBug001 TBug001 closed this as completed Sep 16, 2022
@testforstephen testforstephen pinned this issue Sep 16, 2022
@TBug001
Copy link
Author

TBug001 commented Sep 16, 2022

The reason for the problem is the lack of release file. Thank you very much for testforstephen's kind answer!

@maresmar
Copy link

Here are steps how to get release file for yourself 😄
eclipse-jdt/eclipse.jdt.core#405 (comment)

@testforstephen
Copy link
Contributor

We want to know if it is rare for JDK builds to not contain "release" files. So can you tell us the affected JDK distribution and version? Where can we get it from?

// @amwestrich @bib1963 @weberhofer @jadavis42 @maresmar

@TBug001
Copy link
Author

TBug001 commented Sep 19, 2022

@testforstephen Now there is a new problem that will show up when I press "F5" to debug, I have to manually click the "Proceed" button to debug
image

@testforstephen testforstephen changed the title Cannot invoke Cannot invoke o.e.j.i.c.u.JrtFileSystem.walkModuleImage() Sep 19, 2022
@testforstephen
Copy link
Contributor

@TBug001 You can set the setting java.debug.settings.onBuildFailureProceed to always proceed.

@TBug001
Copy link
Author

TBug001 commented Sep 19, 2022

@TBug001 You can set the setting java.debug.settings.onBuildFailureProceed to always proceed.

ok

@maresmar
Copy link

So can you tell us the affected JDK distribution and version? Where can we get it from?

I use Java 11 from OpenSUSE Tumbleweed in WSL 2.0

$ cat /etc/os-release
NAME="openSUSE Tumbleweed"
# VERSION="20220917"
...
$ sudo zypper info java-11-openjdk-devel
Information for package java-11-openjdk-devel:
----------------------------------------------
Repository     : openSUSE-Tumbleweed-Oss
Name           : java-11-openjdk-devel
Version        : 11.0.16.0-2.1
Arch           : x86_64
Vendor         : openSUSE
...

@testforstephen
Copy link
Contributor

@maresmar thanks for sharing your use case. Good to know that JDK in OpenSUSE doesn't contain release by default.

@amwestrich
Copy link

amwestrich commented Oct 11, 2022 via email

@weberhofer
Copy link

In the meantime Java 11 and Java 17 have been updated for openSUSE Tumbleweed and should work nicely:

> rpm -q java-17-openjdk-headless
java-17-openjdk-headless-17.0.4.0-2.1.x86_64

> rpm -ql java-17-openjdk-headless | grep release
/usr/lib64/jvm/java-17-openjdk-17/release

@H-Lo
Copy link

H-Lo commented Mar 8, 2023

I can confirm that missing release file causes exception. But not only that: maven update cannot be done and Eclipse tries again and again in a loop and my pretty fast computer becomes unusable. It takes one minute to open Windows task manager and brutally kill Eclipse.
One relatively not important file missing shouldn't be the reason to destory the whole OS with indefinite loops for sure.

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

No branches or pull requests

8 participants