当前位置: 首页 > 知识库问答 >
问题:

如何配置pom。使用web服务时使用xml

司马作人
2023-03-14

我开发了一个Maven应用程序,当我从Netbeans运行它时,它运行良好,但当我尝试使用jar文件时,它生成了以下错误:

组织。阿帕奇。cxf。服务工厂ServiceConstructionException:无法解析null“”的绑定。

我认为我的pom.xml文件配置不正确。

<dependencies>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-security</artifactId>
        <version>2.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>2.6.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.18.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>2.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.1</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>6.1.0.jre8</version>           
        <scope>compile</scope>
    </dependency>


    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>3.0.0-M1</version>
        <type>maven-plugin</type>
    </dependency>

</dependencies>
<build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <outputDirectory>MyDir</outputDirectory>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib</classpathPrefix>
                        <mainClass>com.mycompany.serviciowebdinardap.NewMain</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin> 

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.1</version>
            <configuration>
                <outputDirectory>Mydir_source</outputDirectory>
                <finalName>servicioWebDinardap</finalName>
                <attach>false</attach>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>3.0.0-M1</version>
        </plugin>


        <plugin>

            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>2.6.1</version>

            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <wsdlOptions>
                            <wsdlOption>
                                <bareMethods/>
                                <wsdl>${basedir}/src/main/resources/wsdl/DINARDAPService.wsdl</wsdl>
                                <packagenames>
                                    <packagename>com.mycompany.serviciowebdinardap</packagename>
                                </packagenames>
                            </wsdlOption>
                        </wsdlOptions>

                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.mycompany.serviciowebdinardap.NewMain</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> 
                    <phase>package</phase> 
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin> 
    </plugins>
</build>

共有1个答案

华英睿
2023-03-14

检查类路径上是否存在cxf rt绑定soap。如果没有,则将其包含在pom中。xml:

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-bindings-soap</artifactId>
    <version>2.6.1</version>
</dependency>
 类似资料:
  • 我只使用XML配置来创建MVCWeb应用程序(没有注释)。 现在我想用Spring创建一个RESTful web服务,但我找不到任何不使用注释的教程。 有没有办法只使用XML配置构建RESTful web服务 还是必须使用注释? 例如,您可以仅使用如下所示的XML配置来部署MVC模式的web应用程序。 然而,当我试图为URL映射一个方法时,我遇到了麻烦,例如HTTP方法:,URL:——这样我就可以

  • 问题内容: 我想知道使用node.js消费SOAP XML Web服务的最佳方法是什么 谢谢! 问题答案: 您没有太多选择。 您可能需要使用以下之一: node-soap) strong-soap(重写) easysoap

  • 问题内容: 我是Android开发的新手,我有一个用php制作的Web服务,现在我想在android中使用它,任何人都可以指导我如何实现这一目标。 我已经在网上尝试了许多代码示例,但未能实现此目标。我在ADT中使用Eclipse。 任何帮助都会得到应用。 问题答案: 请通过以下链接。您将在此处找到代码示例 http://www.anddev.org/calling_a_web_service_fr

  • 调用web服务操作时返回的错误是:org.apache.axis2.axisfault:Transport.error:302 error:Redirect at org.apache.axis2.Transport.http.httpsender.handleresponse(httpsender.java:310)at org.apache.axis2.Transport.http.https

  • 问题内容: 我已经为我的应用程序设置了Resque.redis.namespace,现在resque-web不再显示辅助程序和队列。 有什么方法可以使resque-web知道redis.namespace或理想情况下是多个redis namspace? 问题答案: 假设您在中设置了Resque.redis.namespace 。比您可以运行resque- web将此路径作为命令行参数传递给该文件,

  • 因为我有一个长期运行的任务要在我的应用程序的后台执行,所以我正在尝试实现一个服务来完成一项工作。 此服务使用LocationClient实例中的位置数据,每个请求都会触发一个PendingEvent。最低目标版本阻止我使用新的LocationServices,Android文档建议我使用LocationClient的PendingEvent版本。requestLocationUpdates(…)方