Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Axis2 Databinding jaxbri + Maven: JAX-B RI JARs not on classpath

trying since 2 days to get Maven 3.0.3 + axis2-wsdl2code-maven-plugin 1.5.4 with jaxbri databinding to work. Error Message:

java.lang.RuntimeException: JAX-B RI JARs not on classpath
    at org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:78)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)

POM:

...
    <properties>
        <axis2ReleaseVersion>1.5.4</axis2ReleaseVersion>
        <axiomReleaseVersion>1.2.7</axiomReleaseVersion>
        <wodenReleaseVersion>1.0M8</wodenReleaseVersion>

    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>${axis2ReleaseVersion}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-api</artifactId>
            <version>${axiomReleaseVersion}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-impl</artifactId>
            <version>${axiomReleaseVersion}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-dom</artifactId>
            <version>${axiomReleaseVersion}</version>
        </dependency>

        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.5.4</version>

            <configuration>
                <generateServerSide>true</generateServerSide>
                <generateServerSideInterface>true</generateServerSideInterface>
                <generateAllClasses>true</generateAllClasses>
                <!--<generateServicesXml>true</generateServicesXml> -->
                <!--<allPorts>true</allPorts> -->
                <!--<backwardCompatible>true</backwardCompatible> -->
                <!--<unwrap>true</unwrap> -->
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                    <configuration>
                        <packageName>xyz</packageName>
                        <wsdlFile>${basedir}/src/main/resources/wsdl/Service.wsdl</wsdlFile>
                        <databindingName>jaxbri</databindingName>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Even setting jaxb-ri jars into dependencies did not work:

<dependency>
    <groupId>org.apache.axis2</groupId>
    <artifactId>axis2-jaxbri</artifactId>
    <version>1.5.4</version>
</dependency>

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.1</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/resources/lib/jaxb-api-2.1.jar</systemPath>
</dependency>

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.1.7</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/resources/lib/jaxb-impl-2.1.7.jar</systemPath>
</dependency>

<dependency>
    <groupId>com.sun.tools</groupId>
    <artifactId>jaxb1-xjc</artifactId>
    <version>2.1.7</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/resources/lib/jaxb-xjc-2.1.7.jar</systemPath>
</dependency>

Thanks in advance for your help.

like image 273
user659206 Avatar asked Dec 27 '22 23:12

user659206


1 Answers

Plugins don't use project's dependencies. You need to also add axis2-jaxbri as a dependency of the wsdl2code plugin.

        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.5.4</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <packageName>.....</packageName>
                <wsdlFile>.....</wsdlFile>
                <databindingName>jaxbri</databindingName>
                <syncMode>sync</syncMode>
                <generateTestcase>false</generateTestcase>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.apache.axis2</groupId>
                    <artifactId>axis2-jaxbri</artifactId>
                    <version>1.5.4</version>
                </dependency>
            </dependencies>
        </plugin>
like image 100
rustyx Avatar answered Feb 09 '23 00:02

rustyx