users@wadl.java.net

Re: Naming conflicts

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 09 Jan 2007 16:16:08 -0500

A workaround is to use a JAXB customization file to rename one of the
clashing classes. You can do this either inline within the schema or
in a separate file that in include in the WADL file (the same way you
include a schema).

JAXB customization example here: http://weblogs.java.net/blog/kohsuke/
archive/2005/05/compiling_mathm_1.html

Marc.

On Jan 9, 2007, at 3:36 PM, Wilfred Springer wrote:

> All,
>
> I've been trying to use the WADL tools to generate client stubs for
> Open Location Services. As it turns out, the schemas that are
> required contain two different AngleType complex types. Since they
> are defined within different namespaces, there is no reason why
> this should be giving problems, however the tools are unable to
> deal with it:
>
> [INFO] Scanning for projects...
> [INFO]
> ----------------------------------------------------------------------
> ------
> [INFO] Building OpenLS Client
> [INFO] task-segment: [clean, generate-sources]
> [INFO]
> ----------------------------------------------------------------------
> ------
> [INFO] [clean:clean]
> [INFO] Deleting directory /home/wilfred/workspace/openls-sample/target
> [INFO] Deleting directory /home/wilfred/workspace/openls-sample/
> target/classes
> [INFO] Deleting directory /home/wilfred/workspace/openls-sample/
> target/test-classes
> Downloading: http://mirrors.sunsite.dk/maven2/javax/xml/bind/jaxb-
> api/2.1/jaxb-api-2.1.pom
> [WARNING] Unable to get resource from repository central (http://
> repo1.maven.org/maven2)
> [INFO] [wadl2java:generate {execution: default}]
> Processing: file:/home/wilfred/workspace/openls-sample/src/main/
> wadl/openls.wadl
> Processing: file:/home/wilfred/workspace/openls-sample/src/main/
> wadl/DirectoryService.xsd
> Error: A class/interface with the same name
> "com.agilejava.openls.AngleType" is already in use. Use a class
> customization to resolve this conflict.
> Error: (Relevant to above error) another "AngleType" is generated
> from here.
> Error: Two declarations cause a collision in the ObjectFactory class.
> Error: (Related to above error) This is the other declaration.
> Error: Two declarations cause a collision in the ObjectFactory class.
> Error: (Related to above error) This is the other declaration.
> Error: Two declarations cause a collision in the ObjectFactory class.
> Error: (Related to above error) This is the other declaration.
> Error: Two declarations cause a collision in the ObjectFactory class.
> Error: (Related to above error) This is the other declaration.
> Error: Two declarations cause a collision in the ObjectFactory class.
> Error: (Related to above error) This is the other declaration.
> Error: Two declarations cause a collision in the ObjectFactory class.
> Error: (Related to above error) This is the other declaration.
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] Total time: 8 seconds
> [INFO] Finished at: Tue Jan 09 21:32:16 CET 2007
> [INFO] Final Memory: 3M/7M
> [INFO]
> ----------------------------------------------------------------------
> --
>
> Would there be a workaround for situations like these?
>
> Thanks,
>
> Wilfred
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.