Certificate Exception running maven verify command using Java 1.8

Viewed 180

My JUnit test class works fine when I run it with IDE (IntelliJ IDEA). But when I try to run it with the Maven command it fails for the below exception. The Maven command is below:

mvn clean verify -Dapp-env=dev

Note : I am trying to connect to Kafka with TLS enabled and the ca-cert.pem is already added to the JDK (inside JRE).

Exception:

2020-04-03 12:18:21 [pool-1-thread-5] ERROR n.t.c.steps.ConsoleLoggingListener - PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2020-04-03 12:18:23 [kafka-admin-client-thread | adminclient-2] WARN  o.a.k.c.a.i.AdminMetadataManager - [AdminClient clientId=adminclient-2] Metadata update failed due to authentication error
org.apache.kafka.common.errors.SslAuthenticationException: SSL handshake failed
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131) ~[na:na]
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:324) ~[na:na]
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:267) ~[na:na]
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:262) ~[na:na]
0 Answers
Related