2016-12-14 2 views
1

私はパックJVMコンシューマを使用してテストを書いていますし、私はテストを実行したときに、以下のエラーを取得しています: -java.lang.NoClassDefFoundErrorが:IO /ネッティー/ utilに/同時/ RejectedExecutionHandlers

コード: -

@Test 
public void createUser() throws Exception { 
    Map<String, String> responseHeaders = new HashMap<>(); 
    responseHeaders.put("Content-Type", "application/json;charset=UTF-8"); 
    PactFragment fragment = buildPublisherRequest(responseHeaders); 

    MockProviderConfig config = MockProviderConfig.createDefault(); 


    MappingJackson2HttpMessageConverter converter = getMappingConverter(); 

    RestTemplate template = new RestTemplate(Collections.<HttpMessageConverter<?>> singletonList(converter)); 
    VerificationResult result = fragment.runConsumer(config, config1 -> { 
     ConfigApplication ds = new ConfigApplication(); 
     RestApiServiceImpl rs = new RestApiServiceImpl(); 


     ReflectionTestUtils.setField(ds, "host", config.url()); 

     ReflectionTestUtils.setField(ds, "restApiService", template); 


    }); 
    if (result instanceof PactError) { 
     throw new RuntimeException(((PactError)result).error()); 
    } 
    assertEquals(ConsumerPactTest.PACT_VERIFIED, result); 
} 

上記のコードで、この行fragment.runConsumer(...)にエラーが発生しました。

エラー: -

java.lang.NoClassDefFoundError: io/netty/util/concurrent/RejectedExecutionHandlers 
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:70) 
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:65) 
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:56) 
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:48) 
    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:40) 
    at unfiltered.netty.Engine$Default$.workers(Engine.scala:22) 
    at unfiltered.netty.Engine$Default$.workers(Engine.scala:20) 
    at unfiltered.netty.Server.unfiltered$netty$Server$$workerGrp$lzycompute(Server.scala:43) 
    at unfiltered.netty.Server.unfiltered$netty$Server$$workerGrp(Server.scala:43) 
    at unfiltered.netty.Server.destroy(Server.scala:97) 
    at unfiltered.netty.Server.stop(Server.scala:91) 
    at au.com.dius.pact.consumer.UnfilteredMockProvider.stop(UnfilteredMockProvider.scala:35) 
    at au.com.dius.pact.consumer.StatefulMockProvider$$anonfun$runAndClose$1.apply(MockProvider.scala:64) 
    at au.com.dius.pact.consumer.StatefulMockProvider$$anonfun$runAndClose$1.apply(MockProvider.scala:58) 
    at scala.util.Try$.apply(Try.scala:192) 
    at au.com.dius.pact.consumer.StatefulMockProvider.runAndClose(MockProvider.scala:57) 
    at au.com.dius.pact.consumer.ConsumerPactRunner.runAndWritePact(ConsumerPactRunner.scala:31) 
    at au.com.dius.pact.model.PactFragment.duringConsumerSpec(PactFragment.scala:13) 
    at au.com.dius.pact.model.PactFragment.runConsumer(PactFragment.scala:21) 

既存の依存関係: -

<dependency> 
    <groupId>au.com.dius</groupId> 
    <artifactId>pact-jvm-consumer-junit_2.11</artifactId> 
    <version>3.3.3</version> 
    <scope>test</scope> 
</dependency> 

は、私は他の依存関係を追加する必要があるでしょうか?

この問題を解決するにはどうすればよいですか?

+0

チェックあなたはJavaのビルドに追加し、正しいjarファイルを持っている場合パス。 –

+0

これは実行時エラーです。クラスパスにはありません。コンパイルされていると仮定しています。 もう1つの理由は、コンパイル時ではなく、実行時に間接的に依存する可能性があります。 – Sid

答えて

0

nettyバージョンに問題があります。

nettyは、spring-cloud-starter-eurekaとpact-jvm-consumer_2.11の両方のバージョンで使用されます。私はpact-jvm-consumer_2.11のnetty-handlerを除外しており、エラーは今解決されています。

org.springframework.cloud:spring-cloud-starter-eureka

<dependency> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-starter-eureka</artifactId> 
    </dependency> 

+- org.springframework.cloud:spring-cloud-starter-eureka:jar:1.1.0.RELEASE:compile 
[INFO] | +- org.springframework.cloud:spring-cloud-starter:jar:1.1.0.RELEASE:compile 
[INFO] | | +- org.springframework.cloud:spring-cloud-context:jar:1.1.0.RELEASE:compile 
[INFO] | | | \- org.springframework.security:spring-security-crypto:jar:4.1.3.RELEASE:compile 
[INFO] | | +- org.springframework.cloud:spring-cloud-commons:jar:1.1.0.RELEASE:compile 
[INFO] | | \- org.springframework.security:spring-security-rsa:jar:1.0.1.RELEASE:compile 
[INFO] | |  \- org.bouncycastle:bcpkix-jdk15on:jar:1.47:compile 
[INFO] | |  \- org.bouncycastle:bcprov-jdk15on:jar:1.47:compile 
[INFO] | +- org.springframework.cloud:spring-cloud-netflix-core:jar:1.1.0.RELEASE:compile 
[INFO] | +- org.springframework.cloud:spring-cloud-netflix-eureka-client:jar:1.1.0.RELEASE:compile 
[INFO] | +- com.netflix.eureka:eureka-client:jar:1.4.6:compile 
[INFO] | | +- org.codehaus.jettison:jettison:jar:1.3.7:runtime 
[INFO] | | | \- stax:stax-api:jar:1.0.1:runtime 
[INFO] | | +- com.netflix.netflix-commons:netflix-eventbus:jar:0.3.0:runtime 
[INFO] | | +- com.netflix.archaius:archaius-core:jar:0.7.4:compile 
[INFO] | | +- javax.ws.rs:jsr311-api:jar:1.1.1:runtime 
[INFO] | | +- com.netflix.servo:servo-core:jar:0.10.1:runtime 
[INFO] | | | \- com.netflix.servo:servo-internal:jar:0.10.1:runtime 
[INFO] | | +- com.sun.jersey:jersey-core:jar:1.19.1:runtime 
[INFO] | | +- com.sun.jersey:jersey-client:jar:1.19.1:runtime 
[INFO] | | +- com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.1:runtime 
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile 
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile 
[INFO] | | | \- commons-codec:commons-codec:jar:1.10:compile 
[INFO] | | +- com.google.inject:guice:jar:4.0:runtime 
[INFO] | | | +- javax.inject:javax.inject:jar:1:runtime 
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:runtime 
[INFO] | | \- com.netflix.governator:governator-api:jar:1.12.10:runtime 
[INFO] | +- com.netflix.eureka:eureka-core:jar:1.4.6:compile 
[INFO] | | +- com.amazonaws:aws-java-sdk-core:jar:1.10.30:runtime 
[INFO] | | +- com.amazonaws:aws-java-sdk-ec2:jar:1.10.30:runtime 
[INFO] | | +- com.amazonaws:aws-java-sdk-autoscaling:jar:1.9.3:runtime 
[INFO] | | +- com.amazonaws:aws-java-sdk-sts:jar:1.9.3:runtime 
[INFO] | | +- com.amazonaws:aws-java-sdk-route53:jar:1.9.3:runtime 
[INFO] | | +- com.netflix.governator:governator:jar:1.12.10:runtime 
[INFO] | | | +- com.netflix.governator:governator-core:jar:1.12.10:runtime 
[INFO] | | | \- org.ow2.asm:asm:jar:5.0.4:runtime 
[INFO] | | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:runtime 
[INFO] | |  +- javax.xml.stream:stax-api:jar:1.0-2:runtime 
[INFO] | |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:runtime 
[INFO] | +- org.springframework.cloud:spring-cloud-starter-archaius:jar:1.1.0.RELEASE:compile 
[INFO] | | \- commons-configuration:commons-configuration:jar:1.8:compile 
[INFO] | |  +- commons-lang:commons-lang:jar:2.6:compile 
[INFO] | |  \- commons-logging:commons-logging:jar:1.1.1:compile 
[INFO] | +- org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.1.0.RELEASE:compile 
[INFO] | | +- com.netflix.ribbon:ribbon:jar:2.1.5:compile 
[INFO] | | | +- com.netflix.ribbon:ribbon-transport:jar:2.1.5:runtime 
[INFO] | | | | +- io.reactivex:rxnetty-contexts:jar:0.4.9:runtime 
[INFO] | | | | \- io.reactivex:rxnetty-servo:jar:0.4.9:runtime 
[INFO] | | | \- io.reactivex:rxnetty:jar:0.4.9:runtime 
[INFO] | | |  +- io.netty:netty-codec-http:jar:4.0.27.Final:runtime 
[INFO] | | |  \- io.netty:netty-transport-native-epoll:jar:4.0.27.Final:runtime 
[INFO] | | |  \- io.netty:netty-common:jar:4.0.27.Final:runtime 
[INFO] | | +- com.netflix.ribbon:ribbon-core:jar:2.1.5:compile 
[INFO] | | +- com.netflix.ribbon:ribbon-httpclient:jar:2.1.5:compile 
[INFO] | | | \- com.netflix.netflix-commons:netflix-commons-util:jar:0.1.1:runtime 
[INFO] | | +- com.netflix.ribbon:ribbon-loadbalancer:jar:2.1.5:compile 
[INFO] | | | \- com.netflix.netflix-commons:netflix-statistics:jar:0.1.1:runtime 
[INFO] | | \- io.reactivex:rxjava:jar:1.1.5:compile 
[INFO] | +- com.netflix.ribbon:ribbon-eureka:jar:2.1.5:compile 
[INFO] | \- com.thoughtworks.xstream:xstream:jar:1.4.2:compile 
[INFO] |  +- xmlpull:xmlpull:jar:1.1.3.1:compile 
[INFO] |  \- xpp3:xpp3_min:jar:1.1.4c:compile 

協定-JVM-消費者junit_2.11

<dependency> 
     <groupId>au.com.dius</groupId> 
     <artifactId>pact-jvm-consumer-junit_2.11</artifactId> 
     <version>3.3.3</version> 
     <scope>test</scope> 
    <dependency> 

\- au.com.dius:pact-jvm-consumer-junit_2.11:jar:3.3.3:test 
[INFO] +- org.scala-lang:scala-library:jar:2.11.8:test 
[INFO] +- org.scala-lang:scala-compiler:jar:2.11.8:test 
[INFO] | +- org.scala-lang:scala-reflect:jar:2.11.8:test 
[INFO] | +- org.scala-lang.modules:scala-xml_2.11:jar:1.0.4:test 
[INFO] | \- org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.4:test 
[INFO] +- com.typesafe.scala-logging:scala-logging_2.11:jar:3.4.0:test 
[INFO] +- au.com.dius:pact-jvm-consumer_2.11:jar:3.3.3:test 
[INFO] | +- au.com.dius:pact-jvm-model:jar:3.3.3:test 
[INFO] | | +- io.netty:netty-handler:jar:4.0.40.Final:runtime 
[INFO] | | | +- io.netty:netty-buffer:jar:4.0.40.Final:runtime 
[INFO] | | | +- io.netty:netty-transport:jar:4.0.40.Final:runtime 
[INFO] | | | \- io.netty:netty-codec:jar:4.0.40.Final:runtime 
[INFO] | | +- com.github.zafarkhaja:java-semver:jar:0.9.0:test 
[INFO] | | +- org.codehaus.groovy.modules.http-builder:http-builder:jar:0.7.1:test 
[INFO] | | | +- net.sf.json-lib:json-lib:jar:jdk15:2.3:test 
[INFO] | | | | +- commons-beanutils:commons-beanutils:jar:1.9.2:test 
[INFO] | | | | \- net.sf.ezmorph:ezmorph:jar:1.0.6:test 
[INFO] | | | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.22:test 
[INFO] | | | | \- xerces:xercesImpl:jar:2.11.0:test 
[INFO] | | | \- xml-resolver:xml-resolver:jar:1.2:test 
[INFO] | | \- com.amazonaws:aws-java-sdk-s3:jar:1.10.30:test 
[INFO] | |  \- com.amazonaws:aws-java-sdk-kms:jar:1.10.30:test 
[INFO] | +- au.com.dius:pact-jvm-matchers_2.11:jar:3.3.3:test 
[INFO] | | \- io.gatling:jsonpath_2.11:jar:0.6.4:test 
[INFO] | +- org.codehaus.groovy:groovy-all:jar:indy:2.4.7:test 
[INFO] | +- com.googlecode.java-diff-utils:diffutils:jar:1.3.0:test 
[INFO] | +- dk.brics.automaton:automaton:jar:1.11-8:test 
[INFO] | +- com.github.mifmif:generex:jar:1.0.1:test 
[INFO] | +- net.databinder:unfiltered-netty-server_2.11:jar:0.8.4:test 
[INFO] | | +- net.databinder:unfiltered-netty_2.11:jar:0.8.4:test 
[INFO] | | | \- net.databinder:unfiltered_2.11:jar:0.8.4:test 
[INFO] | | \- net.databinder:unfiltered-util_2.11:jar:0.8.4:test 
[INFO] | \- net.databinder.dispatch:dispatch-core_2.11:jar:0.11.3:test 
[INFO] |  \- com.ning:async-http-client:jar:1.9.11:test 
[INFO] |  \- io.netty:netty:jar:3.10.0.Final:test 
[INFO] \- org.json:json:jar:20140107:test 
関連する問題