java.lang.IncompatibleClassChangeError:在docker compose中运行junit时

时间:2017-07-03 08:29:06

标签: amazon-web-services junit amazon-dynamodb docker-compose

我正在使用docker-compose测试我的应用程序,其中包含DynamoDB作为内部container.docker-compose文件,如下所示:

version: '2'
services:
  appName:
    mem_limit: 1024m
    build:
      dockerfile: dockerfile.test
      context: .
    ports:
        - "8090:8090"
    env_file:
        - env/test.env
    depends_on:
      - redis
      - postgres
      - dynamodb
      - memcached
    entrypoint: "./bin/entrypoint.sh"

  redis:
    image: "redis:alpine"

  postgres:
    image: "postgres:9.6-alpine"

  dynamodb:
    image: "tutum/dynamodb:latest"
    ports:
      - "8000:8000"
    hostname: dynamodb

  memcached:
   image: "memcached:alpine"

在构建代码时,我遇到以下错误:

  

java.lang.IncompatibleClassChangeError:类com.amazonaws.http.conn.ssl.SdkTLSSocketFactory未在org.apache.http.impl.conn.DefaultClientConnectionOperator中实现请求的接口org.apache.http.conn.scheme.SchemeSocketFactory .openConnection(DefaultClientConnectionOperator.java:165)org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)org .apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)org.apache.http.impl.client.CloseableHttpClient .execute(CloseableHttpClient.java:82)org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:837)com.amazonaws.http .AmazonHttpClient.executeHelper(AmazonHttpClient.java:6 07)

     

com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:376)com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:338)com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:287 )com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:2000)com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:1970)com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.getItem(AmazonDynamoDBClient) .java:1329)com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.load(DynamoDBMapper.java:433)com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.load(DynamoDBMapper.java:496)com.amazonaws.services .dynamodbv2.datamodeling.DynamoDBMapper.load(DynamoDBMapper.java:400)

1 个答案:

答案 0 :(得分:0)

使其运行所需的修复是将dynamodb的主机名从dynamodb更改为http://dynamodb,在docker文件中