How to avoid `EC parameters error` using the openjdk:7 Docker image and a Gradle wrapper?
Asked Answered
A

2

2

This Dockerfile:

FROM openjdk:7

WORKDIR /restdocs/
RUN git clone https://github.com/spring-projects/spring-restdocs.git /restdocs
RUN git checkout v1.1.2.RELEASE

RUN ./gradlew build

built with docker build . -t rest-notes results in the following error: Exception in thread "main" javax.net.ssl.SSLException: java.security.ProviderException: java.security.InvalidKeyException: EC parameters error.

What can I do in the Dockerfile to avoid this and make the Gradle wrapper work?

Amidships answered 13/12, 2017 at 9:50 Comment(0)
A
4

I was able to get around this thanks to Erich Seifert and his commit here: https://github.com/eseifert/gral/commit/c24e08a91952a99b8c8b686a1b172335db8cdf87. Updated Dockerfile that works:

FROM openjdk:7

RUN apt-get update && apt-get install sudo

# Fix the EC parameters error: (ref https://github.com/travis-ci/travis-ci/issues/8503)
RUN sudo wget "https://bouncycastle.org/download/bcprov-ext-jdk15on-158.jar" -O "${JAVA_HOME}"/jre/lib/ext/bcprov-ext-jdk15on-158.jar && \
  sudo perl -pi.bak -e 's/^(security\.provider\.)([0-9]+)/$1.($2+1)/ge' /etc/java-7-openjdk/security/java.security && \
  echo "security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider" | sudo tee -a /etc/java-7-openjdk/security/java.security

WORKDIR /restdocs/
RUN git clone https://github.com/spring-projects/spring-restdocs.git /restdocs
RUN git checkout v1.1.2.RELEASE

RUN ./gradlew build

(Never mind that the build of that spring-restdocs branch fails - that's not related to the EC parameters error:)

Amidships answered 13/12, 2017 at 9:50 Comment(2)
Did this work? Asking since you mentioned that the gradle build failed.Coset
Yes! Sorry about the confusion. It's that branch of spring-restdocs that isn't building, and that's not related to the EC parameters error. I'll edit my post to clarify this.Amidships
S
0

Upgrading to a later Maven docker image solved the problem for me. I replaced maven:3-jdk-7 with maven:3.6-jdk-11.

In my case, I had used an older sample GitLab CI script. My updated GitLab CI script now looks like:

image: maven:3.6-jdk-11

build:
  script: "mvn install -B"
Superman answered 22/7, 2020 at 6:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.