question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quarkus tests fails mTLS authentication against internal Maven repository

See original GitHub issue

Describe the bug Our internal Maven repository is using mTLS as part of the authentication, which requires a bit additional configuration of Maven. This configuration is, however, not picked up by the Quarkus bootstrapper, which then throws an exception when running test.

Expected behavior The javax.net.ssl.* properties from MAVEN_OPTS are successfully used to configure the HTTPS connection.

Actual behavior I hope, this is “clear and concise”. 🙂

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.getting.started.GreetingResourceTest
Downloading from tradeshift-public: https://maven.tradeshift.net/content/repositories/tradeshift-public/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.pom
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.131 s <<< FAILURE! - in org.acme.getting.started.GreetingResourceTest
[ERROR] org.acme.getting.started.GreetingResourceTest.testHelloEndpoint  Time elapsed: 0.003 s  <<< ERROR!
java.lang.RuntimeException: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for org.acme:getting-started::jar:1.0.0-SNAPSHOT
Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for org.acme:getting-started::jar:1.0.0-SNAPSHOT
Caused by: io.quarkus.bootstrap.resolver.maven.BootstrapMavenException: Failed to resolve dependencies for org.acme:getting-started:jar:1.0.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Failed to collect dependencies at io.quarkus:quarkus-junit5:jar:1.12.1.Final -> io.quarkus:quarkus-test-common:jar:1.12.1.Final -> io.quarkus:quarkus-jsonp-deployment:jar:1.12.1.Final -> io.quarkus:quarkus-jsonp:jar:1.12.1.Final -> org.glassfish:jakarta.json:jar:1.1.6
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at io.quarkus:quarkus-junit5:jar:1.12.1.Final -> io.quarkus:quarkus-test-common:jar:1.12.1.Final -> io.quarkus:quarkus-jsonp-deployment:jar:1.12.1.Final -> io.quarkus:quarkus-jsonp:jar:1.12.1.Final -> org.glassfish:jakarta.json:jar:1.1.6
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.glassfish:jakarta.json:jar:1.1.6
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.glassfish:jakarta.json:pom:1.1.6 from/to tradeshift-public (https://maven.tradeshift.net/content/repositories/tradeshift-public): Transfer failed for https://maven.tradeshift.net/content/repositories/tradeshift-public/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.pom
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.glassfish:jakarta.json:pom:1.1.6 from/to tradeshift-public (https://maven.tradeshift.net/content/repositories/tradeshift-public): Transfer failed for https://maven.tradeshift.net/content/repositories/tradeshift-public/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.pom
Caused by: org.apache.maven.wagon.TransferFailedException: Transfer failed for https://maven.tradeshift.net/content/repositories/tradeshift-public/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.pom
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

Notice, that all dependencies to this point have been downloaded successfully, and it is also possible to run mvn quarkus:dev.

To Reproduce

Steps to reproduce the behavior:

  1. Configure Maven to use a repository using mTLS authentication
  2. Bootstrap any Quarkus project
  3. Run mvn test

Configuration N/A

Screenshots N/A - but see the stacktrace above.

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin c02z707plvdv-c 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
  • Output of java -version:
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (Zulu 8.52.0.23-CA-macosx) (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (Zulu 8.52.0.23-CA-macosx) (build 25.282-b08, mixed mode)
  • GraalVM version (if different from Java): Not used
  • Quarkus version or git rev: 1.12.1.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/thomasvestergaardtrolle/.asdf/installs/maven/3.6.3
Java version: 1.8.0_282, vendor: Azul Systems, Inc., runtime: /Users/thomasvestergaardtrolle/.asdf/installs/java/zulu-8.52.0.23/zulu-8.jdk/Contents/Home/jre
Default locale: da_DK, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"

Additional context 🤔

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rquiniocommented, Mar 5, 2021

You might try passing the javax.net.ssl.* system properties via Maven surefire plugin <systemPropertyVariables> ? Since QuarkusTests do a Maven resolution (directly using Aether, not via Maven CLI) of the augmentation classpath, I’d imagine surefire JVM settings are taken into account.

1reaction
tveoncommented, Mar 5, 2021

Nice, that actually “just worked”. 👍

If anyone comes accros this later, then I add the following lines:

            <javax.net.ssl.keyStoreType>${javax.net.ssl.keyStoreType}</javax.net.ssl.keyStoreType>
            <javax.net.ssl.keyStore>${javax.net.ssl.keyStore}</javax.net.ssl.keyStore>
            <javax.net.ssl.keyStorePassword>${javax.net.ssl.keyStorePassword}</javax.net.ssl.keyStorePassword>

Depending on your exact setup, you might also need to add a trustStore

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running @QuarkusTest when maven repo requires SSL auth
(This answer is totally ninja'ing the information in @tveon's Quarkus tests fails mTLS authentication against internal Maven repository ...
Read more >
Learn how to do Mutual TLS in Quarkus apps
In this entry, we explore how to set mutual TLS encryption between two Quarkus applications manually. Both on bare metal and Kubernetes. What...
Read more >
Test error while building a Quarkus native. Project can't find ...
It seems like that the repos added to the distribution management in the pom.xml aren't taken into account during the tests. Expected behavior...
Read more >
Home of Quarkus Cheat-Sheet - GitHub Pages
The prefix is: quarkus.hibernate-validator . fail-fast. When fail fast is enabled the validation will stop on the first constraint violation ...
Read more >
Build a Microprofile Rest Client with Mutual TLS Authentication
Getting started. Initialize a new maven project. Set the name and the artifactId to quarkus-restclient-mutual-tls . Click on finish.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found