【问题标题】:project working with ant, fails with maven使用 ant 的项目,使用 maven 失败
【发布时间】:2013-07-03 15:32:04
【问题描述】:

我们有一个生产中的 Spring Web 应用程序项目。无论出于何种原因,客户现在想用 maven 处理项目。我试图将所有库 jar 文件转换为 maven 依赖项。应用程序构建并打包为战争就好了,但是当我在我的开发服务器上部署时(顺便说一下,它是 tomcat,生产服务器也是 tomcat),它失败并出现以下错误:

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2': FactoryBean threw exception on object creation; nested exception is com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class ws.merchant.service.jaxws.InitializePayment is not found. Have you run APT to generate them?
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.ja

va:109)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:274)
    ... 57 more
Caused by: com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class ws.merchant.service.jaxws.InitializePayment is not found. Have you run APT to generate them?

这是我从其他具有 Web 服务的项目中知道的错误。当我看到这个错误时,我使用 wsgen 创建了包装类并将它们添加到有问题的 Web 服务中。

编辑 ============================

这里是 pom.xml

http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.company.library</groupId>
<artifactId>web app project</artifactId>
<packaging>war</packaging>
<version>1.2.41.0</version>
<name>Maven Webapp</name>

<properties>
    <!--<webXmlPath>env/prod/web.xml</webXmlPath>-->
    <webXmlPath>web/WEB-INF/web.xml</webXmlPath>

    <springFrameworkVersion>3.0.7.RELEASE</springFrameworkVersion>
    <springSecurityVersion>3.1.3.RELEASE</springSecurityVersion>
</properties>

<repositories>
    <repository>
        <id>project.local</id>
        <name>project</name>
        <url>file:${project.basedir}/lib</url>
    </repository>
</repositories>

<dependencies>

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>

    <dependency>
        <groupId>org.apache.velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.7</version>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.6.8</version>
    </dependency>

    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.3</version>
    </dependency>

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.5</version>
    </dependency>


    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>

    <dependency>
        <groupId>commons-net</groupId>
        <artifactId>commons-net</artifactId>
        <version>3.2</version>
    </dependency>

    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.2</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>1.9.3</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.3</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>net.sourceforge.pjl-comp-filter</groupId>
        <artifactId>pjl-comp-filter</artifactId>
        <version>1.7</version>
    </dependency>

    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.company.library</groupId>
        <artifactId>jprov</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.company.library</groupId>
        <artifactId>transfer</artifactId>
        <version>1.0</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>nl.captcha</groupId>
        <artifactId>simplecaptcha</artifactId>
        <version>1.1.1</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.xbean</groupId>
        <artifactId>xbean-spring</artifactId>
        <version>3.6</version>
    </dependency>

    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.2</version>
    </dependency>


    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${springFrameworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>${springFrameworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${springFrameworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${springFrameworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${springFrameworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${springFrameworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${springFrameworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>${springSecurityVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${springSecurityVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${springSecurityVersion}</version>
    </dependency>

    <dependency>
        <groupId>com.google.code.maven-play-plugin.org.playframework</groupId>
        <artifactId>jj-simplecaptcha</artifactId>
        <version>1.1</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.7</version>
    </dependency>


    <dependency>
        <groupId>org.jvnet.jax-ws-commons.spring</groupId>
        <artifactId>jaxws-spring</artifactId>
        <version>1.8</version>

        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>*</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
        <exclusions>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

</dependencies>

<build>
    <directory>dist-prod</directory>
    <outputDirectory>build</outputDirectory>
    <sourceDirectory>src</sourceDirectory>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>web</directory>
                    </resource>
                </webResources>
                <webappDirectory>web_maven</webappDirectory>
                <webXml>${webXmlPath}</webXml>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <configuration>
                <sei>some.web.service.class</sei>
                <keep>true</keep>

            </configuration>
        </plugin>
    </plugins>


</build>

但是问题是,我用Ant部署的时候没有这个问题。我可以很好地使用网络服务。

我正在使用 jaxws-spring.jar 将 Spring 服务发布为 Web 服务。我在这里错过了其他一些依赖吗?我已经为从 Ant 到 Maven 的转换苦苦挣扎了三天,任何其他提示也很感激。

【问题讨论】:

  • 没有对应的pom文件很难猜出哪里出了问题。

标签: spring web-services maven ant jax-ws


【解决方案1】:

检查您的 ANT 构建脚本,看看它是否在某处运行“wsgen”。可能会,你最可能需要在你的 pom 文件中实现。如果是这种情况,您可能可以在 Maven 中使用此插件来生成适当的工件。

http://mojo.codehaus.org/jaxws-maven-plugin/wsgen-mojo.html

查看此链接,该链接似乎描述了您正在寻找的内容:

http://www.techiekernel.com/2012/11/have-you-run-apt-to-generate-them.html

【讨论】:

    猜你喜欢
    • 2020-10-28
    • 2013-01-12
    • 1970-01-01
    • 2017-05-13
    • 2011-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多