Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAXB mixed versions? undefined 'required' attribute

Im generating some classes from WSDL files with wsimport maven plugin @ Mule Anypoint Studio 3.5 with JDK 1.7_55

I'm using jaxb 2.2.7 and remove version 2.1.9 from mule libs and replaced by 2.2.7.

When i compile, sometines works fine but others i take this error multiple times:

The attribute required is undefined for the annotation type XmlElementRef   

I tried to create an endorsed folder in JDK and include .jars needed,

Do you know any way to avoid this error or replace this libs correctly?

I include this dependencies in pom.xml

<dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-tools</artifactId>
        <version>2.2.7</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.7</version>
    </dependency>
    <!-- xjc -->
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-xjc</artifactId>
        <version>2.2.7</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.7</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>idlj-maven-plugin</artifactId>
        <version>1.2.1</version>
    </dependency>       

wsimport is 2.2.7 to

wsimport settings:

<plugin>
            <groupId>org.jvnet.jax-ws-commons</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
                <execution>
                    <id>wsdl-AMANSequenceService-exec</id>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <args>
                            <arg>-version</arg>
                            <arg>-B-nv</arg>
                            <arg>-Xdebug</arg>
                            <arg>-B-XautoNameResolution</arg>
                            <arg>-Xendorsed</arg>
                        </args>
                        <extension>true</extension>
                        <sourceDestDir>${basedir}/src/main/java</sourceDestDir>
                        <destDir>${basedir}/src/main/java</destDir>
                        <extension>true</extension>
                        <wsdlDirectory>${basedir}/src/main/resources/SICG/AMANSequenceService</wsdlDirectory>
                        <wsdlFiles>
                            <wsdlFile>AMANSequenceService.wsdl</wsdlFile>
                        </wsdlFiles>
                        <bindingFiles>
                            <bindingFile>${basedir}/src/main/resources/SICG/external/binding.xjb</bindingFile>
                        </bindingFiles>
                    </configuration>
                </execution>
like image 681
Borja Coalla Avatar asked Jun 13 '14 09:06

Borja Coalla


1 Answers

We can fix the above behavior by replacing the following jars in Mule CE Runtime Folder (C:\AnypointStudio\plugins\org.mule.tooling.server.3.5.0_3.5.0.201405141856\mule\lib\opt):

jaxb-api-2.1 with jaxb-api-2.2.jar

jaxb-impl-2.1.9 with jaxb-impl-2.2.7.jar

jaxb-xjc-2.1.9 with jaxb-xjc-2.2.7.jar

It would be useful if Mule developers updated these packages to the newest distributions.

like image 153
Borja Coalla Avatar answered Nov 03 '22 01:11

Borja Coalla