quarkus: Cannot build with OpenJ9 for missing BouncyCastle dependency with K8S dependency present

Describe the bug

> Task :quarkusBuild FAILED
building quarkus jar

Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
  	[error]: Build step io.quarkus.kubernetes.client.deployment.KubernetesClientBuildStep#process threw an exception: io.fabric8.kubernetes.client.KubernetesClientException: JcaPEMKeyConverter is provided by BouncyCastle, an optional dependency. To use support for EC Keys you must explicitly add this dependency to classpath.
  	at io.fabric8.kubernetes.client.internal.CertUtils.handleECKey(CertUtils.java:163)
  	at io.fabric8.kubernetes.client.internal.CertUtils.loadKey(CertUtils.java:133)
  	at io.fabric8.kubernetes.client.internal.CertUtils.createKeyStore(CertUtils.java:113)
  	at io.fabric8.kubernetes.client.internal.CertUtils.createKeyStore(CertUtils.java:245)
  	at io.fabric8.kubernetes.client.internal.SSLUtils.keyManagers(SSLUtils.java:128)
  	at io.fabric8.kubernetes.client.internal.SSLUtils.keyManagers(SSLUtils.java:122)
  	at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:120)
  	at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:63)
  	at io.fabric8.kubernetes.client.BaseClient.<init>(BaseClient.java:51)
  	at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:136)
  	at io.quarkus.kubernetes.client.runtime.KubernetesClientUtils.createClient(KubernetesClientUtils.java:46)
  	at io.quarkus.kubernetes.client.deployment.KubernetesClientBuildStep.process(KubernetesClientBuildStep.java:15)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
  	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
  	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
  	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
  	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
  	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
  	at java.base/java.lang.Thread.run(Thread.java:834)
  	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

To Reproduce

Steps to reproduce the behavior:

  1. Create arbitrary Quarkus project
  2. Build with OpenJ9

Configuration

plugins {
    id 'org.jetbrains.kotlin.jvm' version "1.3.72"
    id "org.jetbrains.kotlin.plugin.allopen" version "1.3.72"
    id 'io.quarkus'
}

repositories {
     mavenLocal()
     mavenCentral()
}

dependencies {
    implementation 'io.quarkus:quarkus-agroal'
    implementation 'io.quarkus:quarkus-cache'
    implementation 'io.quarkus:quarkus-config-yaml'
    implementation 'io.quarkus:quarkus-container-image-jib'
    implementation 'io.quarkus:quarkus-flyway'
    implementation 'io.quarkus:quarkus-hibernate-orm-panache-kotlin'
    implementation 'io.quarkus:quarkus-jdbc-h2'
    implementation 'io.quarkus:quarkus-jdbc-mariadb'
    implementation 'io.quarkus:quarkus-jdbc-mssql'
    implementation 'io.quarkus:quarkus-jdbc-mysql'
    implementation 'io.quarkus:quarkus-jdbc-postgresql'
    implementation 'io.quarkus:quarkus-kotlin'
    implementation 'io.quarkus:quarkus-kubernetes'
    implementation 'io.quarkus:quarkus-logging-json'
    implementation 'io.quarkus:quarkus-resteasy'
    implementation 'io.quarkus:quarkus-security-jpa'
    implementation 'io.quarkus:quarkus-smallrye-fault-tolerance'
    implementation 'io.quarkus:quarkus-smallrye-graphql'
    implementation 'io.quarkus:quarkus-smallrye-health'
    implementation 'io.quarkus:quarkus-vertx'
    implementation 'org.bouncycastle:bcprov-jdk15on:1.66'
    implementation 'org.bouncycastle:bcprov-ext-jdk15on:1.66'
    implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")

    testImplementation 'io.quarkus:quarkus-junit5'
    testImplementation 'io.rest-assured:kotlin-extensions'
    testImplementation 'org.bouncycastle:bcprov-jdk15on:1.66'
    testImplementation 'org.bouncycastle:bcprov-ext-jdk15on:1.66'
}

group 'org.acme'
version '1.0.0-SNAPSHOT'

quarkus {
    setOutputDirectory("$projectDir/build/classes/kotlin/main")
}

quarkusDev {
    setSourceDir("$projectDir/src/main/kotlin")
}

allOpen {
    annotation("javax.ws.rs.Path")
    annotation("javax.enterprise.context.ApplicationScoped")
    annotation("io.quarkus.test.junit.QuarkusTest")
}

java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}

compileKotlin {
    kotlinOptions.jvmTarget = JavaVersion.VERSION_11
    kotlinOptions.javaParameters = true
}

compileTestKotlin {
    kotlinOptions.jvmTarget = JavaVersion.VERSION_11
}
test {
    systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
}

Environment (please complete the following information):

  • Output of uname -a or ver: Microsoft Windows [Version 10.0.19042.541]
  • Output of java -version:
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.21.0, JRE 14 Windows 10 amd64-64-Bit Compressed References 20200715_148 (JIT enabled, AOT enabled)
OpenJ9   - 34cf4c075
OMR      - 113e54219
JCL      - 1d231bd6a2 based on jdk-14.0.2+12)
  • Quarkus version or git rev: 1.8.1.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
Picked up _JAVA_OPTIONS: -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions
Initialized native services in: C:\Users\Steve\.gradle\native

------------------------------------------------------------
Gradle 6.5.1
------------------------------------------------------------

Build time:   2020-06-30 06:32:47 UTC
Revision:     66bc713f7169626a7f0134bf452abde51550ea0a

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.8 (GraalVM Community 11.0.8+10-jvmci-20.2-b03)
OS:           Windows 10 10.0 amd64

Additional context (Add any other context about the problem here.)

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Hit same thing with BasicJavaLibraryModuleTest integration test on OpenJDK 11 & 17 (HotSpot) and Quarkus 2.8.1/main. I had EC key in ~/.kube/config and test failed with io.fabric8.kubernetes.client.KubernetesClientException: JcaPEMKeyConverter is provided by BouncyCastle, an optional dependency. To use support for EC Keys you must explicitly add this dependency to classpath. So removing ~/.kube/config (or removing relevant context helps.

I haven’t been able to reproduce the issue with that project using the latest OpenJ9 release:

$ java -version
openjdk version "15" 2020-09-15
OpenJDK Runtime Environment AdoptOpenJDK (build 15+36)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.22.0, JRE 15 Mac OS X amd64-64-Bit Compressed References 20200922_45 (JIT enabled, AOT enabled)
OpenJ9   - 1830b1927
OMR      - 73d5e7623
JCL      - 7e7613c015 based on jdk-15+36)

Both ./gradlew quarkusDev & ./gradlew quarkusBuild both succeed. Any other hints you can provide on reproducing the issue?