0

I am trying to generate angular based application using jhipster but I am getting PKIX path building failed when I tried to run ./mvnw. Below I have attached my application generation steps and error log. I am using macOS Mojave, node version v12.18.0, npm version 6.14.4, generator-jhipster@6.9.1. I tried the solution at so-sol but it is not working out.

$ jhipster 
INFO! Using JHipster version installed globally
INFO! Running default command
INFO! Executing jhipster:app
INFO! Options: from-cli: true


        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝

                            https://www.jhipster.tech

Welcome to JHipster v6.9.1
Application files will be generated in folder: /Users/****/Desktop/temp/ghi
 _______________________________________________________________________________________________________________

  Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/
  If you find JHipster useful, consider sponsoring the project at https://opencollective.com/generator-jhipster
 _______________________________________________________________________________________________________________

? Which *type* of application would you like to create? Monolithic application (recommended for simple projects)
? [Beta] Do you want to make it reactive with Spring WebFlux? No
? What is the base name of your application? ghi
? What is your default Java package name? com.mycompany.myapp
? Do you want to use the JHipster Registry to configure, monitor and scale your application? No
? Which *type* of authentication would you like to use? JWT authentication (stateless, with a token)
? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
? Which *production* database would you like to use? MySQL
? Which *development* database would you like to use? MySQL
? Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for a single node)
? Do you want to use Hibernate 2nd level cache? Yes
? Would you like to use Maven or Gradle for building the backend? Maven
? Which other technologies would you like to use? 
? Which *Framework* would you like to use for the client? Angular
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Default JHipster
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application English
? Please choose additional languages to install Hindi
? Besides JUnit and Jest, which testing frameworks would you like to use? Gatling, Cucumber, Protractor
? Would you like to install other generators from the JHipster Marketplace? Yes
? Which other modules would you like to use? 

Installing languages: en, hi
Git repository initialized.
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 99,999 days
    for: CN=Java Hipster, OU=Development, O=com.mycompany.myapp, L=, ST=, C=

KeyStore 'src/main/resources/config/tls/keystore.p12' generated successfully.

....
Server application generated successfully.

Run your Spring Boot application:
./mvnw

Client application generated successfully.

Start your Webpack development server with:
 npm start

  $ ./mvnw
Exception in thread "main" 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)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:320)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:258)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:641)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:460)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:360)
    at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
    at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443)
    at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421)
    at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:177)
    at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
    at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1180)
    at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1091)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
    at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
    at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:187)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:251)
    at org.apache.maven.wrapper.DefaultDownloader.downloadInternal(DefaultDownloader.java:90)
    at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:76)
    at org.apache.maven.wrapper.Installer.createDist(Installer.java:72)
    at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:121)
    at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:384)
    at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:289)
    at java.base/sun.security.validator.Validator.validate(Validator.java:264)
    at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:222)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:625)
    ... 20 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:379)
    ... 26 more

when I do mvn clean install, below error I am getting

$ mvn clean install
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/io/github/jhipster/jhipster-dependencies/3.8.0/jhipster-dependencies-3.8.0.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact io.github.jhipster:jhipster-dependencies:pom:3.8.0 from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target @ line 93, column 25
[ERROR] 'dependencies.dependency.version' for io.github.jhipster:jhipster-framework:jar is missing. @ line 105, column 21
[ERROR] 'dependencies.dependency.version' for javax.annotation:javax.annotation-api:jar is missing. @ line 109, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-cache:jar is missing. @ line 114, column 21
[ERROR] 'dependencies.dependency.version' for com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar is missing. @ line 118, column 21
[ERROR] 'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-hibernate5:jar is missing. @ line 122, column 21
[ERROR] 'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-hppc:jar is missing. @ line 126, column 21
[ERROR] 'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar is missing. @ line 130, column 21
[ERROR] 'dependencies.dependency.version' for com.h2database:h2:jar is missing. @ line 134, column 21
[ERROR] 'dependencies.dependency.version' for io.springfox:springfox-swagger2:jar is missing. @ line 139, column 21
[ERROR] 'dependencies.dependency.version' for io.springfox:springfox-bean-validators:jar is missing. @ line 143, column 21
[ERROR] 'dependencies.dependency.version' for com.zaxxer:HikariCP:jar is missing. @ line 147, column 21
[ERROR] 'dependencies.dependency.version' for org.testcontainers:mysql:jar is missing. @ line 151, column 21
[ERROR] 'dependencies.dependency.version' for javax.cache:cache-api:jar is missing. @ line 156, column 21
[ERROR] 'dependencies.dependency.version' for mysql:mysql-connector-java:jar is missing. @ line 160, column 21
[ERROR] 'dependencies.dependency.version' for org.ehcache:ehcache:jar is missing. @ line 164, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-jcache:jar is missing. @ line 168, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-jpamodelgen:jar is missing. @ line 172, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-core:jar is missing. @ line 177, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate.validator:hibernate-validator:jar is missing. @ line 181, column 21
[ERROR] 'dependencies.dependency.version' for net.logstash.logback:logstash-logback-encoder:jar is missing. @ line 191, column 21
[ERROR] 'dependencies.dependency.version' for org.mapstruct:mapstruct:jar is missing. @ line 195, column 21
[ERROR] 'dependencies.dependency.version' for org.mapstruct:mapstruct-processor:jar is missing. @ line 199, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-configuration-processor:jar is missing. @ line 204, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-loader-tools:jar is missing. @ line 209, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-actuator:jar is missing. @ line 213, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-aop:jar is missing. @ line 217, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-data-jpa:jar is missing. @ line 221, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-logging:jar is missing. @ line 225, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-mail:jar is missing. @ line 229, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-security:jar is missing. @ line 233, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-thymeleaf:jar is missing. @ line 237, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing. @ line 241, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 245, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-test:jar is missing. @ line 250, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.security:spring-security-test:jar is missing. @ line 255, column 21
[ERROR] 'dependencies.dependency.version' for org.zalando:problem-spring-web:jar is missing. @ line 274, column 21
[ERROR] 'dependencies.dependency.version' for io.jsonwebtoken:jjwt-api:jar is missing. @ line 278, column 21
[ERROR] 'dependencies.dependency.version' for io.jsonwebtoken:jjwt-impl:jar is missing. @ line 282, column 21
[ERROR] 'dependencies.dependency.version' for io.jsonwebtoken:jjwt-jackson:jar is missing. @ line 287, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-cloud-connectors:jar is missing. @ line 293, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.security:spring-security-data:jar is missing. @ line 297, column 21
[ERROR] 'dependencies.dependency.version' for io.micrometer:micrometer-registry-prometheus:jar is missing. @ line 301, column 21
[ERROR] 'dependencies.dependency.version' for io.dropwizard.metrics:metrics-core:jar is missing. @ line 305, column 21
[ERROR] 'dependencies.dependency.version' for io.cucumber:cucumber-junit:jar is missing. @ line 310, column 21
[ERROR] 'dependencies.dependency.version' for io.cucumber:cucumber-spring:jar is missing. @ line 315, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-undertow:jar is missing. @ line 922, column 29
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-devtools:jar is missing. @ line 926, column 29
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.mycompany.myapp:ghi:0.0.1-SNAPSHOT (/Users/kishorebabu.m/Desktop/temp/ghi/pom.xml) has 48 errors
[ERROR]     Non-resolvable import POM: Could not transfer artifact io.github.jhipster:jhipster-dependencies:pom:3.8.0 from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target @ line 93, column 25 -> [Help 2]
[ERROR]     'dependencies.dependency.version' for io.github.jhipster:jhipster-framework:jar is missing. @ line 105, column 21
[ERROR]     'dependencies.dependency.version' for javax.annotation:javax.annotation-api:jar is missing. @ line 109, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-cache:jar is missing. @ line 114, column 21
[ERROR]     'dependencies.dependency.version' for com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar is missing. @ line 118, column 21
[ERROR]     'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-hibernate5:jar is missing. @ line 122, column 21
[ERROR]     'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-hppc:jar is missing. @ line 126, column 21
[ERROR]     'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar is missing. @ line 130, column 21
[ERROR]     'dependencies.dependency.version' for com.h2database:h2:jar is missing. @ line 134, column 21
[ERROR]     'dependencies.dependency.version' for io.springfox:springfox-swagger2:jar is missing. @ line 139, column 21
[ERROR]     'dependencies.dependency.version' for io.springfox:springfox-bean-validators:jar is missing. @ line 143, column 21
[ERROR]     'dependencies.dependency.version' for com.zaxxer:HikariCP:jar is missing. @ line 147, column 21
Madasu K
  • 1,813
  • 2
  • 38
  • 72
  • run mvn clean install and let me know if you are getting the same issue – Jaskaran Singh Jun 10 '20 at 07:38
  • Also post the logs with ./mvnw debug options – Jaskaran Singh Jun 10 '20 at 07:41
  • @Madasu : the exception says the server your are trying to connect to has offered a trust chain but yours i.e. client's truststore doesn't have that trusted path. I would suggest that you check the signers in your truststore and then match with servers. use -Djavax.net.debug=all for this – Sagar Kharab Jun 10 '20 at 07:54
  • @JaskaranSingh, I have updated the question with mvn clean install error log too. I am not sure what you mean by ./mvnw debug options. I tried ./mvnw -X and ./mvnw -e but it is just displaying Exception in thread "main" javax.net.ssl.SSLHandshakeException: PKIX path building failed: error which I have posted in the question – Madasu K Jun 10 '20 at 07:57
  • @SagarKharab, could you please send me the details where exactly I need to make the changes and where I need to add -Djavax.net.debug=all? – Madasu K Jun 10 '20 at 08:01
  • use -Djavax.net.debug=all as vm argument when starting applicaiton. Google it, there are plenty of example. Once you run again you will see a lot of details and there would be Server Hello done. Client Hello done similar to ``` curl -vvk ``` and try to find that in your logs. There would be a server chain generally 3 level Root > Intermediate > Server Node. See if those entries are present in your own keystore or not using ```keytool -v -list -keystore /path/to/keystore – Sagar Kharab Jun 10 '20 at 08:10
  • I am not sure why jhipster generated application is not handling all these by default. Let me try your solution – Madasu K Jun 10 '20 at 13:37

1 Answers1

0

Explaination: I have faced this error in the passt. It usually happens when a self signed certificates enters in your ssl certificate chain. You are getting error when downloading artifact from Maven central (https://repo.maven.apache.org/maven2). The maven central uses a certificate signed from a certification authority . We never have to add this certificate manually because those certification authorities are already configured in our trustore. Now when you are trying to access maven central by running mvn clean install , it is using your custom truststore instead of using it from certificate authority.

Solutions: 1.You can try to run mvn clean install using your IDE which should use it own maven instead of your custom installation. 2.You can try running it on machine which should confirm my explanation. 3. Check if you have any mavenrc file which had MVN_OPTS configured , just comment that MVN_OPTS. 4.Look if you have added any certificates in your java installation recently.

5.Last you can instruct maven disregard ssl errors using these options

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
  • Yes Jaskaran Singh, some time back I have added a certificate for one project as per their documentation on my Mac, but right now I could not recollect those steps. Could you please tell me how can I figure out that newly added certificate and remove it so that it can use from certificate authority instead custom truststore – Madasu K Mar 16 '21 at 09:11