I got error when trying to retrieve a consumer pac...
# pact-jvm
a
I got error when trying to retrieve a consumer pact from local pact broker in provider to verify a pact against its non-http message. I tried few versions including 4.3.14 and 4.2.9 <dependency> <groupId>au.com.dius.pact.provider</groupId> <artifactId>junit5</artifactId> <version>4.3.14</version> <scope>test</scope> </dependency> <dependency> <groupId>au.com.dius.pact.provider</groupId> <artifactId>junit</artifactId> <version>4.3.14</version> <scope>test</scope> </dependency> 175913.737 [main] DEBUG au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider - Pact sources on test class: @au.com.dius.pact.provider.junitsupport.loader.PactSource(au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader.class) java.lang.NoSuchMethodError: 'au.com.dius.pact.provider.junitsupport.loader.PactLoader au.com.dius.pact.provider.ProviderUtils.instantiatePactLoader(au.com.dius.pact.provider.junitsupport.loader.PactSource, java.lang.Class, java.lang.annotation.Annotation)'
u
Make sure you are not mixing different versions of Pact-JVM libraries. You need to check all your project dependencies
a
I fixed one version mismatch and now both consumer and provider use 4.3.14 which goes past that error. I see my consumer is 'null'. How/where do I correct it? Another issue is that it picks up wrong url for PactBroker as localhost:9292 not my pact broker as @PactBroker(url = "${PACT_BROKER_BASE_URL}", providerTags = {"latest", "dev", "prod"}, enablePendingPacts = "true", authentication = @PactBrokerAuth(username = "${PACT_BROKER_USERNAME}", password = "${PACT_BROKER_PASSWORD}")) 183203.004 [main] DEBUG au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider - Verifying pacts for provider 'cx-switch-device-health' and consumer 'null' 183203.378 [main] DEBUG au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider - Pact sources on test class: @au.com.dius.pact.provider.junitsupport.loader.PactSource(au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader.class) 183203.379 [main] DEBUG au.com.dius.pact.provider.ProviderUtils - Pact source does not have a constructor with one argument of type Class 183203.403 [main] DEBUG au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader - Loading pacts from pact broker for provider cx-switch-device-health and consumer version selectors [] 183203.408 [main] DEBUG au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader - Authentication: Basic 183203.416 [main] DEBUG au.com.dius.pact.core.pactbroker.HalClient - Fetching: / 183203.618 [main] DEBUG org.apache.hc.client5.http.impl.classic.InternalHttpClient - ex-0000000001 preparing request execution 183203.623 [main] DEBUG org.apache.hc.client5.http.protocol.RequestAddCookies - null Cookie spec selected: strict 183203.626 [main] DEBUG org.apache.hc.client5.http.protocol.RequestAuthCache - null Auth cache not set in the context 183203.627 [main] DEBUG org.apache.hc.client5.http.impl.classic.ProtocolExec - ex-0000000001 target auth state: UNCHALLENGED 183203.627 [main] DEBUG org.apache.hc.client5.http.impl.classic.ProtocolExec - ex-0000000001 proxy auth state: UNCHALLENGED 183203.627 [main] DEBUG org.apache.hc.client5.http.impl.classic.ConnectExec - ex-0000000001 acquiring connection with route {}->http://localhost:9292
u
Don't worry about the consumer, it will fetch all pacts for the provider by default
Check the
PACT_BROKER_BASE_URL
environment variable
a
Thanks to @uglyog all pacts are retrieved despite of consumer 'null'. On env vars, not sure what caused them, I moved them from alias file into .bashrc and they work now, real fix or just coincident?