Happy Business Starts Here

Zuora Alumni

"Two declarations cause a collision in the ObjectFactory class" while generating code

Question:

 

While generating Java code with Zuora's WSDL, the error below keeps popping up even with several different compilers, why is that?

 


[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 255 of file:/Users/UsainBolt/Downloads/zuora.a.74.0.wsdl



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Tags (2)
1 REPLY 1
Zuora Alumni

Re: "Two declarations cause a collision in the ObjectFactory class" while generating code

Answer:

 

Quote from the most official unofficial guide on JAXB:

 

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 try to generate the same method name.

 

One solution is to define an external binding XML so the objectFactory class can create the methods (example XML file attached). Please consult with the reference link for details.

 

Reference:

http://stackoverflow.com/questions/13422253/xjc-two-declarations-cause-a-collision-in-the-objectfact...



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √