users@jersey.java.net

[Jersey] Issue with maven-wadl-plugin giving NullPointerException

From: Jason Erickson <jason_at_jasonerickson.com>
Date: Thu, 28 Apr 2011 18:50:27 -0700

I recently tried to update from Jersey 1.4 to Jersey 1.5 (and 1.6) but my build started failing with the following stack trace:
java.lang.NullPointerException
        at com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport.createParam(WadlGeneratorResourceDocSupport.java:324)
        at com.sun.jersey.server.wadl.WadlBuilder.generateParam(WadlBuilder.java:266)
        at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:300)
        at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:350)
        at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:350)
        at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:271)
        at com.sun.jersey.server.wadl.WadlBuilder.generate(WadlBuilder.java:107)
        at com.sun.jersey.wadl.GenerateWadlMojo.createApplication(GenerateWadlMojo.java:285)
        at com.sun.jersey.wadl.GenerateWadlMojo.executeWithClasspath(GenerateWadlMojo.java:146)
        at com.sun.jersey.wadl.AbstractMojoProjectClasspathSupport.execute(AbstractMojoProjectClasspathSupport.java:101)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
... Some more to the stack trace, but just Maven stuff.

I stepped into the code and I see that WadlGeneratorResourceDocSupport.createParam, line 324 does a m.getMethod(), but m is null because WadlBuilder.generateResource, line 300 passes null to WadlBuilder.generateParam. The problem is that it is trying to process a field (possibly erroneously because of an @Autowired annotation?), so of course, there is no method.

Is there a fix or workaround for this (besides just passing on the generating of WADL)?