【问题标题】:Axis2 Databinding jaxbri + Maven: JAX-B RI JARs not on classpathAxis2 Databinding jaxbri + Maven:JAX-B RI JAR 不在类路径上
【发布时间】:2011-03-14 17:30:00
【问题描述】:

自 2 天以来一直在尝试使 Maven 3.0.3 + axis2-wsdl2code-maven-plugin 1.5.4 与 jaxbri 数据绑定一起工作。错误信息:

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>

即使将 jaxb-ri jar 设置为依赖项也不起作用:

<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>

提前感谢您的帮助。

【问题讨论】:

    标签: maven jaxb axis2 maven-plugin maven-3


    【解决方案1】:

    插件不使用项目的依赖项。您还需要添加 axis2-jaxbri 作为 wsdl2code 插件的依赖项。

            <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>
    

    【讨论】:

    • 你成功了,这就是解决方案。
    猜你喜欢
    • 1970-01-01
    • 2016-09-04
    • 2012-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-16
    • 2023-03-04
    相关资源
    最近更新 更多