Skip to content

Unable to avoid generating oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory #96

@gogolander

Description

@gogolander

My application needs to deserialize the <AttributeProviders> DTO resulting from the GET /pap/attribute.providers. After registering an attribute provider of mine, though, the deserialization fails with the error

Caused by: org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Non è presente alcun ObjectFactory con un @XmlElementDecl per l'elemento {urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}PolicyIdReference.
	this problem is related to the following location:
		at private final java.util.List oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyIdentifierList.policyIdReferencesAndPolicySetIdReferences
		at oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyIdentifierList
		at private final oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyIdentifierList oasis.names.tc.xacml._3_0.core.schema.wd_17.Result.policyIdentifierList
		at oasis.names.tc.xacml._3_0.core.schema.wd_17.Result
		at private final java.util.List oasis.names.tc.xacml._3_0.core.schema.wd_17.Response.results
		at oasis.names.tc.xacml._3_0.core.schema.wd_17.Response
Non è presente alcun ObjectFactory con un @XmlElementDecl per l'elemento {urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}PolicySetIdReference.
	this problem is related to the following location:
		at private final java.util.List oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet.policySetsAndPoliciesAndPolicySetIdReferences
		at oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet

The attribute provider has been developed following the guide: https://authzforce-ce-fiware.readthedocs.io/en/latest/UserAndProgrammersGuide.html#making-an-attribute-provider.

After some digging it looks like jaxb:generate builds another oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory that, depending on the order of the dependencies in my pom.xml, superseeds the correct located in the org.ow2.authzforce:authzforce-ce-xacml-model.
I've tried a number of approches, from setting the episodes to manually removing the unwanted ObjectFactory but I'm unable to find what I think is the proper solution: set the jaxb-maven-plugin in such a way to avoid generating that file.
Am I missing something?

I'm posting the binding.xjb and the relevant portion of the pom.xml:

  • binding.xjb
<?xml version="1.0" encoding="UTF-8"?>
<!-- JAXB version must be 3.0 for jaxb-maven-plugin 4.x -->
<jaxb:bindings jaxb:version="3.0" xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
	jaxb:extensionBindingPrefixes="xjc">
	<jaxb:globalBindings generateMixedExtensions="true" fixedAttributeAsConstantProperty="true">
		<xjc:simple />
	</jaxb:globalBindings>
</jaxb:bindings>
  • pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
[...]

    <properties>
        <compiler-plugin.version>3.14.0</compiler-plugin.version>
        <maven.compiler.release>17</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <skipITs>true</skipITs>
        <surefire-plugin.version>3.5.4</surefire-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.ow2.authzforce</groupId>
            <artifactId>authzforce-ce-core-pdp-api</artifactId>
            <version>22.0.0</version>
            <scope>provided</scope>
        </dependency>
[...]
    <build>
        <plugins>
[...]
            <plugin>
                <groupId>org.jvnet.jaxb</groupId>
                <artifactId>jaxb-maven-plugin</artifactId>
                <version>4.0.0</version>
                <configuration>
                    <!-- debug=true will generate JAXBDebug class. More info: https://github.com/highsource/maven-jaxb2-plugin/wiki/Miscellaneous -->
                    <debug>false</debug>
                    <strict>false</strict>
                    <verbose>true</verbose>
                    <removeOldOutput>true</removeOldOutput>
                    <extension>true</extension>
                    <useDependenciesAsEpisodes>true</useDependenciesAsEpisodes>
                    <catalog>src/main/jaxb/catalog.xml</catalog>
                    <bindingDirectory>src/main/jaxb</bindingDirectory>
                    <schemaDirectory>src/main/resources</schemaDirectory>
                    <!-- If you wish to use extensions, for exemple Value Constructor -->
                    <!--
                    <args>
                         <arg>-Xvalue-constructor</arg>
                      </args>
                      <plugins>
                         <plugin>
                               <groupId>org.jvnet.jaxb</groupId>
                               <artifactId>jaxb-plugins</artifactId>
                               <version>4.0.0</version>
                         </plugin>
                      </plugins>
                      -->
                </configuration>
                <executions>
                    <execution>
                        <id>jaxb-generate-compile-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions