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

Error NPE DefaultReportingConverter when updating project configuration in a maven project #1103

Closed
zeen1x opened this issue Oct 16, 2019 · 24 comments

Comments

@zeen1x
Copy link

zeen1x commented Oct 16, 2019

Hi, I've been using this extension for a year now and I've recently encountered an issue with it that I can't seem to find a solution for. I get and NPE DefaultReportingConverter when updating the project configuration of any exisiting or new maven project I create. I updated my current version of maven to 3.6.2 as I found online this could be the issue https://issues.apache.org/jira/browse/MNG-6636. However, the standalone maven compile command successfully build the project.

Here's my settings.json file:

{
    "java.configuration.checkProjectSettingsExclusions": false,
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "java.home": "C:\\Program Files\\RedHat\\java-1.8.0-openjdk-1.8.0.161-1",
    "java.import.maven.enabled": true,
    "java.maven.downloadSources": true,
    "maven.pomfile.autoUpdateEffectivePOM": true
}
Environment
  • Operating System: Windows server 2012 R2 Standard
  • JDK version: 1.7.141
  • Visual Studio Code version: 1.39.2
  • Java extension version: 0.51.0
  • Maven version: 3.6.2
Steps To Reproduce
  1. Update project configuration on a pom.xml file

A brand new maven project is enough to reproduce the problem.

Here's the error log:

[Error - 2:15:10 PM] Oct 16, 2019 2:15:10 PM Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
null
java.lang.NullPointerException
at org.apache.maven.model.plugin.DefaultReportingConverter.convert(DefaultReportingConverter.java:243)
at org.apache.maven.model.plugin.DefaultReportingConverter.convert(DefaultReportingConverter.java:213)
at org.apache.maven.model.plugin.DefaultReportingConverter.convertReporting(DefaultReportingConverter.java:140)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:479)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:432)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:616)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:385)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.readMavenProjects(MavenImpl.java:659)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.lambda$3(ProjectRegistryManager.java:738)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.execute(ProjectRegistryManager.java:1026)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.readMavenProjectFacades(ProjectRegistryManager.java:736)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:432)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:365)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:312)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:155)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:90)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:87)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:201)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:833)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:316)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:319)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:371)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:392)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

[Error - 2:15:10 PM] Oct 16, 2019 2:15:10 PM Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
null
java.lang.NullPointerException
at org.apache.maven.model.plugin.DefaultReportingConverter.convert(DefaultReportingConverter.java:243)
at org.apache.maven.model.plugin.DefaultReportingConverter.convert(DefaultReportingConverter.java:213)
at org.apache.maven.model.plugin.DefaultReportingConverter.convertReporting(DefaultReportingConverter.java:140)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:479)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:432)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:616)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:385)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.readMavenProjects(MavenImpl.java:659)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.lambda$3(ProjectRegistryManager.java:738)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.execute(ProjectRegistryManager.java:1026)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.readMavenProjectFacades(ProjectRegistryManager.java:736)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:432)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:365)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:312)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:155)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:90)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:87)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:201)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:833)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:316)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:319)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:371)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:392)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

[Error - 2:15:10 PM] Oct 16, 2019 2:15:10 PM Errors occurred during the build.

Current Result

The java language server starts without loading maven dependencies

Expected Result

The java language server should load the maven dependencies

Additional Informations

Here's a pom.xml example of a project that fails:
*Note that on line 2, "project" is underlined red and shows this error:
Error while downloading 'http://maven.apache.org/maven-v4_0_0.xsd' to C:\Users{user}.lsp4xml\cache\http\maven.apache.org\maven-v4_0_0.xsd.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.whatever.courtage.sfl</groupId>
<artifactId>sfl-contact</artifactId>
<version>1.2.1-SNAPSHOT</version>

<packaging>pom</packaging>
<name>Whatever Portlet :: sfl-contact</name>

<parent>
	<groupId>com.whatever.services-communs.portail.dependances</groupId>
	<artifactId>fwd-infra-portail-parent</artifactId>
	<version>2.4.2</version>
</parent>

<modules>
	<module>portlet</module>
	<module>soapservice</module>
</modules>

<scm>
		<tag>v-1.0.0</tag>
</scm>
</project>
@fbricon
Copy link
Collaborator

fbricon commented Oct 16, 2019

I can't reproduce. Can you attach the effective pom of a project that fails?

@zeen1x
Copy link
Author

zeen1x commented Oct 16, 2019

Thanks for the reply,

I've added a pom file in the issue description under additionnal informations. Everything builds fine if I do "mvn install" though.

@snjeza
Copy link
Contributor

snjeza commented Oct 16, 2019

@zeen1x you can try the following property:

"xml.server.workDir": "C:\\Users\\<YOUR_USERNAME>\\.lsp4xml"

<YOUR_USERNAME> is your Windows username.

@zeen1x
Copy link
Author

zeen1x commented Oct 16, 2019

@snjeza Hi, I don't have a directory named .lsp4xml under %userprofile%

@snjeza
Copy link
Contributor

snjeza commented Oct 16, 2019

VS Code XML extension will create it.

@zeen1x
Copy link
Author

zeen1x commented Oct 16, 2019

@snjeza I manually created the file at C:\Users{user}.lsp4xml\cache\http\maven.apache.org\maven-v4_0_0.xsd and now the underlined red error is gone. What could cause it to not be able to download this file 'http://maven.apache.org/maven-v4_0_0.xsd' ?

I retried for an update project configuration and still have the NPE so it might not be related?

@snjeza
Copy link
Contributor

snjeza commented Oct 16, 2019

It is a bug in https://github.com/redhat-developer/vscode-xml

JDK version: 1.7.141

Could you update to JDK 8?

@zeen1x
Copy link
Author

zeen1x commented Oct 16, 2019

vscode is indeed using jdk 1.8 since it's the oldest supported. However, my JAVA_HOME environment variable is set to version 1.7.141

And to answer your question, I cannot update to JDK 8 because the server using this project is running JRE 7.

@snjeza
Copy link
Contributor

snjeza commented Oct 16, 2019

You can try the following property:

"java.home": "C:\\Program Files\\RedHat\\java-1.8.0-openjdk-1.8.0.161-1",

@zeen1x
Copy link
Author

zeen1x commented Oct 16, 2019

@snjeza Humm, I'm not sure what your are asking me to do at this point. This is exactly whats in my settings.json. I have a different setup who is running a newer version

"java.home": "C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.212-3"

and still has issues with this file 'http://maven.apache.org/maven-v4_0_0.xsd' download

@zeen1x
Copy link
Author

zeen1x commented Oct 16, 2019

@snjeza I think I see what you did. The copy paste I made removed the double backslash "\\". If this is what you were asking me to add then this is not the source of the problem.

@snjeza
Copy link
Contributor

snjeza commented Oct 16, 2019

Is there C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.212-3\bin\javac.exe ?

@zeen1x
Copy link
Author

zeen1x commented Oct 17, 2019

Yes, it has the javac executable.

@zeen1x
Copy link
Author

zeen1x commented Oct 17, 2019

It did work on the past but something happened. I have an old workspace storage that I can work with but any new dependencies won't download because of this error.

@snjeza
Copy link
Contributor

snjeza commented Oct 17, 2019

and still has issues with this file 'http://maven.apache.org/maven-v4_0_0.xsd' download

Could you try to disable the XML extension?

@zeen1x
Copy link
Author

zeen1x commented Oct 17, 2019

I disabled the XML extension and still have the NPE

@zeen1x
Copy link
Author

zeen1x commented Oct 21, 2019

@fbricon Have you ever seen anything like this before?

@fbricon
Copy link
Collaborator

fbricon commented Oct 21, 2019

nope, only saw references in upstream Maven jira. Did you try to clean the Java language server working directory (see in command palette)

@zeen1x
Copy link
Author

zeen1x commented Oct 21, 2019

Yes I tried.

I did a backup of my workspace storage before doing this so I can still work on old projects with partial maven dependencies loaded. However, if I clean the java language server working directory, it will clean the workspace storage and I will lose the dependencies since it fails to load them.

@zeen1x
Copy link
Author

zeen1x commented Oct 22, 2019

I found out by installing the newest version of eclipse that the NPE error was also occuring. In Window >> Preferences >> Maven >> Installations of eclipse I saw it was using version 3.6.1 of maven and that could explain the error I was having. I stumbled upon by configuring the latest version of maven in eclipse on a note that says: Embedded runtime is always used for dependency resolution. After a try it did confirm that de dependency resolution was in fact still using the version 3.6.1 of maven even though I added a newer one. For my solution to work, I downloaded an older version of eclipse which is using version 3.5.3 and this one worked just fine.

Back to vscode, is it possible for the Maven for Java extension, even though I set a newer or older maven version location with "maven.executable.path" setting name in settings.json, it still uses whatever latest current version of maven?

@zeen1x
Copy link
Author

zeen1x commented Oct 23, 2019

@fbricon Hi, when do you plan on upgrading Eclipse Maven Integration (m2e) to version 1.13? I'm 95% confident this will fix it.

@fbricon
Copy link
Collaborator

fbricon commented Oct 23, 2019

it's been using m2e 1.13.0.20190716-1624 for several releases already

@zeen1x
Copy link
Author

zeen1x commented Oct 23, 2019

Humm... maven 3.6.2 was released on 2019-08-27 (https://maven.apache.org/docs/history.html) and m2e 1.13 was on 2019-09-18 (https://projects.eclipse.org/projects/technology.m2e). Pretty sure you don't have the latest maven if you use any m2e released before August 27.

@fbricon
Copy link
Collaborator

fbricon commented Oct 23, 2019

right, 3.6.2 is not in the latest m2e release. I'll look into consuming new builds tomorrow

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

No branches or pull requests

3 participants