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

Maven plugin fails with NullPointerException for module in 0.17, worked in 0.16. #182

Open
dirtylabcoat opened this issue Nov 9, 2018 · 6 comments

Comments

@dirtylabcoat
Copy link

Our project has two modules, both with JAX-RS resources. With 0.16 we could generate docs for both modules, but since upgrading to 0.17 generating for one of them fails with a NullPointerException like this:
[ERROR] Failed to execute goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-jaxrs (rest-resources-swagger-ui) on project module1: Execution rest-resources-swagger-ui of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-jaxrs failed.: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-jaxrs (rest-resources-swagger-ui) on project module1: Execution rest-resources-swagger-ui of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-jaxrs failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution rest-resources-swagger-ui of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-jaxrs failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: java.lang.NullPointerException at java.util.Objects.requireNonNull (Objects.java:203) at com.sebastian_daschner.jaxrs_analyzer.model.methods.MethodIdentifier.<init> (MethodIdentifier.java:49) at com.sebastian_daschner.jaxrs_analyzer.model.methods.MethodIdentifier.of (MethodIdentifier.java:180) at com.sebastian_daschner.jaxrs_analyzer.model.methods.MethodIdentifier.ofNonStatic (MethodIdentifier.java:161) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.calculateMethodIdentifier (JavaDocParserVisitor.java:181) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.recordMethodComment (JavaDocParserVisitor.java:115) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.lambda$visit$2 (JavaDocParserVisitor.java:110) at java.util.Optional.ifPresent (Optional.java:159) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.visit (JavaDocParserVisitor.java:110) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.visit (JavaDocParserVisitor.java:38) at com.github.javaparser.ast.body.MethodDeclaration.accept (MethodDeclaration.java:118) at com.github.javaparser.ast.visitor.VoidVisitorAdapter.lambda$visit$61 (VoidVisitorAdapter.java:267) at java.util.ArrayList.forEach (ArrayList.java:1257) at com.github.javaparser.ast.NodeList.forEach (NodeList.java:255) at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit (VoidVisitorAdapter.java:267) at com.github.javaparser.ast.body.EnumDeclaration.accept (EnumDeclaration.java:91) at com.github.javaparser.ast.visitor.VoidVisitorAdapter.lambda$visit$40 (VoidVisitorAdapter.java:192) at java.util.ArrayList.forEach (ArrayList.java:1257) at com.github.javaparser.ast.NodeList.forEach (NodeList.java:255) at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit (VoidVisitorAdapter.java:192) at com.github.javaparser.ast.CompilationUnit.accept (CompilationUnit.java:126) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.parseJavaDoc (JavaDocAnalyzer.java:64) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.lambda$invokeParser$0 (JavaDocAnalyzer.java:58) at java.lang.Iterable.forEach (Iterable.java:75) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.invokeParser (JavaDocAnalyzer.java:58) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.invokeParser (JavaDocAnalyzer.java:38) at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.analyze (JavaDocAnalyzer.java:31) at com.sebastian_daschner.jaxrs_analyzer.analysis.ProjectAnalyzer.analyze (ProjectAnalyzer.java:107) at com.sebastian_daschner.jaxrs_analyzer.JAXRSAnalyzer.analyze (JAXRSAnalyzer.java:47) at com.sebastian_daschner.jaxrs_analyzer.maven.JAXRSAnalyzerMojo.execute (JAXRSAnalyzerMojo.java:226) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

I can't post any code from the module due to agreement with client, but I need help to get this to work. Where do I start debugging this? Is anybody else experiencing this issue with 0.17?

@rmpestano
Copy link
Contributor

rmpestano commented Nov 9, 2018

Hi @dirtylabcoat,

the NPE is being raised here which is being called here.

So these are good points to debug.

To debug you'll need to clone v0.17 and import it on your workspace then do a mvnDebug jaxrs-analyzer:analyze-jaxrs on your project and use a remote debug on port 8000.

If you provide a reproducer project I can try to help fixing the issue.

Thank you for reporting.

@dizzzz
Copy link

dizzzz commented Jan 4, 2019

I encounter the same issue here (see attachment) ; How to create a reproducible project.... that will be tricky for me.
trace.txt

@dizzzz
Copy link

dizzzz commented Jul 3, 2019

@rmpestano about the NPE... it looks to fail on a maven (sub)module which does not have any JAXRS annotations. Still investigating....

@dizzzz
Copy link

dizzzz commented Jul 3, 2019

Here is the problem... className == null

image

@dizzzz
Copy link

dizzzz commented Jul 3, 2019

at least the following makes sure the proces continues :-)

image

I can't figure out the flow yet why 'className' is not set... or if it is a wrong assumption it should be set ....@rmpestano

@jerith666
Copy link

This looks to be duplicated by #191.

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

No branches or pull requests

4 participants