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<[email protected]>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


Reply via email to