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

牧云@^-^@ 提交于 2020-08-26 04:48:16

问题


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?


回答1:


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:)




回答2:


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"


来源:https://stackoverflow.com/questions/47789963/how-to-avoid-ec-parameters-error-using-the-openjdk7-docker-image-and-a-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!