users@jersey.java.net

[Jersey] Jersey WadlGeneratorTask error

From: jason calton <jasoncalton_at_hotmail.com>
Date: Mon, 18 Apr 2011 02:52:55 -0400

Hi everyone,
I am trying to make an Ant task build a WADL file and apply xsl to it, but the WadlGeneratorTask is failing.
The error seems to stem from a null pointer exception in the JAXB ContextFinder.find method.
After spending several hours looking over everything, I cannot find the cause of this.
 
Below is my ant task and the error I receive. Could anybody take a stab at what is going wrong?
Thanks.
Jason

    <target name="-post-compile">
        <echo message="JDO Enhancement"/>
        <path id="enhancer.classpath">
            <pathelement path="${javac.classpath}"/>
            <pathelement location="${build.classes.dir}"/>
        </path>
        <taskdef name="datanucleusenhancer" classpathref="enhancer.classpath" classname="org.datanucleus.enhancer.tools.EnhancerTask" />
        <datanucleusenhancer classpathref="enhancer.classpath" />
        <echo message="WADL Generation"/>
        <path id="wadl.classpath">
            <pathelement path="${javac.classpath}"/>
            <pathelement location="${build.classes.dir}"/>
        </path>
        <taskdef name="generatewadl" classpathref="wadl.classpath" classname="com.sun.jersey.api.wadl.WadlGeneratorTask" />
        <generatewadl classpathref="wadl.classpath" destfile="${webinf.dir}/wadl.xml" baseUri="http://www.whatever.com" />
        <echo message="WADL XSL Transformation"/>
        <xslt in="${webinf.dir}/wadl.xml" style="${webinf.dir}/wadl.xsl" out="${webinf.dir}/doc.html">
            <outputproperty name="method" value="xml"/>
            <outputproperty name="standalone" value="yes"/>
            <outputproperty name="encoding" value="iso8859_1"/>
            <outputproperty name="indent" value="yes"/>
        </xslt>
    </target>
 
 
 
 
WADL Generation
build.xml:41:
java.lang.NullPointerException
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:275)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
        at com.sun.jersey.api.wadl.WadlGeneratorTask.execute(WadlGeneratorTask.java:142)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:281)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)
BUILD FAILED (total time: 7 seconds)