- This topic has 5 replies, 3 voices, and was last updated 17 years, 3 months ago by Loyal Water.
-
AuthorPosts
-
fobinatorMemberVersion: 6.0.0 M1
Build id: 20070629-6.0.0-M1
JDK: jdk1.6.0_02Error generating services
Error generating JAXB model.I’m having some issues with client generation, checking the error log I see the following message snippets
!MESSAGE A class/interface with the same name “com.ws.QueryResponse” is already in use. Use a class customization to resolve this conflict.
!ENTRY com.genuitec.eclipse.ws.xfire 4 0 2007-08-01 22:21:03.885
!MESSAGE Two declarations cause a collision in the ObjectFactory class.
!STACK 0
com.sun.istack.SAXParseException2: Two declarations cause a collision in the ObjectFactory class.!ENTRY com.genuitec.eclipse.ws.xfire 4 0 2007-08-01 22:21:03.963
!MESSAGE Error generating services
!STACK 0
org.codehaus.xfire.gen.GenerationException: Error generating JAXB model.
at org.codehaus.xfire.gen.jaxb.JAXBSchemaSupport.initialize(JAXBSchemaSupport.java:108)
at org.codehaus.xfire.gen.Wsdl11Generator.generate(Wsdl11Generator.java:154)
at com.genuitec.eclipse.ws.xfire.generator.WSGenJob.run(WSGenJob.java:209)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)My WSDL passed validation, can anyone tell me what’s going on?
Loyal WaterMemberCan you try the following approaches to fix the issue:-
Two declarations cause a collision in the ObjectFactory class
When schemas contain similar looking element/type names, they can result in “Two declarations cause a collision in the ObjectFactory class” errors. To be more precise, for each of all types and many elements (exactly what elements get a factory and what doesn’t is bit tricky to explain), XJC produces one method on the ObjectFactory class in the same package. The ObjectFactory class is created for each package that XJC generates some files into. The name of the method is derived from XML element/type names, and the error is reported if two elements/types tries to generate the same method name.There are two approaches to fix this problem. If the collision is coming from two different schemas with different target namespaces, then you can easily avoid the collision by compiling them into different Java packages. To do this, use <schemabindings> customization on two schemas and specify the package name.
Another way to fix this problem is to use <factoryMethod> customization on two conflicting elements/types to specify different factory method names. This can be used in all cases, but if you have a large number of conflicts, you’ll have to specify this customization one by one.
Notice that <class> customization doesn’t affect the ObjectFactory method name by itself.
fobinatorMemberThanks for the response, I think I’ll have to use the <factoryMethod> customization, but I’m not really sure what this means? What would I need to change?
spulakanamMemberI switched from JDK 1.5 to JDK 1.6 and using Jaxb 2.1.4. I am trying to compile the schema using Ant in my Eclipse. The schema is pretty simple and I get the following exception.
I guess from the above posts I understand some how I need to do the <factoryMethod> customization. Some one care to explain what does this mean?[xjc] build id of XJC is JAXB 2.0 in JDK 1.6
[xjc] Checking timestamp of /Users/spulakanam/Documents/workspace/DigitalSidebarDCS/xmlschema/userevents.xsd
[xjc] the last modified time of the inputs is 1187387812000
[xjc] the last modified time of the outputs is -9223372036854775808
[xjc] Compiling file:/Users/spulakanam/Documents/workspace/DigitalSidebarDCS/xmlschema/userevents.xsd
[xjc] [ERROR] A class/interface with the same name “generated.Data” is already in use. Use a class customization to resolve this conflict.
[xjc] line 3 of file:/Users/spulakanam/Documents/workspace/DigitalSidebarDCS/xmlschema/userevents.xsd
[xjc] [ERROR] (Relevant to above error) another “Data” is generated from here.
[xjc] line 8 of file:/Users/spulakanam/Documents/workspace/DigitalSidebarDCS/xmlschema/userevents.xsd
[xjc] [ERROR] Two declarations cause a collision in the ObjectFactory class.
[xjc] line 8 of file:/Users/spulakanam/Documents/workspace/DigitalSidebarDCS/xmlschema/userevents.xsd
[xjc] [ERROR] (Related to above error) This is the other declaration.
[xjc] line 3 of file:/Users/spulakanam/Documents/workspace/DigitalSidebarDCS/xmlschema/userevents.xsd
[xjc] failure in the XJC task. Use the Ant -verbose switch for more details
spulakanamMemberIt was my mistake building the xsd using RelaxNG. I got it working.
Loyal WaterMemberGlad its working now. Thanks for letting us know.
-
AuthorPosts