Is it possible to bound a jaxb scope for authzforce
Closed this issue · 3 comments
Software version (AuthzForce Core)
20.3.2
Platform JRE
Java 13
Platform OS
Windows
Greetings again. Faced with another problem. I have generated classes in my message bus (external library). And it's implementing the xacml specification model and having the following package: oasis.names.tc.xacml._3_0.core.schema.wd_17 (not a jaxb).
I also have an authzforce-ce-xacml-model-8.5.0.jar library inside which jaxb-stabs are located along the same path - oasis.names.tc.xacml._3_0.core.schema.wd_17.
And when I call the pdp library i get an error:
javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions Two classes have the same XML type name "{urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}anonimous". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at oasis.names.tc.xacml._3_0.core.schema.wd_17.DefaultsType$Anonimous at public oasis.names.tc.xacml._3_0.core.schema.wd_17.DefaultsType$Anonimous oasis.names.tc.xacml._3_0.core.schema.wd_17.DefaultsType.getAnonimous() at oasis.names.tc.xacml._3_0.core.schema.wd_17.DefaultsType at public oasis.names.tc.xacml._3_0.core.schema.wd_17.DefaultsType oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory.createDefaultsType()
...
Is there any way to avoid such a problem without renaming of packages path?
I tried a lot of things. I wrote my own classloader in which I redefined only what the engine needs and launch the engine with that, so jaxb still finds a duplicate that is not XMLType because it loads earlier than my service. Unfortunately, the only working solution turned out to be to rename the stubs of the service
Hi, glad you found a workaround. Out of curiosity, what did you use to generate the classes from the XACML schema, if not JAXB tools?
I use a proprietary generator, which of course takes all the same jaxb staffs as a basis, but after the transformation they are no longer compatible