Error while using Pact Broker with PactRunner in jvm provider junit

740 views
Skip to first unread message

aravind....@itv.com

unread,
Dec 14, 2016, 9:46:24 AM12/14/16
to Pact Support
Hi there,

Just wondering if anyone could help me out with this please?

We were using pact-jvm-provider-junit_2.11 version 3.2.8 in mvn style to write some provider side Junit tests.
The Junit version we are using is 4.12

The tests were working like charm with using PactRunner class and PactFolder annotation using local pact files. All good.

We thought of trying the pact broker and have setup one.
I can access the pact files on broker by hitting the url with port 80 using CURL and also can access the pact files using a browser.
The url I'm hitting is of format http://pactbroker.yy.xx.zzz.com

Please note that the consumer name has a space in its name.

The annotations we are using with the test is as below,

@RunWith(PactRunner.class)
@Provider("pname") 
@PactBroker(host = "pactbroker.yy.xx.zzz.com", port = "80")

When we tried to change to PactBroker annotation as above we get the following error, 

java.lang.Exception: Error while creating pact source
at org.junit.runners.model.InitializationError.<init>(InitializationError.java:38)
at au.com.dius.pact.provider.junit.PactRunner.getPactSource(PactRunner.java:126)
at au.com.dius.pact.provider.junit.PactRunner.<init>(PactRunner.java:70)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


Our pom file looks as below,

 <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
     <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
 </plugin>
</plugins>
</build>
  <dependencies>
  <dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
   <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.12</version>
     <scope>test</scope>
   </dependency>
   
  <dependency>
     <groupId>au.com.dius</groupId>
     <artifactId>pact-jvm-provider-junit_2.11</artifactId>
     <version>3.2.8</version>
     <scope>test</scope>
     <exclusions>
      <exclusion>
      <artifactId>guava</artifactId>
      <groupId>com.google.guava</groupId>
      </exclusion>
     </exclusions>
  </dependency> 
  </dependencies>

Any clues? Not sure what we are doing wrong here?
Any ideas as how to debug, apart from generic Initialization Error message?

Cheers
Aravind

Matt Fellows

unread,
Dec 14, 2016, 3:27:11 PM12/14/16
to aravind....@itv.com, Pact Support
Hi Aravind, do you mind please posting your question to StackOverflow (stackoverflow.com/questions/tagged/pact). We are in the process of migrating these sorts of questions there and having discussions here in Google Groups.

ITV plc (Registration No. 4967001) (ITV) is incorporated in England and Wales with its registered office at The London Television Centre, Upper Ground, London SE1 9LT. Please visit www.itv.com for further information.

This email and any attachments are intended solely for the addressee and may contain confidential, copyrighted and/or privileged information.  If you have received this message in error, please notify us and delete it.  Recipients should scan the email and any attachments for their own protection. 

This email does not conclude a binding agreement.  The views or opinions presented in this email do not necessarily represent those of ITV.

--
Pact-Support email group is being deprecated, please use StackOverflow instead to help make questions and answers more visible: http://stackoverflow.com/questions/tagged/pact
---
You received this message because you are subscribed to the Google Groups "Pact Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pact-support+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Ronald Holshausen

unread,
Dec 16, 2016, 3:09:02 AM12/16/16
to aravind....@itv.com, Pact Support
Hi Aravind,

The original error is not being propagated (I'll fix that), but it should have been logged out at ERROR log level. This will tell you what the problem is. You should be able to find it in the JUnit test report.

ITV plc (Registration No. 4967001) (ITV) is incorporated in England and Wales with its registered office at The London Television Centre, Upper Ground, London SE1 9LT. Please visit www.itv.com for further information.

This email and any attachments are intended solely for the addressee and may contain confidential, copyrighted and/or privileged information.  If you have received this message in error, please notify us and delete it.  Recipients should scan the email and any attachments for their own protection. 

This email does not conclude a binding agreement.  The views or opinions presented in this email do not necessarily represent those of ITV.

--
Pact-Support email group is being deprecated, please use StackOverflow instead to help make questions and answers more visible: http://stackoverflow.com/questions/tagged/pact
---
You received this message because you are subscribed to the Google Groups "Pact Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pact-support...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Ronald Holshausen

DiUS Computing Pty Ltd

Level 10, 99 Queens Street
Melbourne, VIC 3000

Phone: +61 3 9008 5400
Mobile: +61 413 162 439

http://www.diuscomputing.com.au
Reply all
Reply to author
Forward
0 new messages