Closed yuandanxu closed 10 months ago
Thanks for the report! You're not the only one affected - I also hit it around the same time you did, (as did this stackoverflow user). @uglyog helped me sort it out by including the dependencies.
We'll have to take a look at the dependencies of 3.5.5, but right now you can either:
Work around it by downgrading to version 3.5.4
Include the missing dependencies explicitly. For me, this was:
And here it is ready to go straight into your POM file:
<dependency>
<groupId>au.com.dius</groupId>
<artifactId>pact-jvm-matchers_2.12</artifactId>
<version>3.5.5</version>
</dependency>
<dependency>
<groupId>au.com.dius</groupId>
<artifactId>pact-jvm-model</artifactId>
<version>3.5.5</version>
</dependency>
When execute PACT JVM test case, got following error. Actually before this error, there's another scala error, after adding one scala dependency, that issue resolved, but come this one. Anyone encounter similar issue? I've added following dependency in my project.
java.lang.NoClassDefFoundError: scala/Product$class at au.com.dius.pact.model.RequestMatching.(RequestMatching.scala:7)
at au.com.dius.pact.model.RequestMatching$.apply(RequestMatching.scala:7)
at au.com.dius.pact.model.RequestMatching.apply(RequestMatching.scala)
at au.com.dius.pact.consumer.BaseMockServer.(MockHttpServer.kt:61)
at au.com.dius.pact.consumer.MockHttpServer.(MockHttpServer.kt:202)
at au.com.dius.pact.consumer.MockHttpServerKt.mockServer(MockHttpServer.kt:34)
at au.com.dius.pact.consumer.ConsumerPactRunnerKt.runConsumerTest(ConsumerPactRunner.kt:12)
at au.com.dius.pact.consumer.ConsumerPactTestMk2.testPact(ConsumerPactTestMk2.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at au.com.dius.pact.consumer.BaseProviderRule$1.evaluate(BaseProviderRule.java:59)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: scala.Product$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 33 more
Following is my pom included PACT related dependecies:
My testing Code: public class ContractTest extends ConsumerPactTestMk2 {