3

I get the following Exception when i use the Primefaces Maven Repository

mvn clean spring-boot:run

[ERROR] Failed to execute goal on project Passwortmanager: Could not resolve dependencies for project org.dominik:Passwortmanager:jar:2.0.3: Failed to collect dependencies at org.primefaces.themes:all-themes:jar:1.0.10: Failed to read artifact descriptor for org.primefaces.themes:all-themes:jar:1.0.10: Could not transfer artifact org.primefaces.themes:all-themes:pom:1.0.10 from/to prime-repo (https://repository.primefaces.org): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

My POM.xml

    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.dominik</groupId>
        <artifactId>Passwortmanager</artifactId>
        <packaging>jar</packaging>
        <version>2.0.3</version>


        <repositories>

            <repository>
                <id>prime-repo</id>
                <name>PrimeFaces Maven Repository</name>
                <url>https://repository.primefaces.org</url>
                <layout>default</layout>
            </repository>
            <repository>
                <id>spring-snapshots</id>
                <name>Spring Snapshots</name>
                <url>https://repo.spring.io/libs-snapshot</url>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
     <dependencies>

        <dependency>
            <groupId>org.primefaces.themes</groupId>
            <artifactId>all-themes</artifactId>
            <version>${primefaces.theme.version}</version>
        </dependency>
    </dependencies>
 <finalName>Passwortmanager</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

The official Primefaces Showcase doesn't work too: https://github.com/primefaces/showcase

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Dominik
  • 67
  • 2
  • 10

3 Answers3

4

Add pom.xml:

    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>all-themes</artifactId>
        <version>1.0.10</version>
    </dependency>

<repositories>
    <repository>  
        <id>primefaces-maven-repository</id>  
        <name>PrimeFaces Maven Repository</name>  
        <url>https://repository.primefaces.org</url>  
    </repository>
</repositories>

Run Maven -> Update Project (check Force Update)

Alternative solution:

  1. Remove repository PrimeFaces (https://repository.primefaces.org) pom.xml
  2. Download JAR Theme: https://repository.primefaces.org/org/primefaces/themes/all-themes/1.0.10/all-themes-1.0.10.jar
  3. Run command (command-line or IDE): mvn install:install-file -Dfile=all-themes-1.0.10.jar -DgroupId=org.primefaces.themes -DartifactId=all-themes -Dversion=1.0.10 -Dpackaging=jar
  4. Maven - Update Project
  • 2
    This is not a solution to the problem, but at least it is a useful work-around until the main problem is resolved. – Keppil Mar 15 '17 at 14:20
  • This i s gut workaround, but i want a stable solution. I add a ticket to the github repository of primefaces. Thank you to all of you – Dominik Mar 15 '17 at 17:42
  • you need to have updated CA certificates. I noticed this on the Mac but not on Windows or Linux (via ca-certificates) – Archimedes Trajano May 07 '17 at 19:22
4

On Mac and Windows, update your JDK from Oracle, for sure java full version "1.8.0_131-XXX" works on the Mac and Windows. Mac and Windows versions of the JDK generally do not use the system certificate stores instead they have their own.

For Linux, apt-get ca-certificates which will in turn update the Java certificates if you had the ca-certificates-java installed.

The new certificates will work with repository.primefaces.org

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
0

To make it simple, websites/services which are providing their services through a secure channel (secure http/https), need to have their certification added so their clients can trust them.

The repository "https://repository.primefaces.org" uses let's encrypt certification. The funny thing is that usually, you can open the link in a browser but java throws security exceptions, that is because it stores its certificates in a separate place (this is the case for me: Windows7, Oracle java 1.8.0_92). It stores certifications in the {jre_PATH}/lib/security.

However, you should note that there are two jre directories and since we use JDK at build time, therefore we should add the new certificate to jre in the jdk directory.

To add the new certification open "https://repository.primefaces.org" in a browser (firefox) and export certification. (I chose X.509 certification with chain), Then you need to add it in keystore:

keytool -keystore cacerts -importcert -file [NAME_OF_CERT_FILE]

Then enter the pass (default pass is "changeit")

That is it :)

Mr.Q
  • 4,316
  • 3
  • 43
  • 40
  • This is too complex. The issuer of the PrimeFaces repo certificate is in modern jdk's. – Kukeltje Nov 20 '18 at 09:52
  • yep one obvious solution is to upgrade your JDK but when you work in a team you can't change your configurations as you wish because it might cause incompatibilities in your codebase – Mr.Q Nov 20 '18 at 10:01
  • Updating to the latest 1.8.0_xx should never be a problem. If that is scary (on development machines!!!) stop using java... ;-) – Kukeltje Nov 20 '18 at 10:08
  • I am not saying this is a big deal but I believe that upgrade/changing build configurations should be the last resort, not the first solution cause such changes might have unintended consequences. – Mr.Q Nov 20 '18 at 10:20
  • Keeping the build and test environment up to date should always be the **first** thing to do. Simply because delaying this to much (like with upgrading to modern jsf versions or more recent PrimeFaces ones) it might end up being a waaaay to big task that (with wrong reasons) it is not done at all (or switching using one of the even more changing js application frameworks) – Kukeltje Nov 20 '18 at 10:51
  • You don't give up, are you? Changing the build environment and other configuration changes are not the developers' call and in big enterprises, they are too hesitant to change. (DIDAM KE MIGAM : it means, i have seen it, that is way i am telling you) – Mr.Q Nov 20 '18 at 11:01