It worked!! I used ${basedir}/src/main/resources/ and it worked.

Maybe the documentation should be aware of this issue. Avoid using
"classpath:" URIs.

Thank you very much!


On 25 July 2013 15:00, Jason Pell <[email protected]> wrote:

> Can you try referencing the XSD via absolute path rather than a classpath,
> just for a test.
>
> You can use something like:
>
> ${basedir}/src/main/resources/schemas/document.xsd
>
> I see the exact kind of error reported for the codegen plugin in the past.
> All the examples i can see don't use classpath:
>
>
> On Thu, Jul 25, 2013 at 10:18 PM, Marco Westermann <[email protected]
> >wrote:
>
> > Hi,
> >
> > I don't know why you get the error. But I also use a plugin to generate
> > java classes from xsd. Here is my plugin-config from pom.xml:
> >
> >             <plugin>
> >                 <groupId>org.codehaus.mojo</**groupId>
> > <artifactId>jaxb2-maven-**plugin</artifactId>
> >                 <version>1.3.1</version>
> >                 <executions>
> >                     <execution>
> >                         <id>xjc</id>
> > <phase>generate-sources</**phase>
> >                         <goals>
> >                             <goal>xjc</goal>
> >                         </goals>
> >                     </execution>
> >                 </executions>
> >             </plugin>
> >
> >
> > the xsd's have to be under src/main/xsd/
> >
> > and the generated classes are under target/generated-sources/jaxb
> >
> > hope that helps you as well.
> >
> > regards, Marco
> >
> > Am 25.07.2013 14:01, schrieb Julio Carlos Barrera Juez:
> >
> >  I have changed the version to 2.6.2 and I'm getting the same issue:
> >>
> >> [ERROR] Failed to execute goal
> >> org.apache.cxf:cxf-xjc-plugin:**2.6.2:xsdtojava (generate-sources) on
> >> project
> >> org.opennaas.extensions.**juniper.servicecatalog: null:
> >> MojoExecutionException: NullPointerException -> [Help 1]
> >> org.apache.maven.lifecycle.**LifecycleExecutionException: Failed to
> >> execute
> >> goal org.apache.cxf:cxf-xjc-plugin:**2.6.2:xsdtojava (generate-sources)
> >> on
> >> project org.opennaas.extensions.**juniper.servicecatalog: null
> >>   at
> >> org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >> MojoExecutor.java:217)
> >> at
> >> org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >> MojoExecutor.java:153)
> >>   at
> >> org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >> MojoExecutor.java:145)
> >> at
> >> org.apache.maven.lifecycle.**internal.**LifecycleModuleBuilder.**
> >> buildProject(**LifecycleModuleBuilder.java:**84)
> >>   at
> >> org.apache.maven.lifecycle.**internal.**LifecycleModuleBuilder.**
> >> buildProject(**LifecycleModuleBuilder.java:**59)
> >> at
> >> org.apache.maven.lifecycle.**internal.LifecycleStarter.**
> >> singleThreadedBuild(**LifecycleStarter.java:183)
> >>   at
> >> org.apache.maven.lifecycle.**internal.LifecycleStarter.**
> >> execute(LifecycleStarter.java:**161)
> >> at org.apache.maven.DefaultMaven.**doExecute(DefaultMaven.java:**320)
> >>   at org.apache.maven.DefaultMaven.**execute(DefaultMaven.java:156)
> >> at org.apache.maven.cli.MavenCli.**execute(MavenCli.java:537)
> >>   at org.apache.maven.cli.MavenCli.**doMain(MavenCli.java:196)
> >> at org.apache.maven.cli.MavenCli.**main(MavenCli.java:141)
> >>   at sun.reflect.**NativeMethodAccessorImpl.**invoke0(Native Method)
> >> at
> >> sun.reflect.**NativeMethodAccessorImpl.**invoke(**
> >> NativeMethodAccessorImpl.java:**39)
> >>   at
> >> sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
> >> DelegatingMethodAccessorImpl.**java:25)
> >> at java.lang.reflect.Method.**invoke(Method.java:597)
> >>   at
> >> org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >> launchEnhanced(Launcher.java:**290)
> >> at
> >> org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >> launch(Launcher.java:230)
> >>   at
> >> org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >> mainWithExitCode(Launcher.**java:409)
> >> at org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >> main(Launcher.java:352)
> >> Caused by: org.apache.maven.plugin.**MojoExecutionException
> >> at
> >> org.apache.cxf.maven_plugin.**AbstractXSDToJavaMojo.execute(**
> >> AbstractXSDToJavaMojo.java:**320)
> >>   at org.apache.cxf.maven_plugin.**XSDToJavaMojo.execute(**
> >> XSDToJavaMojo.java:42)
> >> at
> >> org.apache.maven.plugin.**DefaultBuildPluginManager.**executeMojo(**
> >> DefaultBuildPluginManager.**java:101)
> >>   at
> >> org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >> MojoExecutor.java:209)
> >> ... 19 more
> >> Caused by: java.lang.NullPointerException
> >>   at
> >> org.sonatype.plexus.build.**incremental.**DefaultBuildContext.**
> >> getMessage(**DefaultBuildContext.java:88)
> >> at
> >> org.sonatype.plexus.build.**incremental.**DefaultBuildContext.**
> >> addMessage(**DefaultBuildContext.java:110)
> >>   at
> >> org.apache.cxf.maven_plugin.**AbstractXSDToJavaMojo$**Listener.error(**
> >> AbstractXSDToJavaMojo.java:**149)
> >> at
> >> com.sun.tools.xjc.util.**ErrorReceiverFilter.error(**
> >> ErrorReceiverFilter.java:77)
> >>   at
> >> com.sun.tools.xjc.util.**ErrorReceiverFilter.error(**
> >> ErrorReceiverFilter.java:77)
> >> at
> >> com.sun.tools.xjc.util.**ErrorReceiverFilter.error(**
> >> ErrorReceiverFilter.java:77)
> >>   at
> >> com.sun.org.apache.xerces.**internal.jaxp.validation.**
> >> XMLSchemaFactory.newSchema(**XMLSchemaFactory.java:233)
> >> at
> >> com.sun.tools.xjc.reader.**xmlschema.parser.**
> >> SchemaConstraintChecker.check(**SchemaConstraintChecker.java:**101)
> >>   at com.sun.tools.xjc.ModelLoader.**loadXMLSchema(ModelLoader.**
> >> java:357)
> >> at com.sun.tools.xjc.ModelLoader.**load(ModelLoader.java:167)
> >>   at com.sun.tools.xjc.ModelLoader.**load(ModelLoader.java:113)
> >> at com.sun.tools.xjc.Driver.run(**Driver.java:313)
> >>   at
> >> org.apache.cxf.maven_plugin.**AbstractXSDToJavaMojo.execute(**
> >> AbstractXSDToJavaMojo.java:**307)
> >> ... 22 more
> >>
> >>
> >>
> >> On 25 July 2013 12:53, Jason Pell <[email protected]> wrote:
> >>
> >>  Can you try this again using 2.6.2 version of the plugin
> >>>
> >>>
> >>> On Thu, Jul 25, 2013 at 6:45 PM, Julio Carlos Barrera Juez <
> >>> [email protected]> wrote:
> >>>
> >>>  I have just executed the goals with MAven debug option (-X) and this
> is
> >>>>
> >>> the
> >>>
> >>>> output:
> >>>>
> >>>> at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >>> MojoExecutor.java:217)
> >>>
> >>>> at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >>> MojoExecutor.java:153)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >>> MojoExecutor.java:145)
> >>>
> >>>> at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.**LifecycleModuleBuilder.**
> >>> buildProject(**LifecycleModuleBuilder.java:**84)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.**LifecycleModuleBuilder.**
> >>> buildProject(**LifecycleModuleBuilder.java:**59)
> >>>
> >>>> at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.LifecycleStarter.**
> >>> singleThreadedBuild(**LifecycleStarter.java:183)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.LifecycleStarter.**
> >>> execute(LifecycleStarter.java:**161)
> >>>
> >>>> at org.apache.maven.DefaultMaven.**doExecute(DefaultMaven.java:**320)
> >>>>   at org.apache.maven.DefaultMaven.**execute(DefaultMaven.java:156)
> >>>> at org.apache.maven.cli.MavenCli.**execute(MavenCli.java:537)
> >>>>   at org.apache.maven.cli.MavenCli.**doMain(MavenCli.java:196)
> >>>> at org.apache.maven.cli.MavenCli.**main(MavenCli.java:141)
> >>>>   at sun.reflect.**NativeMethodAccessorImpl.**invoke0(Native Method)
> >>>> at
> >>>>
> >>>>
> >>>>  sun.reflect.**NativeMethodAccessorImpl.**invoke(**
> >>> NativeMethodAccessorImpl.java:**39)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
> >>> DelegatingMethodAccessorImpl.**java:25)
> >>>
> >>>> at java.lang.reflect.Method.**invoke(Method.java:597)
> >>>>   at
> >>>>
> >>>>
> >>>>  org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >>> launchEnhanced(Launcher.java:**290)
> >>>
> >>>> at
> >>>>
> >>>>  org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >>> launch(Launcher.java:230)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >>> mainWithExitCode(Launcher.**java:409)
> >>>
> >>>> at
> >>>> org.codehaus.plexus.**classworlds.launcher.Launcher.**
> >>>> main(Launcher.java:352)
> >>>> Caused by: org.apache.maven.plugin.**MojoExecutionException
> >>>> at
> >>>>
> >>>>
> >>>>  org.apache.cxf.maven_plugin.**AbstractXSDToJavaMojo.execute(**
> >>> AbstractXSDToJavaMojo.java:**320)
> >>>
> >>>>   at
> >>>> org.apache.cxf.maven_plugin.**XSDToJavaMojo.execute(**
> >>>> XSDToJavaMojo.java:42)
> >>>> at
> >>>>
> >>>>
> >>>>  org.apache.maven.plugin.**DefaultBuildPluginManager.**executeMojo(**
> >>> DefaultBuildPluginManager.**java:101)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  org.apache.maven.lifecycle.**internal.MojoExecutor.execute(**
> >>> MojoExecutor.java:209)
> >>>
> >>>> ... 19 more
> >>>> Caused by: java.lang.NullPointerException
> >>>>   at
> >>>>
> >>>>
> >>>>  org.sonatype.plexus.build.**incremental.**DefaultBuildContext.**
> >>> getMessage(**DefaultBuildContext.java:88)
> >>>
> >>>> at
> >>>>
> >>>>
> >>>>  org.sonatype.plexus.build.**incremental.**DefaultBuildContext.**
> >>> addMessage(**DefaultBuildContext.java:110)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>
>  org.apache.cxf.maven_plugin.**AbstractXSDToJavaMojo$**Listener.error(*
> >>> *AbstractXSDToJavaMojo.java:**149)
> >>>
> >>>> at
> >>>>
> >>>>
> >>>>  com.sun.tools.xjc.util.**ErrorReceiverFilter.error(**
> >>> ErrorReceiverFilter.java:77)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  com.sun.tools.xjc.util.**ErrorReceiverFilter.error(**
> >>> ErrorReceiverFilter.java:77)
> >>>
> >>>> at
> >>>>
> >>>>
> >>>>  com.sun.tools.xjc.util.**ErrorReceiverFilter.error(**
> >>> ErrorReceiverFilter.java:77)
> >>>
> >>>>   at
> >>>>
> >>>>
> >>>>  com.sun.org.apache.xerces.**internal.jaxp.validation.**
> >>> XMLSchemaFactory.newSchema(**XMLSchemaFactory.java:233)
> >>>
> >>>> at
> >>>>
> >>>>
> >>>>  com.sun.tools.xjc.reader.**xmlschema.parser.**
> >>> SchemaConstraintChecker.check(**SchemaConstraintChecker.java:**101)
> >>>
> >>>>   at com.sun.tools.xjc.ModelLoader.**loadXMLSchema(ModelLoader.**
> >>>> java:357)
> >>>> at com.sun.tools.xjc.ModelLoader.**load(ModelLoader.java:167)
> >>>>   at com.sun.tools.xjc.ModelLoader.**load(ModelLoader.java:113)
> >>>> at com.sun.tools.xjc.Driver.run(**Driver.java:313)
> >>>>   at
> >>>>
> >>>>
> >>>>  org.apache.cxf.maven_plugin.**AbstractXSDToJavaMojo.execute(**
> >>> AbstractXSDToJavaMojo.java:**307)
> >>>
> >>>> ... 22 more
> >>>>
> >>>> Maybe it could help.
> >>>>
> >>>>
> >>>> On 25 July 2013 09:32, Julio Carlos Barrera Juez <
> >>>> [email protected]> wrote:
> >>>>
> >>>>  I want to get Java classes from an XSD document. I want to use CXF
> XJC
> >>>>> Maven Plugin, but I'm experiencing some problems. I have followed the
> >>>>> documentation here: http://cxf.apache.org/cxf-xjc-**plugin.html<
> http://cxf.apache.org/cxf-xjc-plugin.html>
> >>>>> .
> >>>>>
> >>>>> I have this POM (more or less):
> >>>>>
> >>>>> ...
> >>>>> <plugin>
> >>>>> <groupId>org.apache.cxf</**groupId>
> >>>>> <artifactId>cxf-xjc-plugin</**artifactId>
> >>>>>   <version>2.6.1</version>
> >>>>> <executions>
> >>>>> <execution>
> >>>>>   <id>generate-sources</id>
> >>>>> <phase>generate-sources</**phase>
> >>>>> <goals>
> >>>>>   <goal>xsdtojava</goal>
> >>>>> </goals>
> >>>>> <configuration>
> >>>>>   <sourceRoot>${basedir}/target/**generated/src/main/java</**
> >>>>> sourceRoot>
> >>>>> <xsdOptions>
> >>>>>   <xsdOption>
> >>>>> <xsd>classpath:/path/to/xsd/**document.xsd</xsd>
> >>>>> <packagename>org.company.**package.whatever</packagename>
> >>>>>   </xsdOption>
> >>>>> </xsdOptions>
> >>>>> </configuration>
> >>>>>   </execution>
> >>>>> </executions>
> >>>>> </plugin>
> >>>>> ...
> >>>>>
> >>>>> When I execute the goal I'm getting:
> >>>>>
> >>>>> Failed to execute goal
> org.apache.cxf:cxf-xjc-plugin:**2.6.1:xsdtojava
> >>>>> (generate-sources) on project org.company.myproject: null:
> >>>>> MojoExecutionException: NullPointerException -> [Help 1]
> >>>>>
> >>>>> Am I Missing any parameter in the configuration?
> >>>>>
> >>>>>
> >
>

Reply via email to