首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pact文件上传到pact代理失败

Pact文件上传到pact代理失败
EN

Stack Overflow用户
提问于 2017-10-03 08:55:55
回答 2查看 3.2K关注 0票数 0

在将pact文件上传到pact代理时,发出“未能读取契约: NullPointerException”的问题。下面是我的堆栈跟踪和POM文件的详细信息。请帮帮忙。下面是我的堆栈跟踪

代码语言:javascript
复制
  [INFO] loading pacts from target/pacts
[INFO] found pact file: PRODUCT-CART.json
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.476 s
[INFO] Finished at: 2017-10-03T15:09:20+08:00
[INFO] Final Memory: 11M/243M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.warmuuh:pactbroker-maven-plugin:0.0.9:upload-pacts (default-cli) on project Auth_Api_Consumer: Failed to read pacts: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.warmuuh:pactbroker-maven-plugin:0.0.9:upload-pacts (default-cli) on project Auth_Api_Consumer: Failed to read pacts
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at 

下面是我的POM.xml

代码语言:javascript
复制
                <plugin>
                    <groupId>com.github.warmuuh</groupId>
                    <artifactId>pactbroker-maven-plugin</artifactId>
                    <version>0.0.9</version>
                    <executions>
                    <!--CONSUMER Upload Pact File Starts -->    
                        <execution>
                          <id>upload-pacts</id>
                          <phase>test</phase>
                          <goals><goal>upload-pacts</goal></goals>
                          <configuration>
                           <brokerUrl>http://localhost:8080/</brokerUrl>
                           <!-- <brokerUrl>git@scm.hue.workslan:tools/hue-contract-testing.git</brokerUrl> -->
                            <pacts>${project.build.directory}/pacts</pacts>
                          </configuration>
                        </execution>
                    <!--CONSUMER Upload Pact File Ends -->
                        </executions>
                </plugin>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-10-15 23:16:17

请参阅有关为具有类似名称的服务发布契约的文档:

409在发布协议时

当pact正常发布时(通过PUT to /pacts/provider/PROVIDER/consumer/CONSUMER/version/CONSUMER_APP_VERSION),consumerproviderconsumer version资源将自动创建。

为了防止使用稍微不同的名称变体(例如,用户或提供者)多次创建pacticipant (消费者或提供者)。( FooBar/foo- Bar /foo bar/Foo Bar服务),如果新的参与者名称被认为与现有名称非常相似,则将返回一个409。响应机构将包含指示,说明如果拟为现有名称,则应更正pacticipant名称;如果拟为新名称,则应手动创建该pacticipant名称。

不幸的是,当发生这种情况时,一些clients客户端没有显示完整的错误文本。全文如下:This is the first time a pact has been published for "%{new_name}". The name "%{new_name}" is very similar to the following existing consumers/providers: %{existing_names} If you meant to specify one of the above names, please correct the pact configuration, and re-publish the pact. If the pact is intended to be for a new consumer or provider, please manually create "%{new_name}" using the following command, and then re-publish the pact: $ curl -v -XPOST -H "Content-Type: application/json" -d '{"name": "%{new_name}"}' http://broker/pacticipants If the pact broker requires authentication, include '-u <username>:<password>' in the command.

broker/wiki/Troubleshooting#409-when-publishing-a-pact

票数 0
EN

Stack Overflow用户

发布于 2017-10-09 10:33:03

如果发生以下情况之一,就会出现此问题: 1)您要上载的json文件中的使用者/提供者名称中存在命名冲突。解决方案:确保名称是唯一的,匹配规则不仅与子字符串匹配相关,而且还捕获“相似名称”.Please检查代理匹配代码以获得更多详细信息。目前还没有这方面的文件。例如: Cart_service和order_service是不允许的,汽车订单和订单处理是不允许的,因为他们有共同的词汇.

2)如果有任何问题,运行mvn上传协议将返回NullPointerException。要查看真正的错误,请确保您运行的是mvn测试或mvn安装。它将显示准确的服务器响应状态代码。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46540758

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档