eclipse-m2e / m2e-core

Eclipse Public License 2.0
114 stars 117 forks source link

Cannot invoke "org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getPomFile()" because "facade" is null #933

Open blacelle opened 2 years ago

blacelle commented 2 years ago

Hello,

I recently installed a fresh Eclipse 2022-09, but I encounter some issues with m2e:

java.lang.NullPointerException: Cannot invoke "org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getPomFile()" because "facade" is null
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager$1.removeEldestEntry(ProjectRegistryManager.java:1103)
    at java.base/java.util.LinkedHashMap.afterNodeInsertion(LinkedHashMap.java:300)
    at java.base/java.util.HashMap.putVal(HashMap.java:662)
    at java.base/java.util.HashMap.put(HashMap.java:610)
    at java.base/java.util.Collections$SynchronizedMap.put(Collections.java:2676)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:513)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:367)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:321)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:386)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$3(ProjectConfigurationManager.java:339)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:205)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1093)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:338)
    at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:80)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
eclipse.buildId=4.25.0.I20220831-1800
java.version=17.0.4.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_FR
Framework arguments:  -product org.eclipse.epp.package.java.product -keyring /Users/blacelle/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -keyring /Users/blacelle/.eclipse_keyring

This is a continuation of log file /Users/blacelle/eclipse-workspace-2022-09/.metadata/.bak_0.log
Created Time: 2022-09-24 17:13:57.963

I tried closing most modules if given multi-modules project, but this still happens when refreshing given module in Eclipse.

mickaelistria commented 2 years ago

This might be fixed when/if we merge #928

HannesWell commented 2 years ago

This might be fixed when/if we merge #928

I'm not sure about that, however the question is how a null-facade made it into the cache as key?

mickaelistria commented 2 years ago

928 doesn't fix it, I got the new flavour of this same issue with a recent build, while opening a project:

java.lang.NullPointerException
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:878)
    at com.google.common.cache.LocalCache.put(LocalCache.java:4179)
    at com.google.common.cache.LocalCache$LocalManualCache.put(LocalCache.java:4865)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:518)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:372)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:326)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:150)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:88)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:205)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:87)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:197)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1024)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:254)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:311)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:400)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:403)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:514)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:462)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:544)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:161)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:255)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
mickaelistria commented 2 years ago

The error repeats if I try "Update Project"

rombert commented 2 years ago

Is there a workaround for this issue?

rombert commented 1 year ago

This is still happening. I have the following m2e features installed

    M2E - Maven Integration for Eclipse 2.3.0.20230523-2033 org.eclipse.m2e.feature.feature.group   Eclipse.org - m2e
    M2E - POM Editor using LemMinX language server (includes Incubating components) 2.0.4.20230520-0934 org.eclipse.m2e.lemminx.feature.feature.group   Eclipse.org - m2e
    M2E - SLF4J over Logback Logging    2.1.2.20230523-2106 org.eclipse.m2e.logback.feature.feature.group   Eclipse.org - m2e
    m2e-wtp - JAX-RS configurator for WTP (Optional)    1.6.0.20230118-0812 org.eclipse.m2e.wtp.jaxrs.feature.feature.group Eclipse.org - m2e-wtp
    m2e-wtp - JPA configurator for WTP (Optional)   1.6.0.20230118-0812 org.eclipse.m2e.wtp.jpa.feature.feature.group   Eclipse.org - m2e-wtp
    m2e-wtp - JSF configurator for WTP (Optional)   1.6.0.20230118-0812 org.eclipse.m2e.wtp.jsf.feature.feature.group   Eclipse.org - m2e-wtp
    m2e-wtp - Maven Integration for WTP 1.6.0.20230118-0812 org.eclipse.m2e.wtp.feature.feature.group   Eclipse.org - m2e-wtp

I tried:

What does work is switching completely to a new workspace and importing just that project.

kaosko commented 1 year ago

It's odd why it's so persistent. I was able to get rid of the error by deleting all dependencies and the build section from the pom, then disabling and re-enabling "Maven nature". After that build succeeded, I put back all the removed sections from the pom.xml and the error didn't reappear anymore.