Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Problem JAXB unmarshalling big XSD

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am having difficulty unmarshalling a response.xsd with jaxb2-maven-plugin (xjc).
I got this xsd and 4 others and a wsdl from an external organization, and only the response.xsd throws errors when unmarshalling:

The result is generated but with errors:
8 errors saying "cannot find symbol" and 1 time saying a "class is already defined", when running the plugin.

The symbol not found is false since the classes do occur in the resulting file, so it seems to be a processing order issue, and the "class is already defined" message is right because a certain class occurs two times in the same element.

When I try to run the SpringBoot application the same errors are thrown.

I can not upload the original since its sensitive information.

What can I do to handle this? How do you handle a big response xsd when there are conflicts? Do I have to customize binding and how should I do this?
 
Saloon Keeper
Posts: 11462
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

Do all errors disappear when you remove the duplicate type from the XSD?

I'd suggest that you cut out as much as possible from the XSD to create a minimal version that still demonstrates your issue. Then change the identifiers and namespaces that you don't want to show us, as long as it still demonstrates the problem.

Then post the XSD here, and we'll have a look at it. Also tell us your Java, Maven and plugin versions.
 
Kenji Watanabe
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stephan,

Thanks, leaving out the conflicting type did solve the problem.
There are two classes with the same name but differing properties in the XSD, so I guess that is an unforeseen problem.
I must admit being a newbie, but is this fixable with a different namespace?
The XSD is extremely big and changing ids, names and namespaces is almost undoable, but if still necessary let me know, and I can try my best.
 
Stephan van Hulst
Saloon Keeper
Posts: 11462
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the types must be defined in a different schema with a different target namespace. However, if this XSD describes the response from an external webservice, then changing the namespace may cause your client not to recognize the response XML coming from the service.

I would pose this problem to the maintainers of the webservice, because it's their XSD that's faulty.
 
Kenji Watanabe
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the external response xsd is only used to unmarshall I guess customization of (the conflicting) class name may be an option then.
If that's not possible we get back to the external party.
Thanks for the confirmation Stephan!
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!