eclipse nullpointer exception for modulare maven project update

1.4k views Asked by At

I'm using Eclipse 4.4.1 with m2e plugin and the latest gae dependencies. When I import the gae module sample project eclipse tells me that the project configuration is not up to date. If I run the suggested maven -> update project, I get a NPE.

There are a lot of bug reports according NPE on project updates out there. So far I've tried it with mvn eclipse:eclipse or maven project imports, in fresh or existing workspaces but I was never able to get the projects running in eclipse.

Are there any solutions to this?

EDIT: That is the stacktrace:

java.lang.NullPointerException at com.google.appengine.eclipse.wtp.maven.GaeRuntimeManager.getGaeRuntime(GaeRuntimeManager.java:85) at com.google.appengine.eclipse.wtp.maven.GaeRuntimeManager.ensureGaeRuntimeWithSdk(GaeRuntimeManager.java:55) at com.google.appengine.eclipse.wtp.maven.GaeFacetManager.addGaeFacet(GaeFacetManager.java:59) at com.google.appengine.eclipse.wtp.maven.GaeProjectConfigurator.configure(GaeProjectConfigurator.java:46) at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:120) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$3.call(ProjectConfigurationManager.java:477) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$3.call(ProjectConfigurationManager.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:142) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:470) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.configureNewMavenProjects(ProjectConfigurationManager.java:250) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:163) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:142) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1348) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:133) at org.eclipse.m2e.core.ui.internal.wizards.ImportMavenProjectsJob$1.doCreateMavenProjects(ImportMavenProjectsJob.java:73) at org.eclipse.m2e.core.ui.internal.wizards.AbstractCreateMavenProjectsOperation.run(AbstractCreateMavenProjectsOperation.java:62) at org.eclipse.m2e.core.ui.internal.wizards.ImportMavenProjectsJob.runInWorkspace(ImportMavenProjectsJob.java:82) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

4

There are 4 answers

4
nothingtodohere On BEST ANSWER

I had the same issue after updating from Eclipse Kepler (4.3) to Luna (4.4). Commenting out the app-engine-maven plugin from my pom.xml fixed it for me.

<!--
<plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>${appengine.target.version}</version>
</plugin>
-->

I'm able to run and deploy my app without any issues so far.

0
Gilberto Torrezan On

You can comment out the appengine-maven-plugin to solve the problem, but by doing that you lose the command-line capabilities of the plugin. You can have the best of both worlds (Eclipse and Maven command-line) by using Maven profiles:

<profiles>
    <profile>
        <id>gae</id>
        <build>
            <plugin>
                <groupId>com.google.appengine</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>${appengine.target.version}</version>
            </plugin>
        </build>
    </profile>
</profiles>

To activate it, for instance, to deploy the project from the command-line, you can do:

mvn appengine:update -P gae

When defining the appengine-maven-plugin only inside a profile, Eclipse won't use it, and the bug goes away. When using the command-line, just remember to activate it using the -P flag.

0
fedevo On

seem to be a duplicate of An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException

got to preferences / Server / Runtime Environemnt

--> select "Google App Engine" and associate a valid SDk to this runtime.

0
Luzius On

I had the same problem suddenly appear in one of my projects. Disabling the JPA validator seems to have resolved the issue for now.

  1. Select Windows > Preferences > Validation
  2. Disable the JPA Validator for both Manual validation and Build validation

It might be related to the "The persistence.xml file does not have recognized content" error described in here: www-01.ibm.com/support/docview.wss?uid=swg21616684 .