You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Michael Lambert <mi...@michaellambert.com> on 2013/04/02 15:45:19 UTC
wadl2java classpath issues
The wadl2java tool does not seem to be able to handle relative paths to
schemas. When I try to execute: mvn generate-sources -X on a pom with the
following snippet:
<wadl:grammars>
<wadl:include href="store-locator-v1.xsd"/>
<!-- problem line.. note the elipses -->
<wadl:include href="../../common/faults-v1_0.xsd"/>
...
</wadl:grammers>
This exception stack is thrown:
[ERROR] Failed to execute goal
org.apache.cxf:cxf-wadl2java-plugin:2.5.2:wadl2java (generate-sources) on
project store-locator-rs-artifacts: java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
can not be read -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.cxf:cxf-wadl2java-plugin:2.5.2:wadl2java (generate-sources)
on project store-locator-rs-artifacts: java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
can not be read
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:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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:
java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
can not be read
at
org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCodeGenerator(AbstractCodeGeneratorMojo.java:458)
at
org.apache.cxf.maven_plugin.wadlto.WADL2JavaMojo.execute(WADL2JavaMojo.java:101)
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: org.apache.cxf.tools.common.ToolException:
java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
can not be read
at
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:84)
at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:65)
at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:57)
at
org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCodeGenerator(AbstractCodeGeneratorMojo.java:455)
... 22 more
Caused by: java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
can not be read
at
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.readIncludedDocument(SourceGenerator.java:1174)
at
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.getSchemaElements(SourceGenerator.java:1130)
at
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateSchemaCodeAndInfo(SourceGenerator.java:228)
at
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateSource(SourceGenerator.java:220)
at
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.processWadl(JAXRSContainer.java:153)
at
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:67)
at
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:76)
If I place the problemed schema in the same directory as the wadl
everything behaves:
<wadl:grammars>
<wadl:include href="store-locator-v1.xsd"/>
<wadl:include href="faults-v1_0.xsd"/>
...
</wadl:grammers>
I am inlining the pom and wadl in case the list has problems with
attachments. I hope that is okay. Am I doing something wrong?
Thank you in Advance.
----
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>store-locator-rs-artifacts</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<artifactId>api-maven-base</artifactId>
<groupId>com.acme.ecommerce</groupId>
<version>0.1.4</version>
</parent>
<dependencies>
<dependency>
<groupId>com.acme.ecommerce</groupId>
<artifactId>schemas</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-wadl2java-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
<wadlOptions>
<wadlOption>
<wadl>classpath:/services/store-locator/store-locator-wadl-v1.xml</wadl>
<extraargs>
<extraarg>-verbose</extraarg>
</extraargs>
<packagename>com.acme.ecommerce.store.locator.service.rs.version1</packagename>
<schemaPackagenames>
<schemaPackagename>urn:com:acme:ecommerce:wadl:store-locator:v1=com.acme.ecommerce.store.locator.service.rs.version1</schemaPackagename>
<schemaPackagename>urn:com:acme:ecommerce:schema:store-locator:v1=com.acme.ecommerce.store.locator.service.rs.version1</schemaPackagename>
</schemaPackagenames>
</wadlOption>
</wadlOptions>
</configuration>
<goals>
<goal>wadl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only.
It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.cxf
</groupId>
<artifactId>
cxf-wadl2java-plugin
</artifactId>
<versionRange>
[2.5.1,)
</versionRange>
<goals>
<goal>wadl2java</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
----
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wadl:application
xmlns="urn:com:acme:ecommerce:wadl:store-locator:v1"
targetNamespace="urn:com:acme:ecommerce:wadl:store-locator:v1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:store-locator-v1="urn:com:acme:ecommerce:schema:store-locator:v1"
xmlns:wadl="http://wadl.dev.java.net/2009/02">
<wadl:doc xml:lang="en" title="Version 1.0"/>
<wadl:grammars>
<wadl:include href="store-locator-v1.xsd"/>
<wadl:include href="../../common/faults-v1_0.xsd"/>
<xsd:schema
xmlns="urn:com:acme:ecommerce:wadl:store-locator:v1"
targetNamespace="urn:com:acme:ecommerce:wadl:store-locator:v1">
<xsd:simpleType name="StoreLocatorQueryEnumType">
<xsd:restriction base="xsd:normalizedString">
<xsd:enumeration value="find_by_geocode"/>
<xsd:enumeration value="find_by_address"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
</wadl:grammars>
<wadl:resources base="http://store-locator.acme.com">
<wadl:resource path="/store" id="StoreLocator">
<wadl:method href="#findByQuery"/>
</wadl:resource>
</wadl:resources>
<wadl:method name="GET" id="findByQuery">
<wadl:request>
<wadl:doc xml:lang="en" title="Find by query parameters. Valid queries are
'find by geocode' and 'find by geographic address'"/>
<!-- query name -->
<wadl:param name="q" style="query" type="StoreLocatorQueryEnumType"
required="true" />
<!-- geocode -->
<wadl:param name="latitude" style="query" type="xsd:double"
required="false" />
<wadl:param name="longitude" style="query" type="xsd:double"
required="false" />
<!-- geographic address -->
<wadl:param name="address_line_1" style="query" required="false" />
<wadl:param name="address_line_2" style="query" required="false" />
<wadl:param name="address_line_3" style="query" required="false" />
<wadl:param name="city" style="query" required="false" />
<wadl:param name="region" style="query" required="false" />
<wadl:param name="postal_code" style="query" required="false" />
<wadl:param name="country" style="query" required="false" />
</wadl:request>
<wadl:response>
<wadl:representation status="200"
mediaType="application/vnd.com.acme.ecommerce.store-locator-result+json;version=1.0"
element="store-locator-v1:StoreLocatorResultList"/>
<!--
<wadl:fault id="BadOrMissingValue" status="400"
mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
element="faults-v1_0:ValidationFault"/>
<wadl:fault id="NotAuthorized" status="403"
mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
element="faults-v1_0:NotAuthorizedFault"/>
<wadl:fault id="NotFound" status="404"
mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
element="faults-v1_0:NoEntityFoundFault"/>
<wadl:fault id="CanNotPerform" status="500"
mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
element="faults-v1_0:CanNotPerformFault"/>
-->
</wadl:response>
</wadl:method>
</wadl:application>
----
Re: wadl2java classpath issues
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Mike -
thanks for the test - I'll look asap,
Cheers, Sergey
On 09/04/13 19:25, Michael Lambert wrote:
> Sergey,
>
> It didnt seem to work for us. As we are traversing a jar file our
> problem is slightly different than the one you are testing. I am
> attaching a sample project that demonstrates the problem and
> a potential patch to fix it; using java.net.URL rather than java.net.URI
> fixes the issue for us.
>
> Thanks,
>
> Mike
>
>
> On Thu, Apr 4, 2013 at 10:10 AM, Michael Lambert
> <michael@michaellambert.com <ma...@michaellambert.com>> wrote:
>
> I will do it Monday Sergey. I really appreciate the effort!
>
>
> On Thu, Apr 4, 2013 at 9:51 AM, Sergey Beryozkin
> <sberyozkin@gmail.com <ma...@gmail.com>> wrote:
>
> Hi,
>
> On 03/04/13 00:13, Michael Lambert wrote:
>
> Its an essential feature for me unfortunately as I want to
> centrally manage
> all of my schemas so they can be easily discovered and
> reused. I need to be
> able to navigate around a jar to choose the ones I want to
> import. If I can
> be any help please let me know.
>
> I think I've fixed it, see [1]
>
> Can you please help on your end with trying 2.5.x SNAPSHOTS (as
> far as I recall you work with 2.5.x) in a day or two, or may be
> rebuilding 2.5.x locally and trying that ?
>
> Cheers, Sergey
>
> [1] https://issues.apache.org/__jira/browse/CXF-4946
> <https://issues.apache.org/jira/browse/CXF-4946>
>
>
> On Tue, Apr 2, 2013 at 3:38 PM, Sergey
> Beryozkin<sberyozkin@gmail.com
> <ma...@gmail.com>__>wrote:
>
> Hi
>
> It is the problem with resolving ".." against the base
> URI, you can have
> the schemas located in the same folder as the actual
> WADL or in child
> folders, example, schemas/myschema.xsd.
> I'll have a look later on and see if ".." can be
> supported too
>
> Cheers, Sergey
>
>
> On 02/04/13 16:45, Michael Lambert wrote:
>
> The wadl2java tool does not seem to be able to
> handle relative paths to
> schemas. When I try to execute: mvn generate-sources
> -X on a pom with the
> following snippet:
>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <!-- problem line.. note the elipses -->
> <wadl:include href="../../common/faults-v1_*__*0.xsd"/>
>
> ...
> </wadl:grammers>
>
> This exception stack is thrown:
>
> [ERROR] Failed to execute goal
> org.apache.cxf:cxf-wadl2java-*__*plugin:2.5.2:wadl2java
> (generate-sources)
>
> on
> project store-locator-rs-artifacts:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read -> [Help 1]
> org.apache.maven.lifecycle.**__LifecycleExecutionException:
> Failed to
> execute
> goal
> org.apache.cxf:cxf-wadl2java-*__*plugin:2.5.2:wadl2java
>
> (generate-sources)
> on project store-locator-rs-artifacts:
> java.lang.RuntimeException:
> Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> 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:__**57)
> at
> sun.reflect.**__DelegatingMethodAccessorImpl.*__*invoke(**
> DelegatingMethodAccessorImpl.*__*java:43)
> at java.lang.reflect.Method.**__invoke(Method.java:601)
> 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:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> at
> org.apache.cxf.maven_plugin.**__wadlto.**__AbstractCodeGeneratorMojo.**
> callCodeGenerator(**__AbstractCodeGeneratorMojo.**__java:458)
> at
> org.apache.cxf.maven_plugin.**__wadlto.WADL2JavaMojo.execute(*__*
> WADL2JavaMojo.java:101)
> 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:
> org.apache.cxf.tools.common.**__ToolException:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.execute(*__*
> JAXRSContainer.java:84)
> at
> org.apache.cxf.tools.common.**__toolspec.ToolRunner.runTool(**
> ToolRunner.java:103)
> at
> org.apache.cxf.tools.wadlto.**__WADLToJava.run(WADLToJava.**__java:65)
> at
> org.apache.cxf.tools.wadlto.**__WADLToJava.run(WADLToJava.**__java:57)
> at
> org.apache.cxf.maven_plugin.**__wadlto.**__AbstractCodeGeneratorMojo.**
> callCodeGenerator(**__AbstractCodeGeneratorMojo.**__java:455)
>
> ... 22 more
> Caused by: java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**
> readIncludedDocument(**__SourceGenerator.java:1174)
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**__getSchemaElements(**
> SourceGenerator.java:1130)
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**
> generateSchemaCodeAndInfo(**__SourceGenerator.java:228)
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**__generateSource(**
> SourceGenerator.java:220)
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.**
> processWadl(JAXRSContainer.**__java:153)
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.execute(*__*
> JAXRSContainer.java:67)
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.execute(*__*
>
> JAXRSContainer.java:76)
>
> If I place the problemed schema in the same
> directory as the wadl
> everything behaves:
>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <wadl:include href="faults-v1_0.xsd"/>
> ...
> </wadl:grammers>
>
> I am inlining the pom and wadl in case the list has
> problems with
> attachments. I hope that is okay. Am I doing
> something wrong?
>
> Thank you in Advance.
>
> ----
> <project
> xmlns="http://maven.apache.**__org/POM/4.0.0<http://maven.__apache.org/POM/4.0.0
> <http://maven.apache.org/POM/4.0.0>>"
> xmlns:xsi="
> http://www.w3.org/2001/**__XMLSchema-instance
> <http://www.w3.org/2001/**XMLSchema-instance><http://www.__w3.org/2001/XMLSchema-instance
> <http://www.w3.org/2001/XMLSchema-instance>__>"
> xsi:schemaLocation="
> http://maven.apache.org/POM/4.__**0.0
> <http://maven.apache.org/POM/4.**0.0><http://maven.apache.org/__POM/4.0.0
> <http://maven.apache.org/POM/4.0.0>>
> http://maven.apache.org/xsd/**__maven-4.0.0.xsd
> <http://maven.apache.org/xsd/**maven-4.0.0.xsd><http://maven.__apache.org/xsd/maven-4.0.0.xsd
> <http://maven.apache.org/xsd/maven-4.0.0.xsd>__>
> ">
> <modelVersion>4.0.0</**__modelVersion>
> <artifactId>store-locator-rs-*__*artifacts</artifactId>
> <version>0.0.1-SNAPSHOT</**__version>
> <parent>
> <artifactId>api-maven-base</**__artifactId>
> <groupId>com.acme.ecommerce</*__*groupId>
>
> <version>0.1.4</version>
> </parent>
> <dependencies>
> <dependency>
> <groupId>com.acme.ecommerce</*__*groupId>
> <artifactId>schemas</**__artifactId>
> <version>0.0.1-SNAPSHOT</**__version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</**__groupId>
> <artifactId>cxf-bundle-jaxrs</__**artifactId>
>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.cxf</**__groupId>
> <artifactId>cxf-wadl2java-**__plugin</artifactId>
>
> <version>2.5.2</version>
> <executions>
> <execution>
> <id>generate-sources</id>
> <phase>generate-sources</**__phase>
> <configuration>
> <sourceRoot>${basedir}/target/__**generated/src/main/java</**__sourceRoot>
> <wadlOptions>
> <wadlOption>
> <wadl>classpath:/services/**__store-locator/store-locator-**
>
> wadl-v1.xml</wadl>
> <extraargs>
> <extraarg>-verbose</extraarg>
> </extraargs>
> <packagename>com.acme.**__ecommerce.store.locator.**__service.rs.version1</**
> packagename>
> <schemaPackagenames>
> <schemaPackagename>urn:com:**__acme:ecommerce:wadl:store-**
> locator:v1=com.acme.ecommerce.__**store.locator.service.rs.**
> version1</schemaPackagename>
> <schemaPackagename>urn:com:**__acme:ecommerce:schema:store-**
> locator:v1=com.acme.ecommerce.__**store.locator.service.rs.**
>
> version1</schemaPackagename>
> </schemaPackagenames>
> </wadlOption>
> </wadlOptions>
> </configuration>
> <goals>
> <goal>wadl2java</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> <pluginManagement>
> <plugins>
> <!--This plugin's configuration is used to store
> Eclipse m2e settings
> only.
> It has no influence on the Maven build itself.-->
> <plugin>
> <groupId>org.eclipse.m2e</**__groupId>
> <artifactId>lifecycle-mapping<__**/artifactId>
>
> <version>1.0.0</version>
> <configuration>
> <lifecycleMappingMetadata>
> <pluginExecutions>
> <pluginExecution>
> <pluginExecutionFilter>
> <groupId>
> org.apache.cxf
> </groupId>
> <artifactId>
> cxf-wadl2java-plugin
> </artifactId>
> <versionRange>
> [2.5.1,)
> </versionRange>
> <goals>
> <goal>wadl2java</goal>
> </goals>
> </pluginExecutionFilter>
> <action>
> <ignore></ignore>
> </action>
> </pluginExecution>
> </pluginExecutions>
> </lifecycleMappingMetadata>
> </configuration>
> </plugin>
> </plugins>
> </pluginManagement>
> </build>
> </project>
>
> ----
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>
> <wadl:application
> xmlns="urn:com:acme:ecommerce:__**wadl:store-locator:v1"
> targetNamespace="urn:com:acme:__**ecommerce:wadl:store-__locator:**v1"
> xmlns:xsd="http://www.w3.org/*__*2001/XMLSchema
> <http://www.w3.org/**2001/XMLSchema><http://www.w3.__org/2001/XMLSchema
> <http://www.w3.org/2001/XMLSchema>>
> "
> xmlns:store-locator-v1="urn:**__com:acme:ecommerce:schema:**
> store-locator:v1"
> xmlns:wadl="http://wadl.dev.**__java.net/2009/02
> <http://java.net/2009/02><http://wadl.__dev.java.net/2009/02
> <http://wadl.dev.java.net/2009/02>>
>
> ">
> <wadl:doc xml:lang="en" title="Version 1.0"/>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <wadl:include href="../../common/faults-v1_*__*0.xsd"/>
> <xsd:schema
> xmlns="urn:com:acme:ecommerce:__**wadl:store-locator:v1"
> targetNamespace="urn:com:acme:__**ecommerce:wadl:store-__locator:**v1">
> <xsd:simpleType name="**__StoreLocatorQueryEnumType">
>
> <xsd:restriction base="xsd:normalizedString">
> <xsd:enumeration value="find_by_geocode"/>
> <xsd:enumeration value="find_by_address"/>
> </xsd:restriction>
> </xsd:simpleType>
> </xsd:schema>
> </wadl:grammars>
>
> <wadl:resources
> base="http://store-locator.**a__cme.com
> <http://acme.com><http://store-locator.__acme.com
> <http://store-locator.acme.com>>
>
> ">
> <wadl:resource path="/store" id="StoreLocator">
> <wadl:method href="#findByQuery"/>
> </wadl:resource>
> </wadl:resources>
>
> <wadl:method name="GET" id="findByQuery">
> <wadl:request>
> <wadl:doc xml:lang="en" title="Find by query
> parameters. Valid queries are
> 'find by geocode' and 'find by geographic address'"/>
> <!-- query name -->
> <wadl:param name="q" style="query"
> type="**__StoreLocatorQueryEnumType"
>
> required="true" />
> <!-- geocode -->
> <wadl:param name="latitude" style="query"
> type="xsd:double"
> required="false" />
> <wadl:param name="longitude" style="query"
> type="xsd:double"
> required="false" />
> <!-- geographic address -->
> <wadl:param name="address_line_1" style="query"
> required="false" />
> <wadl:param name="address_line_2" style="query"
> required="false" />
> <wadl:param name="address_line_3" style="query"
> required="false" />
> <wadl:param name="city" style="query"
> required="false" />
> <wadl:param name="region" style="query"
> required="false" />
> <wadl:param name="postal_code" style="query"
> required="false" />
> <wadl:param name="country" style="query"
> required="false" />
> </wadl:request>
> <wadl:response>
> <wadl:representation status="200"
> mediaType="application/vnd.**__com.acme.ecommerce.store-**
> locator-result+json;version=1.__**0"
> element="store-locator-v1:**__StoreLocatorResultList"/>
>
> <!--
> <wadl:fault id="BadOrMissingValue" status="400"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__ValidationFault"/>
>
> <wadl:fault id="NotAuthorized" status="403"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__NotAuthorizedFault"/>
>
> <wadl:fault id="NotFound" status="404"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__NoEntityFoundFault"/>
>
> <wadl:fault id="CanNotPerform" status="500"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__CanNotPerformFault"/>
>
> -->
> </wadl:response>
> </wadl:method>
> </wadl:application>
> ----
>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>
>
>
>
Re: wadl2java classpath issues
Posted by Sergey Beryozkin <sb...@gmail.com>.
On 12/04/13 14:00, Michael Lambert wrote:
> I am yet again in your debt.
I guess it is the other way around as it was you who reported the issue,
provided the test case and the hint on how to fix that :-)
> We will test this out and let you know! Thanks
> Sergey!
I've just merged to 2.5.x - give it a try in a day or so
Thanks, Sergey
>
>
> On Thu, Apr 11, 2013 at 12:25 PM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> Hi Mike
>>
>> Thanks again for the test and the tip, I was not sure how URL would make
>> it work better till Dan showed me how :-)
>>
>> As it happens, JAX-RS 2.0 implementations are expected to support
>> resolve() and relativize functions too, I will need the related CXF code be
>> stressed and improved a bit more before actually switching to using it,
>>
>> The fix is on the trunk, will work on merging it the branches in the next
>> few days
>>
>>
>> Cheers, Sergey
>>
>> On 09/04/13 19:25, Michael Lambert wrote:
>>
>>> Sergey,
>>>
>>> It didnt seem to work for us. As we are traversing a jar file our
>>> problem is slightly different than the one you are testing. I am
>>> attaching a sample project that demonstrates the problem and
>>> a potential patch to fix it; using java.net.URL rather than java.net.URI
>>> fixes the issue for us.
>>>
>>> Thanks,
>>>
>>> Mike
>>>
>>>
>>> On Thu, Apr 4, 2013 at 10:10 AM, Michael Lambert
>>> <mi...@michaellambert.com>>>
>>> wrote:
>>>
>>> I will do it Monday Sergey. I really appreciate the effort!
>>>
>>>
>>> On Thu, Apr 4, 2013 at 9:51 AM, Sergey Beryozkin
>>> <sb...@gmail.com>> wrote:
>>>
>>> Hi,
>>>
>>> On 03/04/13 00:13, Michael Lambert wrote:
>>>
>>> Its an essential feature for me unfortunately as I want to
>>> centrally manage
>>> all of my schemas so they can be easily discovered and
>>> reused. I need to be
>>> able to navigate around a jar to choose the ones I want to
>>> import. If I can
>>> be any help please let me know.
>>>
>>> I think I've fixed it, see [1]
>>>
>>> Can you please help on your end with trying 2.5.x SNAPSHOTS (as
>>> far as I recall you work with 2.5.x) in a day or two, or may be
>>> rebuilding 2.5.x locally and trying that ?
>>>
>>> Cheers, Sergey
>>>
>>> [1] https://issues.apache.org/__**jira/browse/CXF-4946<https://issues.apache.org/__jira/browse/CXF-4946>
>>>
>>> <https://issues.apache.org/**jira/browse/CXF-4946<https://issues.apache.org/jira/browse/CXF-4946>
>>>>
>>>
>>>
>>> On Tue, Apr 2, 2013 at 3:38 PM, Sergey
>>> Beryozkin<sberyozkin@gmail.com
>>> <ma...@gmail.com>_**_>wrote:
>>>
>>>
>>> Hi
>>>
>>> It is the problem with resolving ".." against the base
>>> URI, you can have
>>> the schemas located in the same folder as the actual
>>> WADL or in child
>>> folders, example, schemas/myschema.xsd.
>>> I'll have a look later on and see if ".." can be
>>> supported too
>>>
>>> Cheers, Sergey
>>>
>>>
>>> On 02/04/13 16:45, Michael Lambert wrote:
>>>
>>> The wadl2java tool does not seem to be able to
>>> handle relative paths to
>>> schemas. When I try to execute: mvn generate-sources
>>> -X on a pom with the
>>> following snippet:
>>>
>>> <wadl:grammars>
>>> <wadl:include href="store-locator-v1.xsd"/>
>>> <!-- problem line.. note the elipses -->
>>> <wadl:include href="../../common/faults-v1_***
>>> __*0.xsd"/>
>>>
>>>
>>> ...
>>> </wadl:grammers>
>>>
>>> This exception stack is thrown:
>>>
>>> [ERROR] Failed to execute goal
>>> org.apache.cxf:cxf-wadl2java-***
>>> __*plugin:2.5.2:wadl2java
>>>
>>> (generate-sources)
>>>
>>> on
>>> project store-locator-rs-artifacts:
>>> java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**_**
>>> _repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**__**
>>> SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-***
>>> __*locator/../../common/**faults-*__*v1_0.xsd
>>>
>>>
>>> can not be read -> [Help 1]
>>> org.apache.maven.lifecycle.**_**
>>> _LifecycleExecutionException:
>>> Failed to
>>> execute
>>> goal
>>> org.apache.cxf:cxf-wadl2java-***
>>> __*plugin:2.5.2:wadl2java
>>>
>>>
>>> (generate-sources)
>>> on project store-locator-rs-artifacts:
>>> java.lang.RuntimeException:
>>> Resource
>>> jar:file:/home/lamberm/.m2/**_**
>>> _repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**__**
>>> SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-***
>>> __*locator/../../common/**faults-*__*v1_0.xsd
>>>
>>>
>>> can not be read
>>> 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:**__**57)
>>> at
>>> sun.reflect.**__**DelegatingMethodAccessorImpl.***
>>> __*invoke(**
>>> DelegatingMethodAccessorImpl.***__*java:43)
>>> at java.lang.reflect.Method.**__**
>>> invoke(Method.java:601)
>>> 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:
>>> java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**_**
>>> _repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**__**
>>> SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-***
>>> __*locator/../../common/**faults-*__*v1_0.xsd
>>>
>>> can not be read
>>> at
>>> org.apache.cxf.maven_plugin.****__wadlto.**__**
>>> AbstractCodeGeneratorMojo.**
>>> callCodeGenerator(**__**
>>> AbstractCodeGeneratorMojo.**__**java:458)
>>> at
>>> org.apache.cxf.maven_plugin.****
>>> __wadlto.WADL2JavaMojo.**execute(*__*
>>> WADL2JavaMojo.java:101)
>>> 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:
>>> org.apache.cxf.tools.common.****__ToolException:
>>> java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**_**
>>> _repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**__**
>>> SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-***
>>> __*locator/../../common/**faults-*__*v1_0.xsd
>>>
>>> can not be read
>>> at
>>> org.apache.cxf.tools.wadlto.****
>>> __jaxrs.JAXRSContainer.**execute(*__*
>>> JAXRSContainer.java:84)
>>> at
>>> org.apache.cxf.tools.common.****
>>> __toolspec.ToolRunner.runTool(****
>>> ToolRunner.java:103)
>>> at
>>> org.apache.cxf.tools.wadlto.****
>>> __WADLToJava.run(WADLToJava.****__java:65)
>>> at
>>> org.apache.cxf.tools.wadlto.****
>>> __WADLToJava.run(WADLToJava.****__java:57)
>>> at
>>> org.apache.cxf.maven_plugin.****__wadlto.**__**
>>> AbstractCodeGeneratorMojo.**
>>> callCodeGenerator(**__**
>>> AbstractCodeGeneratorMojo.**__**java:455)
>>>
>>>
>>> ... 22 more
>>> Caused by: java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**_**
>>> _repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**__**
>>> SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-***
>>> __*locator/../../common/**faults-*__*v1_0.xsd
>>>
>>>
>>> can not be read
>>> at
>>> org.apache.cxf.jaxrs.ext.**__**
>>> codegen.SourceGenerator.**
>>> readIncludedDocument(**__**SourceGenerator.java:1174)
>>> at
>>> org.apache.cxf.jaxrs.ext.**__**
>>> codegen.SourceGenerator.**__**getSchemaElements(**
>>> SourceGenerator.java:1130)
>>> at
>>> org.apache.cxf.jaxrs.ext.**__**
>>> codegen.SourceGenerator.**
>>> generateSchemaCodeAndInfo(**__**
>>> SourceGenerator.java:228)
>>> at
>>> org.apache.cxf.jaxrs.ext.**__**
>>> codegen.SourceGenerator.**__**generateSource(**
>>> SourceGenerator.java:220)
>>> at
>>> org.apache.cxf.tools.wadlto.****
>>> __jaxrs.JAXRSContainer.**
>>> processWadl(JAXRSContainer.**_**_java:153)
>>> at
>>> org.apache.cxf.tools.wadlto.****
>>> __jaxrs.JAXRSContainer.**execute(*__*
>>> JAXRSContainer.java:67)
>>> at
>>> org.apache.cxf.tools.wadlto.****
>>> __jaxrs.JAXRSContainer.**execute(*__*
>>>
>>> JAXRSContainer.java:76)
>>>
>>> If I place the problemed schema in the same
>>> directory as the wadl
>>> everything behaves:
>>>
>>> <wadl:grammars>
>>> <wadl:include href="store-locator-v1.xsd"/>
>>> <wadl:include href="faults-v1_0.xsd"/>
>>> ...
>>> </wadl:grammers>
>>>
>>> I am inlining the pom and wadl in case the list has
>>> problems with
>>> attachments. I hope that is okay. Am I doing
>>> something wrong?
>>>
>>> Thank you in Advance.
>>>
>>> ----
>>> <project
>>> xmlns="http://maven.apache.**_**_org/POM/4.0.0<
>>> http://maven.__**apache.org/POM/4.0.0<http://apache.org/POM/4.0.0>
>>> <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>>>>> "
>>> xmlns:xsi="
>>>
>>> http://www.w3.org/2001/**__**XMLSchema-instance<http://www.w3.org/2001/**__XMLSchema-instance>
>>> <http://www.w3.org/2001/****XMLSchema-instance<http://www.w3.org/2001/**XMLSchema-instance>
>>>> <http://**www.<http://www.>__w3.org/2001/XMLSchema-**instance<http://w3.org/2001/XMLSchema-instance>
>>> <http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>>>> __>"
>>> xsi:schemaLocation="
>>> http://maven.apache.org/POM/4.**__**0.0<http://maven.apache.org/POM/4.__**0.0>
>>> <http://maven.apache.org/POM/**4.**0.0<http://maven.apache.org/POM/4.**0.0>
>>>> <http://maven.apache.**org/__POM/4.0.0<http://maven.apache.org/__POM/4.0.0>
>>> <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>>>>>
>>> http://maven.apache.org/xsd/****__maven-4.0.0.xsd<http://maven.apache.org/xsd/**__maven-4.0.0.xsd>
>>> <http://maven.apache.org/xsd/****maven-4.0.0.xsd<http://maven.apache.org/xsd/**maven-4.0.0.xsd>
>>>> <http://**maven.<http://maven.>__apache.org/xsd/maven-**4.0.0.xsd<http://apache.org/xsd/maven-4.0.0.xsd>
>>> <http://maven.apache.org/xsd/**maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
>>>> __>
>>> ">
>>> <modelVersion>4.0.0</**__**modelVersion>
>>> <artifactId>store-locator-rs-***
>>> __*artifacts</artifactId>
>>> <version>0.0.1-SNAPSHOT</**__**version>
>>> <parent>
>>> <artifactId>api-maven-base</****__artifactId>
>>> <groupId>com.acme.ecommerce</***__*groupId>
>>>
>>> <version>0.1.4</version>
>>> </parent>
>>> <dependencies>
>>> <dependency>
>>> <groupId>com.acme.ecommerce</***__*groupId>
>>> <artifactId>schemas</**__**artifactId>
>>> <version>0.0.1-SNAPSHOT</**__**version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.cxf</**__**groupId>
>>> <artifactId>cxf-bundle-jaxrs</**__**artifactId>
>>>
>>> </dependency>
>>> </dependencies>
>>> <build>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.cxf</**__**groupId>
>>> <artifactId>cxf-wadl2java-**__**plugin</artifactId>
>>>
>>>
>>> <version>2.5.2</version>
>>> <executions>
>>> <execution>
>>> <id>generate-sources</id>
>>> <phase>generate-sources</**__**phase>
>>> <configuration>
>>> <sourceRoot>${basedir}/target/**
>>> __**generated/src/main/java</****__sourceRoot>
>>> <wadlOptions>
>>> <wadlOption>
>>> <wadl>classpath:/services/**__**
>>> store-locator/store-locator-**
>>>
>>> wadl-v1.xml</wadl>
>>> <extraargs>
>>> <extraarg>-verbose</extraarg>
>>> </extraargs>
>>> <packagename>com.acme.**__**
>>> ecommerce.store.locator.**__**service.rs.version1</**
>>> packagename>
>>> <schemaPackagenames>
>>>
>>> <schemaPackagename>urn:com:**_**
>>> _acme:ecommerce:wadl:store-**
>>> locator:v1=com.acme.ecommerce.**
>>> __**store.locator.service.rs.****
>>> version1</schemaPackagename>
>>>
>>> <schemaPackagename>urn:com:**_**
>>> _acme:ecommerce:schema:store-****
>>> locator:v1=com.acme.ecommerce.**
>>> __**store.locator.service.rs.****
>>>
>>> version1</schemaPackagename>
>>> </schemaPackagenames>
>>> </wadlOption>
>>> </wadlOptions>
>>> </configuration>
>>> <goals>
>>> <goal>wadl2java</goal>
>>> </goals>
>>> </execution>
>>> </executions>
>>> </plugin>
>>> </plugins>
>>> <pluginManagement>
>>> <plugins>
>>> <!--This plugin's configuration is used to store
>>> Eclipse m2e settings
>>> only.
>>> It has no influence on the Maven build itself.-->
>>> <plugin>
>>> <groupId>org.eclipse.m2e</**__**groupId>
>>> <artifactId>lifecycle-mapping<**__**/artifactId>
>>>
>>>
>>> <version>1.0.0</version>
>>> <configuration>
>>> <lifecycleMappingMetadata>
>>> <pluginExecutions>
>>> <pluginExecution>
>>> <pluginExecutionFilter>
>>> <groupId>
>>> org.apache.cxf
>>> </groupId>
>>> <artifactId>
>>> cxf-wadl2java-plugin
>>> </artifactId>
>>> <versionRange>
>>> [2.5.1,)
>>> </versionRange>
>>> <goals>
>>> <goal>wadl2java</goal>
>>> </goals>
>>> </pluginExecutionFilter>
>>> <action>
>>> <ignore></ignore>
>>> </action>
>>> </pluginExecution>
>>> </pluginExecutions>
>>> </lifecycleMappingMetadata>
>>> </configuration>
>>> </plugin>
>>> </plugins>
>>> </pluginManagement>
>>> </build>
>>> </project>
>>>
>>> ----
>>> <?xml version="1.0" encoding="UTF-8"
>>> standalone="yes"?>
>>>
>>> <wadl:application
>>> xmlns="urn:com:acme:ecommerce:**
>>> __**wadl:store-locator:v1"
>>> targetNamespace="urn:com:acme:**
>>> __**ecommerce:wadl:store-__**locator:**v1"
>>> xmlns:xsd="http://www.w3.org/***__*2001/XMLSchema<http://www.w3.org/*__*2001/XMLSchema>
>>> <http://www.w3.org/**2001/**XMLSchema<http://www.w3.org/**2001/XMLSchema>
>>>> <http://www.w3.__**org/2001/XMLSchema
>>> <http://www.w3.org/2001/**XMLSchema<http://www.w3.org/2001/XMLSchema>
>>>>>
>>> "
>>> xmlns:store-locator-v1="urn:****
>>> __com:acme:ecommerce:schema:**
>>> store-locator:v1"
>>>
>>> xmlns:wadl="http://wadl.dev.****__java.net/2009/02
>>> <http://java.net/2009/02><http**://wadl.<http://wadl.>
>>> __dev.java.net/2009/02
>>> <http://wadl.dev.java.net/**2009/02<http://wadl.dev.java.net/2009/02>
>>>>>
>>>
>>> ">
>>> <wadl:doc xml:lang="en" title="Version 1.0"/>
>>> <wadl:grammars>
>>> <wadl:include href="store-locator-v1.xsd"/>
>>> <wadl:include href="../../common/faults-v1_***
>>> __*0.xsd"/>
>>> <xsd:schema
>>>
>>> xmlns="urn:com:acme:ecommerce:**
>>> __**wadl:store-locator:v1"
>>> targetNamespace="urn:com:acme:**
>>> __**ecommerce:wadl:store-__**locator:**v1">
>>> <xsd:simpleType name="**__**
>>> StoreLocatorQueryEnumType">
>>>
>>> <xsd:restriction base="xsd:normalizedString">
>>> <xsd:enumeration value="find_by_geocode"/>
>>> <xsd:enumeration value="find_by_address"/>
>>> </xsd:restriction>
>>> </xsd:simpleType>
>>> </xsd:schema>
>>> </wadl:grammars>
>>>
>>> <wadl:resources
>>> base="http://store-locator.**a**__cme.com<http://a__cme.com>
>>> <http://acme.com><http://**store-locator.<http://store-locator.>
>>> __acme.com
>>> <http://store-locator.acme.com**>>
>>>
>>> ">
>>> <wadl:resource path="/store" id="StoreLocator">
>>> <wadl:method href="#findByQuery"/>
>>> </wadl:resource>
>>> </wadl:resources>
>>>
>>> <wadl:method name="GET" id="findByQuery">
>>> <wadl:request>
>>> <wadl:doc xml:lang="en" title="Find by query
>>> parameters. Valid queries are
>>> 'find by geocode' and 'find by geographic address'"/>
>>> <!-- query name -->
>>> <wadl:param name="q" style="query"
>>> type="**__**StoreLocatorQueryEnumType"
>>>
>>>
>>> required="true" />
>>> <!-- geocode -->
>>> <wadl:param name="latitude" style="query"
>>> type="xsd:double"
>>> required="false" />
>>> <wadl:param name="longitude" style="query"
>>> type="xsd:double"
>>> required="false" />
>>> <!-- geographic address -->
>>> <wadl:param name="address_line_1" style="query"
>>> required="false" />
>>> <wadl:param name="address_line_2" style="query"
>>> required="false" />
>>> <wadl:param name="address_line_3" style="query"
>>> required="false" />
>>> <wadl:param name="city" style="query"
>>> required="false" />
>>> <wadl:param name="region" style="query"
>>> required="false" />
>>> <wadl:param name="postal_code" style="query"
>>> required="false" />
>>> <wadl:param name="country" style="query"
>>> required="false" />
>>> </wadl:request>
>>> <wadl:response>
>>> <wadl:representation status="200"
>>> mediaType="application/vnd.**_**
>>> _com.acme.ecommerce.store-**
>>> locator-result+json;version=1.**__**0"
>>> element="store-locator-v1:**__**
>>> StoreLocatorResultList"/>
>>>
>>>
>>> <!--
>>> <wadl:fault id="BadOrMissingValue" status="400"
>>> mediaType="application/vnd.**_**
>>> _com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**__**ValidationFault"/>
>>>
>>>
>>> <wadl:fault id="NotAuthorized" status="403"
>>> mediaType="application/vnd.**_**
>>> _com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**__**NotAuthorizedFault"/>
>>>
>>>
>>> <wadl:fault id="NotFound" status="404"
>>> mediaType="application/vnd.**_**
>>> _com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**__**NoEntityFoundFault"/>
>>>
>>>
>>> <wadl:fault id="CanNotPerform" status="500"
>>> mediaType="application/vnd.**_**
>>> _com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**__**CanNotPerformFault"/>
>>>
>>>
>>> -->
>>> </wadl:response>
>>> </wadl:method>
>>> </wadl:application>
>>> ----
>>>
>>>
>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>> Blog: http://sberyozkin.blogspot.com
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>
Re: wadl2java classpath issues
Posted by Michael Lambert <mi...@michaellambert.com>.
I am yet again in your debt. We will test this out and let you know! Thanks
Sergey!
On Thu, Apr 11, 2013 at 12:25 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
> Hi Mike
>
> Thanks again for the test and the tip, I was not sure how URL would make
> it work better till Dan showed me how :-)
>
> As it happens, JAX-RS 2.0 implementations are expected to support
> resolve() and relativize functions too, I will need the related CXF code be
> stressed and improved a bit more before actually switching to using it,
>
> The fix is on the trunk, will work on merging it the branches in the next
> few days
>
>
> Cheers, Sergey
>
> On 09/04/13 19:25, Michael Lambert wrote:
>
>> Sergey,
>>
>> It didnt seem to work for us. As we are traversing a jar file our
>> problem is slightly different than the one you are testing. I am
>> attaching a sample project that demonstrates the problem and
>> a potential patch to fix it; using java.net.URL rather than java.net.URI
>> fixes the issue for us.
>>
>> Thanks,
>>
>> Mike
>>
>>
>> On Thu, Apr 4, 2013 at 10:10 AM, Michael Lambert
>> <michael@michaellambert.com <ma...@michaellambert.com>>>
>> wrote:
>>
>> I will do it Monday Sergey. I really appreciate the effort!
>>
>>
>> On Thu, Apr 4, 2013 at 9:51 AM, Sergey Beryozkin
>> <sberyozkin@gmail.com <ma...@gmail.com>> wrote:
>>
>> Hi,
>>
>> On 03/04/13 00:13, Michael Lambert wrote:
>>
>> Its an essential feature for me unfortunately as I want to
>> centrally manage
>> all of my schemas so they can be easily discovered and
>> reused. I need to be
>> able to navigate around a jar to choose the ones I want to
>> import. If I can
>> be any help please let me know.
>>
>> I think I've fixed it, see [1]
>>
>> Can you please help on your end with trying 2.5.x SNAPSHOTS (as
>> far as I recall you work with 2.5.x) in a day or two, or may be
>> rebuilding 2.5.x locally and trying that ?
>>
>> Cheers, Sergey
>>
>> [1] https://issues.apache.org/__**jira/browse/CXF-4946<https://issues.apache.org/__jira/browse/CXF-4946>
>>
>> <https://issues.apache.org/**jira/browse/CXF-4946<https://issues.apache.org/jira/browse/CXF-4946>
>> >
>>
>>
>> On Tue, Apr 2, 2013 at 3:38 PM, Sergey
>> Beryozkin<sberyozkin@gmail.com
>> <ma...@gmail.com>_**_>wrote:
>>
>>
>> Hi
>>
>> It is the problem with resolving ".." against the base
>> URI, you can have
>> the schemas located in the same folder as the actual
>> WADL or in child
>> folders, example, schemas/myschema.xsd.
>> I'll have a look later on and see if ".." can be
>> supported too
>>
>> Cheers, Sergey
>>
>>
>> On 02/04/13 16:45, Michael Lambert wrote:
>>
>> The wadl2java tool does not seem to be able to
>> handle relative paths to
>> schemas. When I try to execute: mvn generate-sources
>> -X on a pom with the
>> following snippet:
>>
>> <wadl:grammars>
>> <wadl:include href="store-locator-v1.xsd"/>
>> <!-- problem line.. note the elipses -->
>> <wadl:include href="../../common/faults-v1_***
>> __*0.xsd"/>
>>
>>
>> ...
>> </wadl:grammers>
>>
>> This exception stack is thrown:
>>
>> [ERROR] Failed to execute goal
>> org.apache.cxf:cxf-wadl2java-***
>> __*plugin:2.5.2:wadl2java
>>
>> (generate-sources)
>>
>> on
>> project store-locator-rs-artifacts:
>> java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**_**
>> _repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**__**
>> SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-***
>> __*locator/../../common/**faults-*__*v1_0.xsd
>>
>>
>> can not be read -> [Help 1]
>> org.apache.maven.lifecycle.**_**
>> _LifecycleExecutionException:
>> Failed to
>> execute
>> goal
>> org.apache.cxf:cxf-wadl2java-***
>> __*plugin:2.5.2:wadl2java
>>
>>
>> (generate-sources)
>> on project store-locator-rs-artifacts:
>> java.lang.RuntimeException:
>> Resource
>> jar:file:/home/lamberm/.m2/**_**
>> _repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**__**
>> SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-***
>> __*locator/../../common/**faults-*__*v1_0.xsd
>>
>>
>> can not be read
>> 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:**__**57)
>> at
>> sun.reflect.**__**DelegatingMethodAccessorImpl.***
>> __*invoke(**
>> DelegatingMethodAccessorImpl.***__*java:43)
>> at java.lang.reflect.Method.**__**
>> invoke(Method.java:601)
>> 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:
>> java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**_**
>> _repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**__**
>> SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-***
>> __*locator/../../common/**faults-*__*v1_0.xsd
>>
>> can not be read
>> at
>> org.apache.cxf.maven_plugin.****__wadlto.**__**
>> AbstractCodeGeneratorMojo.**
>> callCodeGenerator(**__**
>> AbstractCodeGeneratorMojo.**__**java:458)
>> at
>> org.apache.cxf.maven_plugin.****
>> __wadlto.WADL2JavaMojo.**execute(*__*
>> WADL2JavaMojo.java:101)
>> 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:
>> org.apache.cxf.tools.common.****__ToolException:
>> java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**_**
>> _repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**__**
>> SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-***
>> __*locator/../../common/**faults-*__*v1_0.xsd
>>
>> can not be read
>> at
>> org.apache.cxf.tools.wadlto.****
>> __jaxrs.JAXRSContainer.**execute(*__*
>> JAXRSContainer.java:84)
>> at
>> org.apache.cxf.tools.common.****
>> __toolspec.ToolRunner.runTool(****
>> ToolRunner.java:103)
>> at
>> org.apache.cxf.tools.wadlto.****
>> __WADLToJava.run(WADLToJava.****__java:65)
>> at
>> org.apache.cxf.tools.wadlto.****
>> __WADLToJava.run(WADLToJava.****__java:57)
>> at
>> org.apache.cxf.maven_plugin.****__wadlto.**__**
>> AbstractCodeGeneratorMojo.**
>> callCodeGenerator(**__**
>> AbstractCodeGeneratorMojo.**__**java:455)
>>
>>
>> ... 22 more
>> Caused by: java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**_**
>> _repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**__**
>> SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-***
>> __*locator/../../common/**faults-*__*v1_0.xsd
>>
>>
>> can not be read
>> at
>> org.apache.cxf.jaxrs.ext.**__**
>> codegen.SourceGenerator.**
>> readIncludedDocument(**__**SourceGenerator.java:1174)
>> at
>> org.apache.cxf.jaxrs.ext.**__**
>> codegen.SourceGenerator.**__**getSchemaElements(**
>> SourceGenerator.java:1130)
>> at
>> org.apache.cxf.jaxrs.ext.**__**
>> codegen.SourceGenerator.**
>> generateSchemaCodeAndInfo(**__**
>> SourceGenerator.java:228)
>> at
>> org.apache.cxf.jaxrs.ext.**__**
>> codegen.SourceGenerator.**__**generateSource(**
>> SourceGenerator.java:220)
>> at
>> org.apache.cxf.tools.wadlto.****
>> __jaxrs.JAXRSContainer.**
>> processWadl(JAXRSContainer.**_**_java:153)
>> at
>> org.apache.cxf.tools.wadlto.****
>> __jaxrs.JAXRSContainer.**execute(*__*
>> JAXRSContainer.java:67)
>> at
>> org.apache.cxf.tools.wadlto.****
>> __jaxrs.JAXRSContainer.**execute(*__*
>>
>> JAXRSContainer.java:76)
>>
>> If I place the problemed schema in the same
>> directory as the wadl
>> everything behaves:
>>
>> <wadl:grammars>
>> <wadl:include href="store-locator-v1.xsd"/>
>> <wadl:include href="faults-v1_0.xsd"/>
>> ...
>> </wadl:grammers>
>>
>> I am inlining the pom and wadl in case the list has
>> problems with
>> attachments. I hope that is okay. Am I doing
>> something wrong?
>>
>> Thank you in Advance.
>>
>> ----
>> <project
>> xmlns="http://maven.apache.**_**_org/POM/4.0.0<
>> http://maven.__**apache.org/POM/4.0.0 <http://apache.org/POM/4.0.0>
>> <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >>"
>> xmlns:xsi="
>>
>> http://www.w3.org/2001/**__**XMLSchema-instance<http://www.w3.org/2001/**__XMLSchema-instance>
>> <http://www.w3.org/2001/****XMLSchema-instance<http://www.w3.org/2001/**XMLSchema-instance>
>> ><http://**www. <http://www.>__w3.org/2001/XMLSchema-**instance<http://w3.org/2001/XMLSchema-instance>
>> <http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>> >__>"
>> xsi:schemaLocation="
>> http://maven.apache.org/POM/4.**__**0.0<http://maven.apache.org/POM/4.__**0.0>
>> <http://maven.apache.org/POM/**4.**0.0<http://maven.apache.org/POM/4.**0.0>
>> ><http://maven.apache.**org/__POM/4.0.0<http://maven.apache.org/__POM/4.0.0>
>> <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >>
>> http://maven.apache.org/xsd/****__maven-4.0.0.xsd<http://maven.apache.org/xsd/**__maven-4.0.0.xsd>
>> <http://maven.apache.org/xsd/****maven-4.0.0.xsd<http://maven.apache.org/xsd/**maven-4.0.0.xsd>
>> ><http://**maven. <http://maven.>__apache.org/xsd/maven-**4.0.0.xsd<http://apache.org/xsd/maven-4.0.0.xsd>
>> <http://maven.apache.org/xsd/**maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
>> >__>
>> ">
>> <modelVersion>4.0.0</**__**modelVersion>
>> <artifactId>store-locator-rs-***
>> __*artifacts</artifactId>
>> <version>0.0.1-SNAPSHOT</**__**version>
>> <parent>
>> <artifactId>api-maven-base</****__artifactId>
>> <groupId>com.acme.ecommerce</***__*groupId>
>>
>> <version>0.1.4</version>
>> </parent>
>> <dependencies>
>> <dependency>
>> <groupId>com.acme.ecommerce</***__*groupId>
>> <artifactId>schemas</**__**artifactId>
>> <version>0.0.1-SNAPSHOT</**__**version>
>> </dependency>
>> <dependency>
>> <groupId>org.apache.cxf</**__**groupId>
>> <artifactId>cxf-bundle-jaxrs</**__**artifactId>
>>
>> </dependency>
>> </dependencies>
>> <build>
>> <plugins>
>> <plugin>
>> <groupId>org.apache.cxf</**__**groupId>
>> <artifactId>cxf-wadl2java-**__**plugin</artifactId>
>>
>>
>> <version>2.5.2</version>
>> <executions>
>> <execution>
>> <id>generate-sources</id>
>> <phase>generate-sources</**__**phase>
>> <configuration>
>> <sourceRoot>${basedir}/target/**
>> __**generated/src/main/java</****__sourceRoot>
>> <wadlOptions>
>> <wadlOption>
>> <wadl>classpath:/services/**__**
>> store-locator/store-locator-**
>>
>> wadl-v1.xml</wadl>
>> <extraargs>
>> <extraarg>-verbose</extraarg>
>> </extraargs>
>> <packagename>com.acme.**__**
>> ecommerce.store.locator.**__**service.rs.version1</**
>> packagename>
>> <schemaPackagenames>
>>
>> <schemaPackagename>urn:com:**_**
>> _acme:ecommerce:wadl:store-**
>> locator:v1=com.acme.ecommerce.**
>> __**store.locator.service.rs.****
>> version1</schemaPackagename>
>>
>> <schemaPackagename>urn:com:**_**
>> _acme:ecommerce:schema:store-****
>> locator:v1=com.acme.ecommerce.**
>> __**store.locator.service.rs.****
>>
>> version1</schemaPackagename>
>> </schemaPackagenames>
>> </wadlOption>
>> </wadlOptions>
>> </configuration>
>> <goals>
>> <goal>wadl2java</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>> </plugins>
>> <pluginManagement>
>> <plugins>
>> <!--This plugin's configuration is used to store
>> Eclipse m2e settings
>> only.
>> It has no influence on the Maven build itself.-->
>> <plugin>
>> <groupId>org.eclipse.m2e</**__**groupId>
>> <artifactId>lifecycle-mapping<**__**/artifactId>
>>
>>
>> <version>1.0.0</version>
>> <configuration>
>> <lifecycleMappingMetadata>
>> <pluginExecutions>
>> <pluginExecution>
>> <pluginExecutionFilter>
>> <groupId>
>> org.apache.cxf
>> </groupId>
>> <artifactId>
>> cxf-wadl2java-plugin
>> </artifactId>
>> <versionRange>
>> [2.5.1,)
>> </versionRange>
>> <goals>
>> <goal>wadl2java</goal>
>> </goals>
>> </pluginExecutionFilter>
>> <action>
>> <ignore></ignore>
>> </action>
>> </pluginExecution>
>> </pluginExecutions>
>> </lifecycleMappingMetadata>
>> </configuration>
>> </plugin>
>> </plugins>
>> </pluginManagement>
>> </build>
>> </project>
>>
>> ----
>> <?xml version="1.0" encoding="UTF-8"
>> standalone="yes"?>
>>
>> <wadl:application
>> xmlns="urn:com:acme:ecommerce:**
>> __**wadl:store-locator:v1"
>> targetNamespace="urn:com:acme:**
>> __**ecommerce:wadl:store-__**locator:**v1"
>> xmlns:xsd="http://www.w3.org/***__*2001/XMLSchema<http://www.w3.org/*__*2001/XMLSchema>
>> <http://www.w3.org/**2001/**XMLSchema<http://www.w3.org/**2001/XMLSchema>
>> ><http://www.w3.__**org/2001/XMLSchema
>> <http://www.w3.org/2001/**XMLSchema<http://www.w3.org/2001/XMLSchema>
>> >>
>> "
>> xmlns:store-locator-v1="urn:****
>> __com:acme:ecommerce:schema:**
>> store-locator:v1"
>>
>> xmlns:wadl="http://wadl.dev.****__java.net/2009/02
>> <http://java.net/2009/02><http**://wadl.<http://wadl.>
>> __dev.java.net/2009/02
>> <http://wadl.dev.java.net/**2009/02<http://wadl.dev.java.net/2009/02>
>> >>
>>
>> ">
>> <wadl:doc xml:lang="en" title="Version 1.0"/>
>> <wadl:grammars>
>> <wadl:include href="store-locator-v1.xsd"/>
>> <wadl:include href="../../common/faults-v1_***
>> __*0.xsd"/>
>> <xsd:schema
>>
>> xmlns="urn:com:acme:ecommerce:**
>> __**wadl:store-locator:v1"
>> targetNamespace="urn:com:acme:**
>> __**ecommerce:wadl:store-__**locator:**v1">
>> <xsd:simpleType name="**__**
>> StoreLocatorQueryEnumType">
>>
>> <xsd:restriction base="xsd:normalizedString">
>> <xsd:enumeration value="find_by_geocode"/>
>> <xsd:enumeration value="find_by_address"/>
>> </xsd:restriction>
>> </xsd:simpleType>
>> </xsd:schema>
>> </wadl:grammars>
>>
>> <wadl:resources
>> base="http://store-locator.**a**__cme.com<http://a__cme.com>
>> <http://acme.com><http://**store-locator.<http://store-locator.>
>> __acme.com
>> <http://store-locator.acme.com**>>
>>
>> ">
>> <wadl:resource path="/store" id="StoreLocator">
>> <wadl:method href="#findByQuery"/>
>> </wadl:resource>
>> </wadl:resources>
>>
>> <wadl:method name="GET" id="findByQuery">
>> <wadl:request>
>> <wadl:doc xml:lang="en" title="Find by query
>> parameters. Valid queries are
>> 'find by geocode' and 'find by geographic address'"/>
>> <!-- query name -->
>> <wadl:param name="q" style="query"
>> type="**__**StoreLocatorQueryEnumType"
>>
>>
>> required="true" />
>> <!-- geocode -->
>> <wadl:param name="latitude" style="query"
>> type="xsd:double"
>> required="false" />
>> <wadl:param name="longitude" style="query"
>> type="xsd:double"
>> required="false" />
>> <!-- geographic address -->
>> <wadl:param name="address_line_1" style="query"
>> required="false" />
>> <wadl:param name="address_line_2" style="query"
>> required="false" />
>> <wadl:param name="address_line_3" style="query"
>> required="false" />
>> <wadl:param name="city" style="query"
>> required="false" />
>> <wadl:param name="region" style="query"
>> required="false" />
>> <wadl:param name="postal_code" style="query"
>> required="false" />
>> <wadl:param name="country" style="query"
>> required="false" />
>> </wadl:request>
>> <wadl:response>
>> <wadl:representation status="200"
>> mediaType="application/vnd.**_**
>> _com.acme.ecommerce.store-**
>> locator-result+json;version=1.**__**0"
>> element="store-locator-v1:**__**
>> StoreLocatorResultList"/>
>>
>>
>> <!--
>> <wadl:fault id="BadOrMissingValue" status="400"
>> mediaType="application/vnd.**_**
>> _com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**__**ValidationFault"/>
>>
>>
>> <wadl:fault id="NotAuthorized" status="403"
>> mediaType="application/vnd.**_**
>> _com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**__**NotAuthorizedFault"/>
>>
>>
>> <wadl:fault id="NotFound" status="404"
>> mediaType="application/vnd.**_**
>> _com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**__**NoEntityFoundFault"/>
>>
>>
>> <wadl:fault id="CanNotPerform" status="500"
>> mediaType="application/vnd.**_**
>> _com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**__**CanNotPerformFault"/>
>>
>>
>> -->
>> </wadl:response>
>> </wadl:method>
>> </wadl:application>
>> ----
>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>>
>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>
Re: wadl2java classpath issues
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Mike
Thanks again for the test and the tip, I was not sure how URL would make
it work better till Dan showed me how :-)
As it happens, JAX-RS 2.0 implementations are expected to support
resolve() and relativize functions too, I will need the related CXF code
be stressed and improved a bit more before actually switching to using it,
The fix is on the trunk, will work on merging it the branches in the
next few days
Cheers, Sergey
On 09/04/13 19:25, Michael Lambert wrote:
> Sergey,
>
> It didnt seem to work for us. As we are traversing a jar file our
> problem is slightly different than the one you are testing. I am
> attaching a sample project that demonstrates the problem and
> a potential patch to fix it; using java.net.URL rather than java.net.URI
> fixes the issue for us.
>
> Thanks,
>
> Mike
>
>
> On Thu, Apr 4, 2013 at 10:10 AM, Michael Lambert
> <michael@michaellambert.com <ma...@michaellambert.com>> wrote:
>
> I will do it Monday Sergey. I really appreciate the effort!
>
>
> On Thu, Apr 4, 2013 at 9:51 AM, Sergey Beryozkin
> <sberyozkin@gmail.com <ma...@gmail.com>> wrote:
>
> Hi,
>
> On 03/04/13 00:13, Michael Lambert wrote:
>
> Its an essential feature for me unfortunately as I want to
> centrally manage
> all of my schemas so they can be easily discovered and
> reused. I need to be
> able to navigate around a jar to choose the ones I want to
> import. If I can
> be any help please let me know.
>
> I think I've fixed it, see [1]
>
> Can you please help on your end with trying 2.5.x SNAPSHOTS (as
> far as I recall you work with 2.5.x) in a day or two, or may be
> rebuilding 2.5.x locally and trying that ?
>
> Cheers, Sergey
>
> [1] https://issues.apache.org/__jira/browse/CXF-4946
> <https://issues.apache.org/jira/browse/CXF-4946>
>
>
> On Tue, Apr 2, 2013 at 3:38 PM, Sergey
> Beryozkin<sberyozkin@gmail.com
> <ma...@gmail.com>__>wrote:
>
> Hi
>
> It is the problem with resolving ".." against the base
> URI, you can have
> the schemas located in the same folder as the actual
> WADL or in child
> folders, example, schemas/myschema.xsd.
> I'll have a look later on and see if ".." can be
> supported too
>
> Cheers, Sergey
>
>
> On 02/04/13 16:45, Michael Lambert wrote:
>
> The wadl2java tool does not seem to be able to
> handle relative paths to
> schemas. When I try to execute: mvn generate-sources
> -X on a pom with the
> following snippet:
>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <!-- problem line.. note the elipses -->
> <wadl:include href="../../common/faults-v1_*__*0.xsd"/>
>
> ...
> </wadl:grammers>
>
> This exception stack is thrown:
>
> [ERROR] Failed to execute goal
> org.apache.cxf:cxf-wadl2java-*__*plugin:2.5.2:wadl2java
> (generate-sources)
>
> on
> project store-locator-rs-artifacts:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read -> [Help 1]
> org.apache.maven.lifecycle.**__LifecycleExecutionException:
> Failed to
> execute
> goal
> org.apache.cxf:cxf-wadl2java-*__*plugin:2.5.2:wadl2java
>
> (generate-sources)
> on project store-locator-rs-artifacts:
> java.lang.RuntimeException:
> Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> 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:__**57)
> at
> sun.reflect.**__DelegatingMethodAccessorImpl.*__*invoke(**
> DelegatingMethodAccessorImpl.*__*java:43)
> at java.lang.reflect.Method.**__invoke(Method.java:601)
> 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:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> at
> org.apache.cxf.maven_plugin.**__wadlto.**__AbstractCodeGeneratorMojo.**
> callCodeGenerator(**__AbstractCodeGeneratorMojo.**__java:458)
> at
> org.apache.cxf.maven_plugin.**__wadlto.WADL2JavaMojo.execute(*__*
> WADL2JavaMojo.java:101)
> 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:
> org.apache.cxf.tools.common.**__ToolException:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.execute(*__*
> JAXRSContainer.java:84)
> at
> org.apache.cxf.tools.common.**__toolspec.ToolRunner.runTool(**
> ToolRunner.java:103)
> at
> org.apache.cxf.tools.wadlto.**__WADLToJava.run(WADLToJava.**__java:65)
> at
> org.apache.cxf.tools.wadlto.**__WADLToJava.run(WADLToJava.**__java:57)
> at
> org.apache.cxf.maven_plugin.**__wadlto.**__AbstractCodeGeneratorMojo.**
> callCodeGenerator(**__AbstractCodeGeneratorMojo.**__java:455)
>
> ... 22 more
> Caused by: java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/**__repository/com/dominos/**
> ecommerce/schemas/0.0.1-**__SNAPSHOT/schemas-0.0.1-**
> SNAPSHOT.jar!/services/store-*__*locator/../../common/faults-*__*v1_0.xsd
>
> can not be read
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**
> readIncludedDocument(**__SourceGenerator.java:1174)
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**__getSchemaElements(**
> SourceGenerator.java:1130)
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**
> generateSchemaCodeAndInfo(**__SourceGenerator.java:228)
> at
> org.apache.cxf.jaxrs.ext.**__codegen.SourceGenerator.**__generateSource(**
> SourceGenerator.java:220)
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.**
> processWadl(JAXRSContainer.**__java:153)
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.execute(*__*
> JAXRSContainer.java:67)
> at
> org.apache.cxf.tools.wadlto.**__jaxrs.JAXRSContainer.execute(*__*
>
> JAXRSContainer.java:76)
>
> If I place the problemed schema in the same
> directory as the wadl
> everything behaves:
>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <wadl:include href="faults-v1_0.xsd"/>
> ...
> </wadl:grammers>
>
> I am inlining the pom and wadl in case the list has
> problems with
> attachments. I hope that is okay. Am I doing
> something wrong?
>
> Thank you in Advance.
>
> ----
> <project
> xmlns="http://maven.apache.**__org/POM/4.0.0<http://maven.__apache.org/POM/4.0.0
> <http://maven.apache.org/POM/4.0.0>>"
> xmlns:xsi="
> http://www.w3.org/2001/**__XMLSchema-instance
> <http://www.w3.org/2001/**XMLSchema-instance><http://www.__w3.org/2001/XMLSchema-instance
> <http://www.w3.org/2001/XMLSchema-instance>__>"
> xsi:schemaLocation="
> http://maven.apache.org/POM/4.__**0.0
> <http://maven.apache.org/POM/4.**0.0><http://maven.apache.org/__POM/4.0.0
> <http://maven.apache.org/POM/4.0.0>>
> http://maven.apache.org/xsd/**__maven-4.0.0.xsd
> <http://maven.apache.org/xsd/**maven-4.0.0.xsd><http://maven.__apache.org/xsd/maven-4.0.0.xsd
> <http://maven.apache.org/xsd/maven-4.0.0.xsd>__>
> ">
> <modelVersion>4.0.0</**__modelVersion>
> <artifactId>store-locator-rs-*__*artifacts</artifactId>
> <version>0.0.1-SNAPSHOT</**__version>
> <parent>
> <artifactId>api-maven-base</**__artifactId>
> <groupId>com.acme.ecommerce</*__*groupId>
>
> <version>0.1.4</version>
> </parent>
> <dependencies>
> <dependency>
> <groupId>com.acme.ecommerce</*__*groupId>
> <artifactId>schemas</**__artifactId>
> <version>0.0.1-SNAPSHOT</**__version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</**__groupId>
> <artifactId>cxf-bundle-jaxrs</__**artifactId>
>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.cxf</**__groupId>
> <artifactId>cxf-wadl2java-**__plugin</artifactId>
>
> <version>2.5.2</version>
> <executions>
> <execution>
> <id>generate-sources</id>
> <phase>generate-sources</**__phase>
> <configuration>
> <sourceRoot>${basedir}/target/__**generated/src/main/java</**__sourceRoot>
> <wadlOptions>
> <wadlOption>
> <wadl>classpath:/services/**__store-locator/store-locator-**
>
> wadl-v1.xml</wadl>
> <extraargs>
> <extraarg>-verbose</extraarg>
> </extraargs>
> <packagename>com.acme.**__ecommerce.store.locator.**__service.rs.version1</**
> packagename>
> <schemaPackagenames>
> <schemaPackagename>urn:com:**__acme:ecommerce:wadl:store-**
> locator:v1=com.acme.ecommerce.__**store.locator.service.rs.**
> version1</schemaPackagename>
> <schemaPackagename>urn:com:**__acme:ecommerce:schema:store-**
> locator:v1=com.acme.ecommerce.__**store.locator.service.rs.**
>
> version1</schemaPackagename>
> </schemaPackagenames>
> </wadlOption>
> </wadlOptions>
> </configuration>
> <goals>
> <goal>wadl2java</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> <pluginManagement>
> <plugins>
> <!--This plugin's configuration is used to store
> Eclipse m2e settings
> only.
> It has no influence on the Maven build itself.-->
> <plugin>
> <groupId>org.eclipse.m2e</**__groupId>
> <artifactId>lifecycle-mapping<__**/artifactId>
>
> <version>1.0.0</version>
> <configuration>
> <lifecycleMappingMetadata>
> <pluginExecutions>
> <pluginExecution>
> <pluginExecutionFilter>
> <groupId>
> org.apache.cxf
> </groupId>
> <artifactId>
> cxf-wadl2java-plugin
> </artifactId>
> <versionRange>
> [2.5.1,)
> </versionRange>
> <goals>
> <goal>wadl2java</goal>
> </goals>
> </pluginExecutionFilter>
> <action>
> <ignore></ignore>
> </action>
> </pluginExecution>
> </pluginExecutions>
> </lifecycleMappingMetadata>
> </configuration>
> </plugin>
> </plugins>
> </pluginManagement>
> </build>
> </project>
>
> ----
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>
> <wadl:application
> xmlns="urn:com:acme:ecommerce:__**wadl:store-locator:v1"
> targetNamespace="urn:com:acme:__**ecommerce:wadl:store-__locator:**v1"
> xmlns:xsd="http://www.w3.org/*__*2001/XMLSchema
> <http://www.w3.org/**2001/XMLSchema><http://www.w3.__org/2001/XMLSchema
> <http://www.w3.org/2001/XMLSchema>>
> "
> xmlns:store-locator-v1="urn:**__com:acme:ecommerce:schema:**
> store-locator:v1"
> xmlns:wadl="http://wadl.dev.**__java.net/2009/02
> <http://java.net/2009/02><http://wadl.__dev.java.net/2009/02
> <http://wadl.dev.java.net/2009/02>>
>
> ">
> <wadl:doc xml:lang="en" title="Version 1.0"/>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <wadl:include href="../../common/faults-v1_*__*0.xsd"/>
> <xsd:schema
> xmlns="urn:com:acme:ecommerce:__**wadl:store-locator:v1"
> targetNamespace="urn:com:acme:__**ecommerce:wadl:store-__locator:**v1">
> <xsd:simpleType name="**__StoreLocatorQueryEnumType">
>
> <xsd:restriction base="xsd:normalizedString">
> <xsd:enumeration value="find_by_geocode"/>
> <xsd:enumeration value="find_by_address"/>
> </xsd:restriction>
> </xsd:simpleType>
> </xsd:schema>
> </wadl:grammars>
>
> <wadl:resources
> base="http://store-locator.**a__cme.com
> <http://acme.com><http://store-locator.__acme.com
> <http://store-locator.acme.com>>
>
> ">
> <wadl:resource path="/store" id="StoreLocator">
> <wadl:method href="#findByQuery"/>
> </wadl:resource>
> </wadl:resources>
>
> <wadl:method name="GET" id="findByQuery">
> <wadl:request>
> <wadl:doc xml:lang="en" title="Find by query
> parameters. Valid queries are
> 'find by geocode' and 'find by geographic address'"/>
> <!-- query name -->
> <wadl:param name="q" style="query"
> type="**__StoreLocatorQueryEnumType"
>
> required="true" />
> <!-- geocode -->
> <wadl:param name="latitude" style="query"
> type="xsd:double"
> required="false" />
> <wadl:param name="longitude" style="query"
> type="xsd:double"
> required="false" />
> <!-- geographic address -->
> <wadl:param name="address_line_1" style="query"
> required="false" />
> <wadl:param name="address_line_2" style="query"
> required="false" />
> <wadl:param name="address_line_3" style="query"
> required="false" />
> <wadl:param name="city" style="query"
> required="false" />
> <wadl:param name="region" style="query"
> required="false" />
> <wadl:param name="postal_code" style="query"
> required="false" />
> <wadl:param name="country" style="query"
> required="false" />
> </wadl:request>
> <wadl:response>
> <wadl:representation status="200"
> mediaType="application/vnd.**__com.acme.ecommerce.store-**
> locator-result+json;version=1.__**0"
> element="store-locator-v1:**__StoreLocatorResultList"/>
>
> <!--
> <wadl:fault id="BadOrMissingValue" status="400"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__ValidationFault"/>
>
> <wadl:fault id="NotAuthorized" status="403"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__NotAuthorizedFault"/>
>
> <wadl:fault id="NotFound" status="404"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__NoEntityFoundFault"/>
>
> <wadl:fault id="CanNotPerform" status="500"
> mediaType="application/vnd.**__com.acme.ecommerce.common+**
> json;version=1.0"
> element="faults-v1_0:**__CanNotPerformFault"/>
>
> -->
> </wadl:response>
> </wadl:method>
> </wadl:application>
> ----
>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>
>
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
Re: wadl2java classpath issues
Posted by Michael Lambert <mi...@michaellambert.com>.
Sergey,
It didnt seem to work for us. As we are traversing a jar file our problem
is slightly different than the one you are testing. I am attaching a sample
project that demonstrates the problem and a potential patch to fix it;
using java.net.URL rather than java.net.URI fixes the issue for us.
Thanks,
Mike
On Thu, Apr 4, 2013 at 10:10 AM, Michael Lambert <michael@michaellambert.com
> wrote:
> I will do it Monday Sergey. I really appreciate the effort!
>
>
> On Thu, Apr 4, 2013 at 9:51 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi,
>>
>> On 03/04/13 00:13, Michael Lambert wrote:
>>
>>> Its an essential feature for me unfortunately as I want to centrally
>>> manage
>>> all of my schemas so they can be easily discovered and reused. I need to
>>> be
>>> able to navigate around a jar to choose the ones I want to import. If I
>>> can
>>> be any help please let me know.
>>>
>>> I think I've fixed it, see [1]
>>
>> Can you please help on your end with trying 2.5.x SNAPSHOTS (as far as I
>> recall you work with 2.5.x) in a day or two, or may be rebuilding 2.5.x
>> locally and trying that ?
>>
>> Cheers, Sergey
>>
>> [1] https://issues.apache.org/**jira/browse/CXF-4946<https://issues.apache.org/jira/browse/CXF-4946>
>>
>>>
>>> On Tue, Apr 2, 2013 at 3:38 PM, Sergey Beryozkin<sberyozkin@gmail.com**
>>> >wrote:
>>>
>>> Hi
>>>>
>>>> It is the problem with resolving ".." against the base URI, you can have
>>>> the schemas located in the same folder as the actual WADL or in child
>>>> folders, example, schemas/myschema.xsd.
>>>> I'll have a look later on and see if ".." can be supported too
>>>>
>>>> Cheers, Sergey
>>>>
>>>>
>>>> On 02/04/13 16:45, Michael Lambert wrote:
>>>>
>>>> The wadl2java tool does not seem to be able to handle relative paths to
>>>>> schemas. When I try to execute: mvn generate-sources -X on a pom with
>>>>> the
>>>>> following snippet:
>>>>>
>>>>> <wadl:grammars>
>>>>> <wadl:include href="store-locator-v1.xsd"/>
>>>>> <!-- problem line.. note the elipses -->
>>>>> <wadl:include href="../../common/faults-v1_****0.xsd"/>
>>>>>
>>>>> ...
>>>>> </wadl:grammers>
>>>>>
>>>>> This exception stack is thrown:
>>>>>
>>>>> [ERROR] Failed to execute goal
>>>>> org.apache.cxf:cxf-wadl2java-****plugin:2.5.2:wadl2java
>>>>> (generate-sources)
>>>>>
>>>>> on
>>>>> project store-locator-rs-artifacts: java.lang.RuntimeException:
>>>>> Resource
>>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>>> *v1_0.xsd
>>>>>
>>>>> can not be read -> [Help 1]
>>>>> org.apache.maven.lifecycle.****LifecycleExecutionException: Failed to
>>>>> execute
>>>>> goal org.apache.cxf:cxf-wadl2java-****plugin:2.5.2:wadl2java
>>>>>
>>>>> (generate-sources)
>>>>> on project store-locator-rs-artifacts: java.lang.RuntimeException:
>>>>> Resource
>>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>>> *v1_0.xsd
>>>>>
>>>>> can not be read
>>>>> 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:****57)
>>>>> at
>>>>> sun.reflect.****DelegatingMethodAccessorImpl.****invoke(**
>>>>> DelegatingMethodAccessorImpl.****java:43)
>>>>> at java.lang.reflect.Method.****invoke(Method.java:601)
>>>>> 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:
>>>>> java.lang.RuntimeException: Resource
>>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>>> *v1_0.xsd
>>>>>
>>>>> can not be read
>>>>> at
>>>>> org.apache.cxf.maven_plugin.****wadlto.****
>>>>> AbstractCodeGeneratorMojo.**
>>>>> callCodeGenerator(****AbstractCodeGeneratorMojo.****java:458)
>>>>> at
>>>>> org.apache.cxf.maven_plugin.****wadlto.WADL2JavaMojo.execute(****
>>>>> WADL2JavaMojo.java:101)
>>>>> 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: org.apache.cxf.tools.common.****ToolException:
>>>>> java.lang.RuntimeException: Resource
>>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>>> *v1_0.xsd
>>>>>
>>>>> can not be read
>>>>> at
>>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.execute(****
>>>>> JAXRSContainer.java:84)
>>>>> at
>>>>> org.apache.cxf.tools.common.****toolspec.ToolRunner.runTool(**
>>>>> ToolRunner.java:103)
>>>>> at org.apache.cxf.tools.wadlto.****WADLToJava.run(WADLToJava.****
>>>>> java:65)
>>>>> at org.apache.cxf.tools.wadlto.****WADLToJava.run(WADLToJava.****
>>>>> java:57)
>>>>> at
>>>>> org.apache.cxf.maven_plugin.****wadlto.****
>>>>> AbstractCodeGeneratorMojo.**
>>>>> callCodeGenerator(****AbstractCodeGeneratorMojo.****java:455)
>>>>>
>>>>> ... 22 more
>>>>> Caused by: java.lang.RuntimeException: Resource
>>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>>> *v1_0.xsd
>>>>>
>>>>> can not be read
>>>>> at
>>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.**
>>>>> readIncludedDocument(****SourceGenerator.java:1174)
>>>>> at
>>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.****
>>>>> getSchemaElements(**
>>>>> SourceGenerator.java:1130)
>>>>> at
>>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.**
>>>>> generateSchemaCodeAndInfo(****SourceGenerator.java:228)
>>>>> at
>>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.****
>>>>> generateSource(**
>>>>> SourceGenerator.java:220)
>>>>> at
>>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.**
>>>>> processWadl(JAXRSContainer.****java:153)
>>>>> at
>>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.execute(****
>>>>> JAXRSContainer.java:67)
>>>>> at
>>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.execute(****
>>>>>
>>>>> JAXRSContainer.java:76)
>>>>>
>>>>> If I place the problemed schema in the same directory as the wadl
>>>>> everything behaves:
>>>>>
>>>>> <wadl:grammars>
>>>>> <wadl:include href="store-locator-v1.xsd"/>
>>>>> <wadl:include href="faults-v1_0.xsd"/>
>>>>> ...
>>>>> </wadl:grammers>
>>>>>
>>>>> I am inlining the pom and wadl in case the list has problems with
>>>>> attachments. I hope that is okay. Am I doing something wrong?
>>>>>
>>>>> Thank you in Advance.
>>>>>
>>>>> ----
>>>>> <project xmlns="http://maven.apache.****org/POM/4.0.0<http://maven.**
>>>>> apache.org/POM/4.0.0 <http://maven.apache.org/POM/4.0.0>>"
>>>>> xmlns:xsi="
>>>>> http://www.w3.org/2001/****XMLSchema-instance<http://www.w3.org/2001/**XMLSchema-instance>
>>>>> <http://www.**w3.org/2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>>>>> **>"
>>>>> xsi:schemaLocation="
>>>>> http://maven.apache.org/POM/4.****0.0<http://maven.apache.org/POM/4.**0.0>
>>>>> <http://maven.apache.org/**POM/4.0.0<http://maven.apache.org/POM/4.0.0>
>>>>> >
>>>>> http://maven.apache.org/xsd/****maven-4.0.0.xsd<http://maven.apache.org/xsd/**maven-4.0.0.xsd>
>>>>> <http://maven.**apache.org/xsd/maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
>>>>> **>
>>>>> ">
>>>>> <modelVersion>4.0.0</****modelVersion>
>>>>> <artifactId>store-locator-rs-****artifacts</artifactId>
>>>>> <version>0.0.1-SNAPSHOT</****version>
>>>>> <parent>
>>>>> <artifactId>api-maven-base</****artifactId>
>>>>> <groupId>com.acme.ecommerce</****groupId>
>>>>>
>>>>> <version>0.1.4</version>
>>>>> </parent>
>>>>> <dependencies>
>>>>> <dependency>
>>>>> <groupId>com.acme.ecommerce</****groupId>
>>>>> <artifactId>schemas</****artifactId>
>>>>> <version>0.0.1-SNAPSHOT</****version>
>>>>> </dependency>
>>>>> <dependency>
>>>>> <groupId>org.apache.cxf</****groupId>
>>>>> <artifactId>cxf-bundle-jaxrs</****artifactId>
>>>>>
>>>>> </dependency>
>>>>> </dependencies>
>>>>> <build>
>>>>> <plugins>
>>>>> <plugin>
>>>>> <groupId>org.apache.cxf</****groupId>
>>>>> <artifactId>cxf-wadl2java-****plugin</artifactId>
>>>>>
>>>>> <version>2.5.2</version>
>>>>> <executions>
>>>>> <execution>
>>>>> <id>generate-sources</id>
>>>>> <phase>generate-sources</****phase>
>>>>> <configuration>
>>>>> <sourceRoot>${basedir}/target/****generated/src/main/java</****
>>>>> sourceRoot>
>>>>> <wadlOptions>
>>>>> <wadlOption>
>>>>> <wadl>classpath:/services/****store-locator/store-locator-**
>>>>>
>>>>> wadl-v1.xml</wadl>
>>>>> <extraargs>
>>>>> <extraarg>-verbose</extraarg>
>>>>> </extraargs>
>>>>> <packagename>com.acme.****ecommerce.store.locator.****
>>>>> service.rs.version1</**
>>>>> packagename>
>>>>> <schemaPackagenames>
>>>>> <schemaPackagename>urn:com:****acme:ecommerce:wadl:store-**
>>>>> locator:v1=com.acme.ecommerce.****store.locator.service.rs.**
>>>>> version1</schemaPackagename>
>>>>> <schemaPackagename>urn:com:****acme:ecommerce:schema:store-**
>>>>> locator:v1=com.acme.ecommerce.****store.locator.service.rs.**
>>>>>
>>>>> version1</schemaPackagename>
>>>>> </schemaPackagenames>
>>>>> </wadlOption>
>>>>> </wadlOptions>
>>>>> </configuration>
>>>>> <goals>
>>>>> <goal>wadl2java</goal>
>>>>> </goals>
>>>>> </execution>
>>>>> </executions>
>>>>> </plugin>
>>>>> </plugins>
>>>>> <pluginManagement>
>>>>> <plugins>
>>>>> <!--This plugin's configuration is used to store Eclipse m2e settings
>>>>> only.
>>>>> It has no influence on the Maven build itself.-->
>>>>> <plugin>
>>>>> <groupId>org.eclipse.m2e</****groupId>
>>>>> <artifactId>lifecycle-mapping<****/artifactId>
>>>>>
>>>>> <version>1.0.0</version>
>>>>> <configuration>
>>>>> <lifecycleMappingMetadata>
>>>>> <pluginExecutions>
>>>>> <pluginExecution>
>>>>> <pluginExecutionFilter>
>>>>> <groupId>
>>>>> org.apache.cxf
>>>>> </groupId>
>>>>> <artifactId>
>>>>> cxf-wadl2java-plugin
>>>>> </artifactId>
>>>>> <versionRange>
>>>>> [2.5.1,)
>>>>> </versionRange>
>>>>> <goals>
>>>>> <goal>wadl2java</goal>
>>>>> </goals>
>>>>> </pluginExecutionFilter>
>>>>> <action>
>>>>> <ignore></ignore>
>>>>> </action>
>>>>> </pluginExecution>
>>>>> </pluginExecutions>
>>>>> </lifecycleMappingMetadata>
>>>>> </configuration>
>>>>> </plugin>
>>>>> </plugins>
>>>>> </pluginManagement>
>>>>> </build>
>>>>> </project>
>>>>>
>>>>> ----
>>>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>>>>
>>>>> <wadl:application
>>>>> xmlns="urn:com:acme:ecommerce:****wadl:store-locator:v1"
>>>>> targetNamespace="urn:com:acme:****ecommerce:wadl:store-**locator:**v1"
>>>>> xmlns:xsd="http://www.w3.org/****2001/XMLSchema<http://www.w3.org/**2001/XMLSchema>
>>>>> <http://www.w3.**org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema>
>>>>> >
>>>>> "
>>>>> xmlns:store-locator-v1="urn:****com:acme:ecommerce:schema:**
>>>>> store-locator:v1"
>>>>> xmlns:wadl="http://wadl.dev.****java.net/2009/02<http://java.net/2009/02>
>>>>> <http://wadl.**dev.java.net/2009/02 <http://wadl.dev.java.net/2009/02>
>>>>> >
>>>>>
>>>>> ">
>>>>> <wadl:doc xml:lang="en" title="Version 1.0"/>
>>>>> <wadl:grammars>
>>>>> <wadl:include href="store-locator-v1.xsd"/>
>>>>> <wadl:include href="../../common/faults-v1_****0.xsd"/>
>>>>> <xsd:schema
>>>>> xmlns="urn:com:acme:ecommerce:****wadl:store-locator:v1"
>>>>> targetNamespace="urn:com:acme:****ecommerce:wadl:store-**
>>>>> locator:**v1">
>>>>> <xsd:simpleType name="****StoreLocatorQueryEnumType">
>>>>>
>>>>> <xsd:restriction base="xsd:normalizedString">
>>>>> <xsd:enumeration value="find_by_geocode"/>
>>>>> <xsd:enumeration value="find_by_address"/>
>>>>> </xsd:restriction>
>>>>> </xsd:simpleType>
>>>>> </xsd:schema>
>>>>> </wadl:grammars>
>>>>>
>>>>> <wadl:resources base="http://store-locator.**a**cme.com<http://acme.com>
>>>>> <http://store-locator.**acme.com <http://store-locator.acme.com>>
>>>>>
>>>>> ">
>>>>> <wadl:resource path="/store" id="StoreLocator">
>>>>> <wadl:method href="#findByQuery"/>
>>>>> </wadl:resource>
>>>>> </wadl:resources>
>>>>>
>>>>> <wadl:method name="GET" id="findByQuery">
>>>>> <wadl:request>
>>>>> <wadl:doc xml:lang="en" title="Find by query parameters. Valid queries
>>>>> are
>>>>> 'find by geocode' and 'find by geographic address'"/>
>>>>> <!-- query name -->
>>>>> <wadl:param name="q" style="query" type="****
>>>>> StoreLocatorQueryEnumType"
>>>>>
>>>>> required="true" />
>>>>> <!-- geocode -->
>>>>> <wadl:param name="latitude" style="query" type="xsd:double"
>>>>> required="false" />
>>>>> <wadl:param name="longitude" style="query" type="xsd:double"
>>>>> required="false" />
>>>>> <!-- geographic address -->
>>>>> <wadl:param name="address_line_1" style="query" required="false" />
>>>>> <wadl:param name="address_line_2" style="query" required="false" />
>>>>> <wadl:param name="address_line_3" style="query" required="false" />
>>>>> <wadl:param name="city" style="query" required="false" />
>>>>> <wadl:param name="region" style="query" required="false" />
>>>>> <wadl:param name="postal_code" style="query" required="false" />
>>>>> <wadl:param name="country" style="query" required="false" />
>>>>> </wadl:request>
>>>>> <wadl:response>
>>>>> <wadl:representation status="200"
>>>>> mediaType="application/vnd.****com.acme.ecommerce.store-**
>>>>> locator-result+json;version=1.****0"
>>>>> element="store-locator-v1:****StoreLocatorResultList"/>
>>>>>
>>>>> <!--
>>>>> <wadl:fault id="BadOrMissingValue" status="400"
>>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>>> json;version=1.0"
>>>>> element="faults-v1_0:****ValidationFault"/>
>>>>>
>>>>> <wadl:fault id="NotAuthorized" status="403"
>>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>>> json;version=1.0"
>>>>> element="faults-v1_0:****NotAuthorizedFault"/>
>>>>>
>>>>> <wadl:fault id="NotFound" status="404"
>>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>>> json;version=1.0"
>>>>> element="faults-v1_0:****NoEntityFoundFault"/>
>>>>>
>>>>> <wadl:fault id="CanNotPerform" status="500"
>>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>>> json;version=1.0"
>>>>> element="faults-v1_0:****CanNotPerformFault"/>
>>>>>
>>>>> -->
>>>>> </wadl:response>
>>>>> </wadl:method>
>>>>> </wadl:application>
>>>>> ----
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Sergey Beryozkin
>>>>
>>>> Talend Community Coders
>>>> http://coders.talend.com/
>>>>
>>>> Blog: http://sberyozkin.blogspot.com
>>>>
>>>>
>>>
>
Re: wadl2java classpath issues
Posted by Michael Lambert <mi...@michaellambert.com>.
I will do it Monday Sergey. I really appreciate the effort!
On Thu, Apr 4, 2013 at 9:51 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
> Hi,
>
> On 03/04/13 00:13, Michael Lambert wrote:
>
>> Its an essential feature for me unfortunately as I want to centrally
>> manage
>> all of my schemas so they can be easily discovered and reused. I need to
>> be
>> able to navigate around a jar to choose the ones I want to import. If I
>> can
>> be any help please let me know.
>>
>> I think I've fixed it, see [1]
>
> Can you please help on your end with trying 2.5.x SNAPSHOTS (as far as I
> recall you work with 2.5.x) in a day or two, or may be rebuilding 2.5.x
> locally and trying that ?
>
> Cheers, Sergey
>
> [1] https://issues.apache.org/**jira/browse/CXF-4946<https://issues.apache.org/jira/browse/CXF-4946>
>
>>
>> On Tue, Apr 2, 2013 at 3:38 PM, Sergey Beryozkin<sberyozkin@gmail.com**
>> >wrote:
>>
>> Hi
>>>
>>> It is the problem with resolving ".." against the base URI, you can have
>>> the schemas located in the same folder as the actual WADL or in child
>>> folders, example, schemas/myschema.xsd.
>>> I'll have a look later on and see if ".." can be supported too
>>>
>>> Cheers, Sergey
>>>
>>>
>>> On 02/04/13 16:45, Michael Lambert wrote:
>>>
>>> The wadl2java tool does not seem to be able to handle relative paths to
>>>> schemas. When I try to execute: mvn generate-sources -X on a pom with
>>>> the
>>>> following snippet:
>>>>
>>>> <wadl:grammars>
>>>> <wadl:include href="store-locator-v1.xsd"/>
>>>> <!-- problem line.. note the elipses -->
>>>> <wadl:include href="../../common/faults-v1_****0.xsd"/>
>>>>
>>>> ...
>>>> </wadl:grammers>
>>>>
>>>> This exception stack is thrown:
>>>>
>>>> [ERROR] Failed to execute goal
>>>> org.apache.cxf:cxf-wadl2java-****plugin:2.5.2:wadl2java
>>>> (generate-sources)
>>>>
>>>> on
>>>> project store-locator-rs-artifacts: java.lang.RuntimeException: Resource
>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>> *v1_0.xsd
>>>>
>>>> can not be read -> [Help 1]
>>>> org.apache.maven.lifecycle.****LifecycleExecutionException: Failed to
>>>> execute
>>>> goal org.apache.cxf:cxf-wadl2java-****plugin:2.5.2:wadl2java
>>>>
>>>> (generate-sources)
>>>> on project store-locator-rs-artifacts: java.lang.RuntimeException:
>>>> Resource
>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>> *v1_0.xsd
>>>>
>>>> can not be read
>>>> 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:****57)
>>>> at
>>>> sun.reflect.****DelegatingMethodAccessorImpl.****invoke(**
>>>> DelegatingMethodAccessorImpl.****java:43)
>>>> at java.lang.reflect.Method.****invoke(Method.java:601)
>>>> 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:
>>>> java.lang.RuntimeException: Resource
>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>> *v1_0.xsd
>>>>
>>>> can not be read
>>>> at
>>>> org.apache.cxf.maven_plugin.****wadlto.****AbstractCodeGeneratorMojo.**
>>>> callCodeGenerator(****AbstractCodeGeneratorMojo.****java:458)
>>>> at
>>>> org.apache.cxf.maven_plugin.****wadlto.WADL2JavaMojo.execute(****
>>>> WADL2JavaMojo.java:101)
>>>> 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: org.apache.cxf.tools.common.****ToolException:
>>>> java.lang.RuntimeException: Resource
>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>> *v1_0.xsd
>>>>
>>>> can not be read
>>>> at
>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.execute(****
>>>> JAXRSContainer.java:84)
>>>> at
>>>> org.apache.cxf.tools.common.****toolspec.ToolRunner.runTool(**
>>>> ToolRunner.java:103)
>>>> at org.apache.cxf.tools.wadlto.****WADLToJava.run(WADLToJava.****
>>>> java:65)
>>>> at org.apache.cxf.tools.wadlto.****WADLToJava.run(WADLToJava.****
>>>> java:57)
>>>> at
>>>> org.apache.cxf.maven_plugin.****wadlto.****AbstractCodeGeneratorMojo.**
>>>> callCodeGenerator(****AbstractCodeGeneratorMojo.****java:455)
>>>>
>>>> ... 22 more
>>>> Caused by: java.lang.RuntimeException: Resource
>>>> jar:file:/home/lamberm/.m2/****repository/com/dominos/**
>>>> ecommerce/schemas/0.0.1-****SNAPSHOT/schemas-0.0.1-**
>>>> SNAPSHOT.jar!/services/store-****locator/../../common/faults-***
>>>> *v1_0.xsd
>>>>
>>>> can not be read
>>>> at
>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.**
>>>> readIncludedDocument(****SourceGenerator.java:1174)
>>>> at
>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.****
>>>> getSchemaElements(**
>>>> SourceGenerator.java:1130)
>>>> at
>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.**
>>>> generateSchemaCodeAndInfo(****SourceGenerator.java:228)
>>>> at
>>>> org.apache.cxf.jaxrs.ext.****codegen.SourceGenerator.****
>>>> generateSource(**
>>>> SourceGenerator.java:220)
>>>> at
>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.**
>>>> processWadl(JAXRSContainer.****java:153)
>>>> at
>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.execute(****
>>>> JAXRSContainer.java:67)
>>>> at
>>>> org.apache.cxf.tools.wadlto.****jaxrs.JAXRSContainer.execute(****
>>>>
>>>> JAXRSContainer.java:76)
>>>>
>>>> If I place the problemed schema in the same directory as the wadl
>>>> everything behaves:
>>>>
>>>> <wadl:grammars>
>>>> <wadl:include href="store-locator-v1.xsd"/>
>>>> <wadl:include href="faults-v1_0.xsd"/>
>>>> ...
>>>> </wadl:grammers>
>>>>
>>>> I am inlining the pom and wadl in case the list has problems with
>>>> attachments. I hope that is okay. Am I doing something wrong?
>>>>
>>>> Thank you in Advance.
>>>>
>>>> ----
>>>> <project xmlns="http://maven.apache.****org/POM/4.0.0<http://maven.**
>>>> apache.org/POM/4.0.0 <http://maven.apache.org/POM/4.0.0>>"
>>>> xmlns:xsi="
>>>> http://www.w3.org/2001/****XMLSchema-instance<http://www.w3.org/2001/**XMLSchema-instance>
>>>> <http://www.**w3.org/2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>>>> **>"
>>>> xsi:schemaLocation="
>>>> http://maven.apache.org/POM/4.****0.0<http://maven.apache.org/POM/4.**0.0>
>>>> <http://maven.apache.org/**POM/4.0.0<http://maven.apache.org/POM/4.0.0>
>>>> >
>>>> http://maven.apache.org/xsd/****maven-4.0.0.xsd<http://maven.apache.org/xsd/**maven-4.0.0.xsd>
>>>> <http://maven.**apache.org/xsd/maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
>>>> **>
>>>> ">
>>>> <modelVersion>4.0.0</****modelVersion>
>>>> <artifactId>store-locator-rs-****artifacts</artifactId>
>>>> <version>0.0.1-SNAPSHOT</****version>
>>>> <parent>
>>>> <artifactId>api-maven-base</****artifactId>
>>>> <groupId>com.acme.ecommerce</****groupId>
>>>>
>>>> <version>0.1.4</version>
>>>> </parent>
>>>> <dependencies>
>>>> <dependency>
>>>> <groupId>com.acme.ecommerce</****groupId>
>>>> <artifactId>schemas</****artifactId>
>>>> <version>0.0.1-SNAPSHOT</****version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.apache.cxf</****groupId>
>>>> <artifactId>cxf-bundle-jaxrs</****artifactId>
>>>>
>>>> </dependency>
>>>> </dependencies>
>>>> <build>
>>>> <plugins>
>>>> <plugin>
>>>> <groupId>org.apache.cxf</****groupId>
>>>> <artifactId>cxf-wadl2java-****plugin</artifactId>
>>>>
>>>> <version>2.5.2</version>
>>>> <executions>
>>>> <execution>
>>>> <id>generate-sources</id>
>>>> <phase>generate-sources</****phase>
>>>> <configuration>
>>>> <sourceRoot>${basedir}/target/****generated/src/main/java</****
>>>> sourceRoot>
>>>> <wadlOptions>
>>>> <wadlOption>
>>>> <wadl>classpath:/services/****store-locator/store-locator-**
>>>>
>>>> wadl-v1.xml</wadl>
>>>> <extraargs>
>>>> <extraarg>-verbose</extraarg>
>>>> </extraargs>
>>>> <packagename>com.acme.****ecommerce.store.locator.****
>>>> service.rs.version1</**
>>>> packagename>
>>>> <schemaPackagenames>
>>>> <schemaPackagename>urn:com:****acme:ecommerce:wadl:store-**
>>>> locator:v1=com.acme.ecommerce.****store.locator.service.rs.**
>>>> version1</schemaPackagename>
>>>> <schemaPackagename>urn:com:****acme:ecommerce:schema:store-**
>>>> locator:v1=com.acme.ecommerce.****store.locator.service.rs.**
>>>>
>>>> version1</schemaPackagename>
>>>> </schemaPackagenames>
>>>> </wadlOption>
>>>> </wadlOptions>
>>>> </configuration>
>>>> <goals>
>>>> <goal>wadl2java</goal>
>>>> </goals>
>>>> </execution>
>>>> </executions>
>>>> </plugin>
>>>> </plugins>
>>>> <pluginManagement>
>>>> <plugins>
>>>> <!--This plugin's configuration is used to store Eclipse m2e settings
>>>> only.
>>>> It has no influence on the Maven build itself.-->
>>>> <plugin>
>>>> <groupId>org.eclipse.m2e</****groupId>
>>>> <artifactId>lifecycle-mapping<****/artifactId>
>>>>
>>>> <version>1.0.0</version>
>>>> <configuration>
>>>> <lifecycleMappingMetadata>
>>>> <pluginExecutions>
>>>> <pluginExecution>
>>>> <pluginExecutionFilter>
>>>> <groupId>
>>>> org.apache.cxf
>>>> </groupId>
>>>> <artifactId>
>>>> cxf-wadl2java-plugin
>>>> </artifactId>
>>>> <versionRange>
>>>> [2.5.1,)
>>>> </versionRange>
>>>> <goals>
>>>> <goal>wadl2java</goal>
>>>> </goals>
>>>> </pluginExecutionFilter>
>>>> <action>
>>>> <ignore></ignore>
>>>> </action>
>>>> </pluginExecution>
>>>> </pluginExecutions>
>>>> </lifecycleMappingMetadata>
>>>> </configuration>
>>>> </plugin>
>>>> </plugins>
>>>> </pluginManagement>
>>>> </build>
>>>> </project>
>>>>
>>>> ----
>>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>>>
>>>> <wadl:application
>>>> xmlns="urn:com:acme:ecommerce:****wadl:store-locator:v1"
>>>> targetNamespace="urn:com:acme:****ecommerce:wadl:store-**locator:**v1"
>>>> xmlns:xsd="http://www.w3.org/****2001/XMLSchema<http://www.w3.org/**2001/XMLSchema>
>>>> <http://www.w3.**org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema>>
>>>> "
>>>> xmlns:store-locator-v1="urn:****com:acme:ecommerce:schema:**
>>>> store-locator:v1"
>>>> xmlns:wadl="http://wadl.dev.****java.net/2009/02<http://java.net/2009/02>
>>>> <http://wadl.**dev.java.net/2009/02 <http://wadl.dev.java.net/2009/02>>
>>>>
>>>> ">
>>>> <wadl:doc xml:lang="en" title="Version 1.0"/>
>>>> <wadl:grammars>
>>>> <wadl:include href="store-locator-v1.xsd"/>
>>>> <wadl:include href="../../common/faults-v1_****0.xsd"/>
>>>> <xsd:schema
>>>> xmlns="urn:com:acme:ecommerce:****wadl:store-locator:v1"
>>>> targetNamespace="urn:com:acme:****ecommerce:wadl:store-**locator:**v1">
>>>> <xsd:simpleType name="****StoreLocatorQueryEnumType">
>>>>
>>>> <xsd:restriction base="xsd:normalizedString">
>>>> <xsd:enumeration value="find_by_geocode"/>
>>>> <xsd:enumeration value="find_by_address"/>
>>>> </xsd:restriction>
>>>> </xsd:simpleType>
>>>> </xsd:schema>
>>>> </wadl:grammars>
>>>>
>>>> <wadl:resources base="http://store-locator.**a**cme.com<http://acme.com>
>>>> <http://store-locator.**acme.com <http://store-locator.acme.com>>
>>>>
>>>> ">
>>>> <wadl:resource path="/store" id="StoreLocator">
>>>> <wadl:method href="#findByQuery"/>
>>>> </wadl:resource>
>>>> </wadl:resources>
>>>>
>>>> <wadl:method name="GET" id="findByQuery">
>>>> <wadl:request>
>>>> <wadl:doc xml:lang="en" title="Find by query parameters. Valid queries
>>>> are
>>>> 'find by geocode' and 'find by geographic address'"/>
>>>> <!-- query name -->
>>>> <wadl:param name="q" style="query" type="****StoreLocatorQueryEnumType"
>>>>
>>>> required="true" />
>>>> <!-- geocode -->
>>>> <wadl:param name="latitude" style="query" type="xsd:double"
>>>> required="false" />
>>>> <wadl:param name="longitude" style="query" type="xsd:double"
>>>> required="false" />
>>>> <!-- geographic address -->
>>>> <wadl:param name="address_line_1" style="query" required="false" />
>>>> <wadl:param name="address_line_2" style="query" required="false" />
>>>> <wadl:param name="address_line_3" style="query" required="false" />
>>>> <wadl:param name="city" style="query" required="false" />
>>>> <wadl:param name="region" style="query" required="false" />
>>>> <wadl:param name="postal_code" style="query" required="false" />
>>>> <wadl:param name="country" style="query" required="false" />
>>>> </wadl:request>
>>>> <wadl:response>
>>>> <wadl:representation status="200"
>>>> mediaType="application/vnd.****com.acme.ecommerce.store-**
>>>> locator-result+json;version=1.****0"
>>>> element="store-locator-v1:****StoreLocatorResultList"/>
>>>>
>>>> <!--
>>>> <wadl:fault id="BadOrMissingValue" status="400"
>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>> json;version=1.0"
>>>> element="faults-v1_0:****ValidationFault"/>
>>>>
>>>> <wadl:fault id="NotAuthorized" status="403"
>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>> json;version=1.0"
>>>> element="faults-v1_0:****NotAuthorizedFault"/>
>>>>
>>>> <wadl:fault id="NotFound" status="404"
>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>> json;version=1.0"
>>>> element="faults-v1_0:****NoEntityFoundFault"/>
>>>>
>>>> <wadl:fault id="CanNotPerform" status="500"
>>>> mediaType="application/vnd.****com.acme.ecommerce.common+**
>>>> json;version=1.0"
>>>> element="faults-v1_0:****CanNotPerformFault"/>
>>>>
>>>> -->
>>>> </wadl:response>
>>>> </wadl:method>
>>>> </wadl:application>
>>>> ----
>>>>
>>>>
>>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>> Blog: http://sberyozkin.blogspot.com
>>>
>>>
>>
Re: wadl2java classpath issues
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,
On 03/04/13 00:13, Michael Lambert wrote:
> Its an essential feature for me unfortunately as I want to centrally manage
> all of my schemas so they can be easily discovered and reused. I need to be
> able to navigate around a jar to choose the ones I want to import. If I can
> be any help please let me know.
>
I think I've fixed it, see [1]
Can you please help on your end with trying 2.5.x SNAPSHOTS (as far as I
recall you work with 2.5.x) in a day or two, or may be rebuilding 2.5.x
locally and trying that ?
Cheers, Sergey
[1] https://issues.apache.org/jira/browse/CXF-4946
>
> On Tue, Apr 2, 2013 at 3:38 PM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> Hi
>>
>> It is the problem with resolving ".." against the base URI, you can have
>> the schemas located in the same folder as the actual WADL or in child
>> folders, example, schemas/myschema.xsd.
>> I'll have a look later on and see if ".." can be supported too
>>
>> Cheers, Sergey
>>
>>
>> On 02/04/13 16:45, Michael Lambert wrote:
>>
>>> The wadl2java tool does not seem to be able to handle relative paths to
>>> schemas. When I try to execute: mvn generate-sources -X on a pom with the
>>> following snippet:
>>>
>>> <wadl:grammars>
>>> <wadl:include href="store-locator-v1.xsd"/>
>>> <!-- problem line.. note the elipses -->
>>> <wadl:include href="../../common/faults-v1_**0.xsd"/>
>>> ...
>>> </wadl:grammers>
>>>
>>> This exception stack is thrown:
>>>
>>> [ERROR] Failed to execute goal
>>> org.apache.cxf:cxf-wadl2java-**plugin:2.5.2:wadl2java (generate-sources)
>>> on
>>> project store-locator-rs-artifacts: java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>>> can not be read -> [Help 1]
>>> org.apache.maven.lifecycle.**LifecycleExecutionException: Failed to
>>> execute
>>> goal org.apache.cxf:cxf-wadl2java-**plugin:2.5.2:wadl2java
>>> (generate-sources)
>>> on project store-locator-rs-artifacts: java.lang.RuntimeException:
>>> Resource
>>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>>> can not be read
>>> 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:**57)
>>> at
>>> sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
>>> DelegatingMethodAccessorImpl.**java:43)
>>> at java.lang.reflect.Method.**invoke(Method.java:601)
>>> 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:
>>> java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>>> can not be read
>>> at
>>> org.apache.cxf.maven_plugin.**wadlto.**AbstractCodeGeneratorMojo.**
>>> callCodeGenerator(**AbstractCodeGeneratorMojo.**java:458)
>>> at
>>> org.apache.cxf.maven_plugin.**wadlto.WADL2JavaMojo.execute(**
>>> WADL2JavaMojo.java:101)
>>> 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: org.apache.cxf.tools.common.**ToolException:
>>> java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>>> can not be read
>>> at
>>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.execute(**
>>> JAXRSContainer.java:84)
>>> at
>>> org.apache.cxf.tools.common.**toolspec.ToolRunner.runTool(**
>>> ToolRunner.java:103)
>>> at org.apache.cxf.tools.wadlto.**WADLToJava.run(WADLToJava.**java:65)
>>> at org.apache.cxf.tools.wadlto.**WADLToJava.run(WADLToJava.**java:57)
>>> at
>>> org.apache.cxf.maven_plugin.**wadlto.**AbstractCodeGeneratorMojo.**
>>> callCodeGenerator(**AbstractCodeGeneratorMojo.**java:455)
>>> ... 22 more
>>> Caused by: java.lang.RuntimeException: Resource
>>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>>> can not be read
>>> at
>>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**
>>> readIncludedDocument(**SourceGenerator.java:1174)
>>> at
>>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**getSchemaElements(**
>>> SourceGenerator.java:1130)
>>> at
>>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**
>>> generateSchemaCodeAndInfo(**SourceGenerator.java:228)
>>> at
>>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**generateSource(**
>>> SourceGenerator.java:220)
>>> at
>>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.**
>>> processWadl(JAXRSContainer.**java:153)
>>> at
>>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.execute(**
>>> JAXRSContainer.java:67)
>>> at
>>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.execute(**
>>> JAXRSContainer.java:76)
>>>
>>> If I place the problemed schema in the same directory as the wadl
>>> everything behaves:
>>>
>>> <wadl:grammars>
>>> <wadl:include href="store-locator-v1.xsd"/>
>>> <wadl:include href="faults-v1_0.xsd"/>
>>> ...
>>> </wadl:grammers>
>>>
>>> I am inlining the pom and wadl in case the list has problems with
>>> attachments. I hope that is okay. Am I doing something wrong?
>>>
>>> Thank you in Advance.
>>>
>>> ----
>>> <project xmlns="http://maven.apache.**org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>"
>>> xmlns:xsi="
>>> http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"
>>> xsi:schemaLocation="
>>> http://maven.apache.org/POM/4.**0.0<http://maven.apache.org/POM/4.0.0>
>>> http://maven.apache.org/xsd/**maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
>>> ">
>>> <modelVersion>4.0.0</**modelVersion>
>>> <artifactId>store-locator-rs-**artifacts</artifactId>
>>> <version>0.0.1-SNAPSHOT</**version>
>>> <parent>
>>> <artifactId>api-maven-base</**artifactId>
>>> <groupId>com.acme.ecommerce</**groupId>
>>> <version>0.1.4</version>
>>> </parent>
>>> <dependencies>
>>> <dependency>
>>> <groupId>com.acme.ecommerce</**groupId>
>>> <artifactId>schemas</**artifactId>
>>> <version>0.0.1-SNAPSHOT</**version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.cxf</**groupId>
>>> <artifactId>cxf-bundle-jaxrs</**artifactId>
>>> </dependency>
>>> </dependencies>
>>> <build>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.cxf</**groupId>
>>> <artifactId>cxf-wadl2java-**plugin</artifactId>
>>> <version>2.5.2</version>
>>> <executions>
>>> <execution>
>>> <id>generate-sources</id>
>>> <phase>generate-sources</**phase>
>>> <configuration>
>>> <sourceRoot>${basedir}/target/**generated/src/main/java</**sourceRoot>
>>> <wadlOptions>
>>> <wadlOption>
>>> <wadl>classpath:/services/**store-locator/store-locator-**
>>> wadl-v1.xml</wadl>
>>> <extraargs>
>>> <extraarg>-verbose</extraarg>
>>> </extraargs>
>>> <packagename>com.acme.**ecommerce.store.locator.**service.rs.version1</**
>>> packagename>
>>> <schemaPackagenames>
>>> <schemaPackagename>urn:com:**acme:ecommerce:wadl:store-**
>>> locator:v1=com.acme.ecommerce.**store.locator.service.rs.**
>>> version1</schemaPackagename>
>>> <schemaPackagename>urn:com:**acme:ecommerce:schema:store-**
>>> locator:v1=com.acme.ecommerce.**store.locator.service.rs.**
>>> version1</schemaPackagename>
>>> </schemaPackagenames>
>>> </wadlOption>
>>> </wadlOptions>
>>> </configuration>
>>> <goals>
>>> <goal>wadl2java</goal>
>>> </goals>
>>> </execution>
>>> </executions>
>>> </plugin>
>>> </plugins>
>>> <pluginManagement>
>>> <plugins>
>>> <!--This plugin's configuration is used to store Eclipse m2e settings
>>> only.
>>> It has no influence on the Maven build itself.-->
>>> <plugin>
>>> <groupId>org.eclipse.m2e</**groupId>
>>> <artifactId>lifecycle-mapping<**/artifactId>
>>> <version>1.0.0</version>
>>> <configuration>
>>> <lifecycleMappingMetadata>
>>> <pluginExecutions>
>>> <pluginExecution>
>>> <pluginExecutionFilter>
>>> <groupId>
>>> org.apache.cxf
>>> </groupId>
>>> <artifactId>
>>> cxf-wadl2java-plugin
>>> </artifactId>
>>> <versionRange>
>>> [2.5.1,)
>>> </versionRange>
>>> <goals>
>>> <goal>wadl2java</goal>
>>> </goals>
>>> </pluginExecutionFilter>
>>> <action>
>>> <ignore></ignore>
>>> </action>
>>> </pluginExecution>
>>> </pluginExecutions>
>>> </lifecycleMappingMetadata>
>>> </configuration>
>>> </plugin>
>>> </plugins>
>>> </pluginManagement>
>>> </build>
>>> </project>
>>>
>>> ----
>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>>
>>> <wadl:application
>>> xmlns="urn:com:acme:ecommerce:**wadl:store-locator:v1"
>>> targetNamespace="urn:com:acme:**ecommerce:wadl:store-locator:**v1"
>>> xmlns:xsd="http://www.w3.org/**2001/XMLSchema<http://www.w3.org/2001/XMLSchema>
>>> "
>>> xmlns:store-locator-v1="urn:**com:acme:ecommerce:schema:**
>>> store-locator:v1"
>>> xmlns:wadl="http://wadl.dev.**java.net/2009/02<http://wadl.dev.java.net/2009/02>
>>> ">
>>> <wadl:doc xml:lang="en" title="Version 1.0"/>
>>> <wadl:grammars>
>>> <wadl:include href="store-locator-v1.xsd"/>
>>> <wadl:include href="../../common/faults-v1_**0.xsd"/>
>>> <xsd:schema
>>> xmlns="urn:com:acme:ecommerce:**wadl:store-locator:v1"
>>> targetNamespace="urn:com:acme:**ecommerce:wadl:store-locator:**v1">
>>> <xsd:simpleType name="**StoreLocatorQueryEnumType">
>>> <xsd:restriction base="xsd:normalizedString">
>>> <xsd:enumeration value="find_by_geocode"/>
>>> <xsd:enumeration value="find_by_address"/>
>>> </xsd:restriction>
>>> </xsd:simpleType>
>>> </xsd:schema>
>>> </wadl:grammars>
>>>
>>> <wadl:resources base="http://store-locator.**acme.com<http://store-locator.acme.com>
>>> ">
>>> <wadl:resource path="/store" id="StoreLocator">
>>> <wadl:method href="#findByQuery"/>
>>> </wadl:resource>
>>> </wadl:resources>
>>>
>>> <wadl:method name="GET" id="findByQuery">
>>> <wadl:request>
>>> <wadl:doc xml:lang="en" title="Find by query parameters. Valid queries are
>>> 'find by geocode' and 'find by geographic address'"/>
>>> <!-- query name -->
>>> <wadl:param name="q" style="query" type="**StoreLocatorQueryEnumType"
>>> required="true" />
>>> <!-- geocode -->
>>> <wadl:param name="latitude" style="query" type="xsd:double"
>>> required="false" />
>>> <wadl:param name="longitude" style="query" type="xsd:double"
>>> required="false" />
>>> <!-- geographic address -->
>>> <wadl:param name="address_line_1" style="query" required="false" />
>>> <wadl:param name="address_line_2" style="query" required="false" />
>>> <wadl:param name="address_line_3" style="query" required="false" />
>>> <wadl:param name="city" style="query" required="false" />
>>> <wadl:param name="region" style="query" required="false" />
>>> <wadl:param name="postal_code" style="query" required="false" />
>>> <wadl:param name="country" style="query" required="false" />
>>> </wadl:request>
>>> <wadl:response>
>>> <wadl:representation status="200"
>>> mediaType="application/vnd.**com.acme.ecommerce.store-**
>>> locator-result+json;version=1.**0"
>>> element="store-locator-v1:**StoreLocatorResultList"/>
>>> <!--
>>> <wadl:fault id="BadOrMissingValue" status="400"
>>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**ValidationFault"/>
>>> <wadl:fault id="NotAuthorized" status="403"
>>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**NotAuthorizedFault"/>
>>> <wadl:fault id="NotFound" status="404"
>>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**NoEntityFoundFault"/>
>>> <wadl:fault id="CanNotPerform" status="500"
>>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>>> json;version=1.0"
>>> element="faults-v1_0:**CanNotPerformFault"/>
>>> -->
>>> </wadl:response>
>>> </wadl:method>
>>> </wadl:application>
>>> ----
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>
Re: wadl2java classpath issues
Posted by Michael Lambert <mi...@michaellambert.com>.
Its an essential feature for me unfortunately as I want to centrally manage
all of my schemas so they can be easily discovered and reused. I need to be
able to navigate around a jar to choose the ones I want to import. If I can
be any help please let me know.
On Tue, Apr 2, 2013 at 3:38 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
> Hi
>
> It is the problem with resolving ".." against the base URI, you can have
> the schemas located in the same folder as the actual WADL or in child
> folders, example, schemas/myschema.xsd.
> I'll have a look later on and see if ".." can be supported too
>
> Cheers, Sergey
>
>
> On 02/04/13 16:45, Michael Lambert wrote:
>
>> The wadl2java tool does not seem to be able to handle relative paths to
>> schemas. When I try to execute: mvn generate-sources -X on a pom with the
>> following snippet:
>>
>> <wadl:grammars>
>> <wadl:include href="store-locator-v1.xsd"/>
>> <!-- problem line.. note the elipses -->
>> <wadl:include href="../../common/faults-v1_**0.xsd"/>
>> ...
>> </wadl:grammers>
>>
>> This exception stack is thrown:
>>
>> [ERROR] Failed to execute goal
>> org.apache.cxf:cxf-wadl2java-**plugin:2.5.2:wadl2java (generate-sources)
>> on
>> project store-locator-rs-artifacts: java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>> can not be read -> [Help 1]
>> org.apache.maven.lifecycle.**LifecycleExecutionException: Failed to
>> execute
>> goal org.apache.cxf:cxf-wadl2java-**plugin:2.5.2:wadl2java
>> (generate-sources)
>> on project store-locator-rs-artifacts: java.lang.RuntimeException:
>> Resource
>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>> can not be read
>> 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:**57)
>> at
>> sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
>> DelegatingMethodAccessorImpl.**java:43)
>> at java.lang.reflect.Method.**invoke(Method.java:601)
>> 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:
>> java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>> can not be read
>> at
>> org.apache.cxf.maven_plugin.**wadlto.**AbstractCodeGeneratorMojo.**
>> callCodeGenerator(**AbstractCodeGeneratorMojo.**java:458)
>> at
>> org.apache.cxf.maven_plugin.**wadlto.WADL2JavaMojo.execute(**
>> WADL2JavaMojo.java:101)
>> 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: org.apache.cxf.tools.common.**ToolException:
>> java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>> can not be read
>> at
>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.execute(**
>> JAXRSContainer.java:84)
>> at
>> org.apache.cxf.tools.common.**toolspec.ToolRunner.runTool(**
>> ToolRunner.java:103)
>> at org.apache.cxf.tools.wadlto.**WADLToJava.run(WADLToJava.**java:65)
>> at org.apache.cxf.tools.wadlto.**WADLToJava.run(WADLToJava.**java:57)
>> at
>> org.apache.cxf.maven_plugin.**wadlto.**AbstractCodeGeneratorMojo.**
>> callCodeGenerator(**AbstractCodeGeneratorMojo.**java:455)
>> ... 22 more
>> Caused by: java.lang.RuntimeException: Resource
>> jar:file:/home/lamberm/.m2/**repository/com/dominos/**
>> ecommerce/schemas/0.0.1-**SNAPSHOT/schemas-0.0.1-**
>> SNAPSHOT.jar!/services/store-**locator/../../common/faults-**v1_0.xsd
>> can not be read
>> at
>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**
>> readIncludedDocument(**SourceGenerator.java:1174)
>> at
>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**getSchemaElements(**
>> SourceGenerator.java:1130)
>> at
>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**
>> generateSchemaCodeAndInfo(**SourceGenerator.java:228)
>> at
>> org.apache.cxf.jaxrs.ext.**codegen.SourceGenerator.**generateSource(**
>> SourceGenerator.java:220)
>> at
>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.**
>> processWadl(JAXRSContainer.**java:153)
>> at
>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.execute(**
>> JAXRSContainer.java:67)
>> at
>> org.apache.cxf.tools.wadlto.**jaxrs.JAXRSContainer.execute(**
>> JAXRSContainer.java:76)
>>
>> If I place the problemed schema in the same directory as the wadl
>> everything behaves:
>>
>> <wadl:grammars>
>> <wadl:include href="store-locator-v1.xsd"/>
>> <wadl:include href="faults-v1_0.xsd"/>
>> ...
>> </wadl:grammers>
>>
>> I am inlining the pom and wadl in case the list has problems with
>> attachments. I hope that is okay. Am I doing something wrong?
>>
>> Thank you in Advance.
>>
>> ----
>> <project xmlns="http://maven.apache.**org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>"
>> xmlns:xsi="
>> http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"
>> xsi:schemaLocation="
>> http://maven.apache.org/POM/4.**0.0 <http://maven.apache.org/POM/4.0.0>
>> http://maven.apache.org/xsd/**maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
>> ">
>> <modelVersion>4.0.0</**modelVersion>
>> <artifactId>store-locator-rs-**artifacts</artifactId>
>> <version>0.0.1-SNAPSHOT</**version>
>> <parent>
>> <artifactId>api-maven-base</**artifactId>
>> <groupId>com.acme.ecommerce</**groupId>
>> <version>0.1.4</version>
>> </parent>
>> <dependencies>
>> <dependency>
>> <groupId>com.acme.ecommerce</**groupId>
>> <artifactId>schemas</**artifactId>
>> <version>0.0.1-SNAPSHOT</**version>
>> </dependency>
>> <dependency>
>> <groupId>org.apache.cxf</**groupId>
>> <artifactId>cxf-bundle-jaxrs</**artifactId>
>> </dependency>
>> </dependencies>
>> <build>
>> <plugins>
>> <plugin>
>> <groupId>org.apache.cxf</**groupId>
>> <artifactId>cxf-wadl2java-**plugin</artifactId>
>> <version>2.5.2</version>
>> <executions>
>> <execution>
>> <id>generate-sources</id>
>> <phase>generate-sources</**phase>
>> <configuration>
>> <sourceRoot>${basedir}/target/**generated/src/main/java</**sourceRoot>
>> <wadlOptions>
>> <wadlOption>
>> <wadl>classpath:/services/**store-locator/store-locator-**
>> wadl-v1.xml</wadl>
>> <extraargs>
>> <extraarg>-verbose</extraarg>
>> </extraargs>
>> <packagename>com.acme.**ecommerce.store.locator.**service.rs.version1</**
>> packagename>
>> <schemaPackagenames>
>> <schemaPackagename>urn:com:**acme:ecommerce:wadl:store-**
>> locator:v1=com.acme.ecommerce.**store.locator.service.rs.**
>> version1</schemaPackagename>
>> <schemaPackagename>urn:com:**acme:ecommerce:schema:store-**
>> locator:v1=com.acme.ecommerce.**store.locator.service.rs.**
>> version1</schemaPackagename>
>> </schemaPackagenames>
>> </wadlOption>
>> </wadlOptions>
>> </configuration>
>> <goals>
>> <goal>wadl2java</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>> </plugins>
>> <pluginManagement>
>> <plugins>
>> <!--This plugin's configuration is used to store Eclipse m2e settings
>> only.
>> It has no influence on the Maven build itself.-->
>> <plugin>
>> <groupId>org.eclipse.m2e</**groupId>
>> <artifactId>lifecycle-mapping<**/artifactId>
>> <version>1.0.0</version>
>> <configuration>
>> <lifecycleMappingMetadata>
>> <pluginExecutions>
>> <pluginExecution>
>> <pluginExecutionFilter>
>> <groupId>
>> org.apache.cxf
>> </groupId>
>> <artifactId>
>> cxf-wadl2java-plugin
>> </artifactId>
>> <versionRange>
>> [2.5.1,)
>> </versionRange>
>> <goals>
>> <goal>wadl2java</goal>
>> </goals>
>> </pluginExecutionFilter>
>> <action>
>> <ignore></ignore>
>> </action>
>> </pluginExecution>
>> </pluginExecutions>
>> </lifecycleMappingMetadata>
>> </configuration>
>> </plugin>
>> </plugins>
>> </pluginManagement>
>> </build>
>> </project>
>>
>> ----
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>
>> <wadl:application
>> xmlns="urn:com:acme:ecommerce:**wadl:store-locator:v1"
>> targetNamespace="urn:com:acme:**ecommerce:wadl:store-locator:**v1"
>> xmlns:xsd="http://www.w3.org/**2001/XMLSchema<http://www.w3.org/2001/XMLSchema>
>> "
>> xmlns:store-locator-v1="urn:**com:acme:ecommerce:schema:**
>> store-locator:v1"
>> xmlns:wadl="http://wadl.dev.**java.net/2009/02<http://wadl.dev.java.net/2009/02>
>> ">
>> <wadl:doc xml:lang="en" title="Version 1.0"/>
>> <wadl:grammars>
>> <wadl:include href="store-locator-v1.xsd"/>
>> <wadl:include href="../../common/faults-v1_**0.xsd"/>
>> <xsd:schema
>> xmlns="urn:com:acme:ecommerce:**wadl:store-locator:v1"
>> targetNamespace="urn:com:acme:**ecommerce:wadl:store-locator:**v1">
>> <xsd:simpleType name="**StoreLocatorQueryEnumType">
>> <xsd:restriction base="xsd:normalizedString">
>> <xsd:enumeration value="find_by_geocode"/>
>> <xsd:enumeration value="find_by_address"/>
>> </xsd:restriction>
>> </xsd:simpleType>
>> </xsd:schema>
>> </wadl:grammars>
>>
>> <wadl:resources base="http://store-locator.**acme.com<http://store-locator.acme.com>
>> ">
>> <wadl:resource path="/store" id="StoreLocator">
>> <wadl:method href="#findByQuery"/>
>> </wadl:resource>
>> </wadl:resources>
>>
>> <wadl:method name="GET" id="findByQuery">
>> <wadl:request>
>> <wadl:doc xml:lang="en" title="Find by query parameters. Valid queries are
>> 'find by geocode' and 'find by geographic address'"/>
>> <!-- query name -->
>> <wadl:param name="q" style="query" type="**StoreLocatorQueryEnumType"
>> required="true" />
>> <!-- geocode -->
>> <wadl:param name="latitude" style="query" type="xsd:double"
>> required="false" />
>> <wadl:param name="longitude" style="query" type="xsd:double"
>> required="false" />
>> <!-- geographic address -->
>> <wadl:param name="address_line_1" style="query" required="false" />
>> <wadl:param name="address_line_2" style="query" required="false" />
>> <wadl:param name="address_line_3" style="query" required="false" />
>> <wadl:param name="city" style="query" required="false" />
>> <wadl:param name="region" style="query" required="false" />
>> <wadl:param name="postal_code" style="query" required="false" />
>> <wadl:param name="country" style="query" required="false" />
>> </wadl:request>
>> <wadl:response>
>> <wadl:representation status="200"
>> mediaType="application/vnd.**com.acme.ecommerce.store-**
>> locator-result+json;version=1.**0"
>> element="store-locator-v1:**StoreLocatorResultList"/>
>> <!--
>> <wadl:fault id="BadOrMissingValue" status="400"
>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**ValidationFault"/>
>> <wadl:fault id="NotAuthorized" status="403"
>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**NotAuthorizedFault"/>
>> <wadl:fault id="NotFound" status="404"
>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**NoEntityFoundFault"/>
>> <wadl:fault id="CanNotPerform" status="500"
>> mediaType="application/vnd.**com.acme.ecommerce.common+**
>> json;version=1.0"
>> element="faults-v1_0:**CanNotPerformFault"/>
>> -->
>> </wadl:response>
>> </wadl:method>
>> </wadl:application>
>> ----
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>
Re: wadl2java classpath issues
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
It is the problem with resolving ".." against the base URI, you can have
the schemas located in the same folder as the actual WADL or in child
folders, example, schemas/myschema.xsd.
I'll have a look later on and see if ".." can be supported too
Cheers, Sergey
On 02/04/13 16:45, Michael Lambert wrote:
> The wadl2java tool does not seem to be able to handle relative paths to
> schemas. When I try to execute: mvn generate-sources -X on a pom with the
> following snippet:
>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <!-- problem line.. note the elipses -->
> <wadl:include href="../../common/faults-v1_0.xsd"/>
> ...
> </wadl:grammers>
>
> This exception stack is thrown:
>
> [ERROR] Failed to execute goal
> org.apache.cxf:cxf-wadl2java-plugin:2.5.2:wadl2java (generate-sources) on
> project store-locator-rs-artifacts: java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
> can not be read -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal org.apache.cxf:cxf-wadl2java-plugin:2.5.2:wadl2java (generate-sources)
> on project store-locator-rs-artifacts: java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
> can not be read
> 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:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> 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:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
> can not be read
> at
> org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCodeGenerator(AbstractCodeGeneratorMojo.java:458)
> at
> org.apache.cxf.maven_plugin.wadlto.WADL2JavaMojo.execute(WADL2JavaMojo.java:101)
> 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: org.apache.cxf.tools.common.ToolException:
> java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
> can not be read
> at
> org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:84)
> at
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
> at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:65)
> at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:57)
> at
> org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCodeGenerator(AbstractCodeGeneratorMojo.java:455)
> ... 22 more
> Caused by: java.lang.RuntimeException: Resource
> jar:file:/home/lamberm/.m2/repository/com/dominos/ecommerce/schemas/0.0.1-SNAPSHOT/schemas-0.0.1-SNAPSHOT.jar!/services/store-locator/../../common/faults-v1_0.xsd
> can not be read
> at
> org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.readIncludedDocument(SourceGenerator.java:1174)
> at
> org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.getSchemaElements(SourceGenerator.java:1130)
> at
> org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateSchemaCodeAndInfo(SourceGenerator.java:228)
> at
> org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateSource(SourceGenerator.java:220)
> at
> org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.processWadl(JAXRSContainer.java:153)
> at
> org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:67)
> at
> org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:76)
>
> If I place the problemed schema in the same directory as the wadl
> everything behaves:
>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <wadl:include href="faults-v1_0.xsd"/>
> ...
> </wadl:grammers>
>
> I am inlining the pom and wadl in case the list has problems with
> attachments. I hope that is okay. Am I doing something wrong?
>
> Thank you in Advance.
>
> ----
> <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/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <artifactId>store-locator-rs-artifacts</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <parent>
> <artifactId>api-maven-base</artifactId>
> <groupId>com.acme.ecommerce</groupId>
> <version>0.1.4</version>
> </parent>
> <dependencies>
> <dependency>
> <groupId>com.acme.ecommerce</groupId>
> <artifactId>schemas</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-bundle-jaxrs</artifactId>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-wadl2java-plugin</artifactId>
> <version>2.5.2</version>
> <executions>
> <execution>
> <id>generate-sources</id>
> <phase>generate-sources</phase>
> <configuration>
> <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
> <wadlOptions>
> <wadlOption>
> <wadl>classpath:/services/store-locator/store-locator-wadl-v1.xml</wadl>
> <extraargs>
> <extraarg>-verbose</extraarg>
> </extraargs>
> <packagename>com.acme.ecommerce.store.locator.service.rs.version1</packagename>
> <schemaPackagenames>
> <schemaPackagename>urn:com:acme:ecommerce:wadl:store-locator:v1=com.acme.ecommerce.store.locator.service.rs.version1</schemaPackagename>
> <schemaPackagename>urn:com:acme:ecommerce:schema:store-locator:v1=com.acme.ecommerce.store.locator.service.rs.version1</schemaPackagename>
> </schemaPackagenames>
> </wadlOption>
> </wadlOptions>
> </configuration>
> <goals>
> <goal>wadl2java</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> <pluginManagement>
> <plugins>
> <!--This plugin's configuration is used to store Eclipse m2e settings only.
> It has no influence on the Maven build itself.-->
> <plugin>
> <groupId>org.eclipse.m2e</groupId>
> <artifactId>lifecycle-mapping</artifactId>
> <version>1.0.0</version>
> <configuration>
> <lifecycleMappingMetadata>
> <pluginExecutions>
> <pluginExecution>
> <pluginExecutionFilter>
> <groupId>
> org.apache.cxf
> </groupId>
> <artifactId>
> cxf-wadl2java-plugin
> </artifactId>
> <versionRange>
> [2.5.1,)
> </versionRange>
> <goals>
> <goal>wadl2java</goal>
> </goals>
> </pluginExecutionFilter>
> <action>
> <ignore></ignore>
> </action>
> </pluginExecution>
> </pluginExecutions>
> </lifecycleMappingMetadata>
> </configuration>
> </plugin>
> </plugins>
> </pluginManagement>
> </build>
> </project>
>
> ----
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>
> <wadl:application
> xmlns="urn:com:acme:ecommerce:wadl:store-locator:v1"
> targetNamespace="urn:com:acme:ecommerce:wadl:store-locator:v1"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:store-locator-v1="urn:com:acme:ecommerce:schema:store-locator:v1"
> xmlns:wadl="http://wadl.dev.java.net/2009/02">
> <wadl:doc xml:lang="en" title="Version 1.0"/>
> <wadl:grammars>
> <wadl:include href="store-locator-v1.xsd"/>
> <wadl:include href="../../common/faults-v1_0.xsd"/>
> <xsd:schema
> xmlns="urn:com:acme:ecommerce:wadl:store-locator:v1"
> targetNamespace="urn:com:acme:ecommerce:wadl:store-locator:v1">
> <xsd:simpleType name="StoreLocatorQueryEnumType">
> <xsd:restriction base="xsd:normalizedString">
> <xsd:enumeration value="find_by_geocode"/>
> <xsd:enumeration value="find_by_address"/>
> </xsd:restriction>
> </xsd:simpleType>
> </xsd:schema>
> </wadl:grammars>
>
> <wadl:resources base="http://store-locator.acme.com">
> <wadl:resource path="/store" id="StoreLocator">
> <wadl:method href="#findByQuery"/>
> </wadl:resource>
> </wadl:resources>
>
> <wadl:method name="GET" id="findByQuery">
> <wadl:request>
> <wadl:doc xml:lang="en" title="Find by query parameters. Valid queries are
> 'find by geocode' and 'find by geographic address'"/>
> <!-- query name -->
> <wadl:param name="q" style="query" type="StoreLocatorQueryEnumType"
> required="true" />
> <!-- geocode -->
> <wadl:param name="latitude" style="query" type="xsd:double"
> required="false" />
> <wadl:param name="longitude" style="query" type="xsd:double"
> required="false" />
> <!-- geographic address -->
> <wadl:param name="address_line_1" style="query" required="false" />
> <wadl:param name="address_line_2" style="query" required="false" />
> <wadl:param name="address_line_3" style="query" required="false" />
> <wadl:param name="city" style="query" required="false" />
> <wadl:param name="region" style="query" required="false" />
> <wadl:param name="postal_code" style="query" required="false" />
> <wadl:param name="country" style="query" required="false" />
> </wadl:request>
> <wadl:response>
> <wadl:representation status="200"
> mediaType="application/vnd.com.acme.ecommerce.store-locator-result+json;version=1.0"
> element="store-locator-v1:StoreLocatorResultList"/>
> <!--
> <wadl:fault id="BadOrMissingValue" status="400"
> mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
> element="faults-v1_0:ValidationFault"/>
> <wadl:fault id="NotAuthorized" status="403"
> mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
> element="faults-v1_0:NotAuthorizedFault"/>
> <wadl:fault id="NotFound" status="404"
> mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
> element="faults-v1_0:NoEntityFoundFault"/>
> <wadl:fault id="CanNotPerform" status="500"
> mediaType="application/vnd.com.acme.ecommerce.common+json;version=1.0"
> element="faults-v1_0:CanNotPerformFault"/>
> -->
> </wadl:response>
> </wadl:method>
> </wadl:application>
> ----
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com