You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed to initialize language server due to "Internal error. Caused by: NPE: Cannot invoke 'o.e.m.c.e.IMaven.getSettings()' because the return value of 'o.e.m.c.MavenPlugin.getMaven()' is null" #3469
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.m2e.core.embedder.IMaven.getSettings()" because the return value of "org.eclipse.m2e.core.MavenPlugin.getMaven()" is null
at org.eclipse.jdt.ls.core.internal.preferences.StandardPreferenceManager.update(StandardPreferenceManager.java:108)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.handleInitializationOptions(BaseInitHandler.java:115)
at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:105)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:284)
... 17 more
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.m2e.core.embedder.IMaven.getSettings()" because the return value of "org.eclipse.m2e.core.MavenPlugin.getMaven()" is null
at org.eclipse.jdt.ls.core.internal.preferences.StandardPreferenceManager.update(StandardPreferenceManager.java:125)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.handleInitializationOptions(BaseInitHandler.java:115)
at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:109)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:283)
... 17 more
This NPE is also easier to happen for Windows than other platforms (macOS and linux).
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.m2e.core.embedder.IMaven.getSettings()" because the return value of "org.eclipse.m2e.core.MavenPlugin.getMaven()" is null
at org.eclipse.jdt.ls.core.internal.preferences.StandardPreferenceManager.update(StandardPreferenceManager.java:125)
Will it be auto resolved (i.e. no NPE) next time when it tries to import the Maven project? If so, is there any approach we can do in jdt.ls.core to catch the NPE and do something to mitigate the issue?
Will it be auto resolved (i.e. no NPE) next time when it tries to import the Maven project? If so, is there any approach we can do in jdt.ls.core to catch the NPE and do something to mitigate the issue?
I believe so. This NPE rate goes to a PEAK at the first week of new vscode-java release and then goes down to a lower rate. This is because most of users upgrade to new version on the first week of new release.
Add @fbricon@rgrunber, since your team is more familiar with m2e mechanism. org.eclipse.m2e.core.MavenPlugin.getMaven() returns null when activating jdt.ls.
Interesting observation (about the errors peaking during a new release). Maybe it's a case of the newer m2e invalidating some aspect of the older settings, that then gets automatically fixed ?
Update: Seems similar to eclipse-m2e/m2e-core#966 which points to an issue with org.eclipse.core.resources. It might be related to the initial startup, that caches the Equinox dependency wiring under $HOME/.config/Code/User/globalStorage/redhat.java/${version}/config_linux/ .
Thanks for letting me know! I’m actually seeing the same problem in my
workspace. It seems that with multi-folder setups, the Java formatting
isn’t applying correctly. When I open the same folder in a fresh VS Code
window, it works as expected. Do you think this could be a caching issue or
something related to workspace settings? Let me know if you’ve got any
ideas!"
Activity
testforstephen commentedon Aug 8, 2024
From the BI logs, this issue is easier to happen when new version of vscode-java is just released. This might be related to the activation of plugin.
testforstephen commentedon Aug 8, 2024
Latest call stack:
This NPE is also easier to happen for Windows than other platforms (macOS and linux).
Eskibear commentedon Aug 8, 2024
Will it be auto resolved (i.e. no NPE) next time when it tries to import the Maven project? If so, is there any approach we can do in jdt.ls.core to catch the NPE and do something to mitigate the issue?
testforstephen commentedon Aug 8, 2024
I believe so. This NPE rate goes to a PEAK at the first week of new vscode-java release and then goes down to a lower rate. This is because most of users upgrade to new version on the first week of new release.
testforstephen commentedon Aug 8, 2024
Add @fbricon @rgrunber, since your team is more familiar with m2e mechanism.
org.eclipse.m2e.core.MavenPlugin.getMaven()returns null when activating jdt.ls.rgrunber commentedon Aug 8, 2024
Interesting observation (about the errors peaking during a new release). Maybe it's a case of the newer m2e invalidating some aspect of the older settings, that then gets automatically fixed ?
Happens at :
StandardPreferenceManager.update(..)Update: Seems similar to eclipse-m2e/m2e-core#966 which points to an issue with
org.eclipse.core.resources. It might be related to the initial startup, that caches the Equinox dependency wiring under$HOME/.config/Code/User/globalStorage/redhat.java/${version}/config_linux/.The problem is somewhere at https://github.com/eclipse-m2e/m2e-core/blob/2.6.0/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/MavenPluginActivator.java#L68-L86 -> https://github.com/eclipse-equinox/equinox/blob/R4_32_maintenance/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java#L677-L693 . I don't think the activator or the bundle context are
nullthough there's a chance maybe the bundle context somehow might be. I think it's more likely the failure is happening somewhere in getting the registered services but not sure how.tmingniu commentedon May 7, 2026
It's already 2006. Why is this problem still around?
https://github.com/microsoft/vscode-java-pack/issues/1613
Keep LSP initialize() resilient when m2e is not yet available
Keep LSP initialize() resilient when m2e is not yet available
FaiqNoman69 commentedon May 14, 2026
Keep LSP initialize() resilient when m2e is not yet available