ZUGFeRD / mustangproject

Open Source Java e-Invoicing library, validator and tool (Factur-X/ZUGFeRD, UNCEFACT/CII XRechnung)
http://www.mustangproject.org
Apache License 2.0
188 stars 111 forks source link

Different ph-jaxb versions library dependencies #419

Closed markusfaeth closed 1 month ago

markusfaeth commented 1 month ago

Hello, we are trying to use mustang in a Java EE application. We already are using ph-ubl21 (8.0.3) to create XML invoices (successfully). Now we want to validate XML invoices. But the integration of mustang validator and core (both 2.11.0) seems to collide with ph-ubl21 or even with itself... What we find is that both (creation and validation) work on the development and test system, but not in production for some reason. The exception indicates that during runtime the wrong version of ph-xml is used ("no such method: XMLWriterSettings.setNamespaceContext(...)"). I have looked at the ivy-results and find that the validator uses ph-jaxb 9.5.5 (including ph-xml 9.5.5) and the validator uses library 2.11.0 (including ph-xml in different later versions). So the validator has dependencies to ph-xml 9.5.5 and also to ph-xml 10.0.0+. Now, our usage of ph-ubl21 has also a dependency to ph-xml (11). It seems to me, that depending on which classes are loaded first during runtime, both (validation and creation) work or do not.

Maybe you have some hints for solving the problem? Is ph-ubl21 incompatible to mustang? Is it a bug in mustang validator? Can the validator even be used in an EE app? Should I wait for the validator version 3?

jstaerk commented 1 month ago

Philip was as kind as to update to v8 himself https://github.com/ZUGFeRD/mustangproject/pull/393, the 2.12 was published 20min ago, please try that one (and feel free to feed ubl validations into this project :-) )

markusfaeth commented 1 month ago

Thank you very much, now it works! :)

Note: I had to manually add xml-apis (org.apache.xmlgraphics) via ivy. I also had to add library (before it kind of worked with core and validator only).