Hortonworks教程构建因sun.security.provider.certpath.SunCertPathBuilderException而失败

时间:2016-07-26 11:18:55

标签: maven certificate apache-kafka apache-storm hortonworks-data-platform

我正在尝试构建"流模拟器"来自" HADOOP中的实时事件处理与NIFI,KAFKA和STORM" Hortonworks教程尤其来自其" LAB 0:INAP,ROUTE和LAND实时活动以及APACHE NIFI"。

http://hortonworks.com/hadoop-tutorial/realtime-event-processing-nifi-kafka-storm/#stream-simulator-lab0

为了让您大致了解这是什么,这里是来自Hortoworks页面的描述:"流模拟器是一个生成卡车事件数据的轻量级框架。模拟器使用纽约市卡车路线(kml),其定义具有纬度和经度信息的驾驶员道路路径。 模拟器使用Akka来简化并发,消息传递和继承。它有两个Plain Old Java Objects(POJOS),一个用于Trucks,另一个用于生成事件的Drivers。"

当我尝试按照最新Hortonworks Sandbox(HDP 2.4)的指示在构建结束时构建模拟器Maven报告此错误:

[ERROR] Failed to execute goal on project storm-kafka-0.8-plus: 
Could not resolve dependencies for project net.wurstmeister.storm:
storm-kafka-0.8-plus:jar:0.4: Failed to collect dependencies at org.apache.storm:storm-core:jar:
0.9.1-incubating -> clj-time:clj-time:jar:0.4.1: 
Failed to read artifact descriptor for clj-time:clj-time:jar:0.4.1: 
Could not transfer artifact clj-time:clj-time:pom:0.4.1 from/to clojars (https://clojars.org/repo/): 
sun.security.validator.ValidatorException: PKIX path building failed:    
sun.security.provider.certpath.SunCertPathBuilderException: 
unable to find valid certification path to requested target

更详细(maven -e)揭示了这些错误详情:

...
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 sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1454)
    ... 74 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
    ... 80 more

这是pom.xml导致构建错误:

<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     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>com.hortonworks</groupId>
<artifactId>storm-demo</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>Storm Demo Parent Project</name>

<modules>
    <module>transport-domain</module>
    <module>stream-simulator</module>
    <module>storm-streaming</module>
    <module>storm-demo-webapp</module>
    <module>storm-kafkaplus</module>
    <!-- <module>iot-integration-tester</module> -->
</modules>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

任何想法如何解决这个问题?请帮忙!

更新:下一次构建错误

修复证书问题后,我现在有下一个错误:

[INFO] ------------------------------------------------------------------------
[INFO] Building Storm Demo Parent Project 1.0
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-compiler-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] transport-domain ................................... SUCCESS [  2.233 s]
[INFO] stream-simulator ................................... SUCCESS [  3.694 s]
[INFO] storm-streaming .................................... SUCCESS [01:13 min]
[INFO] storm-demo-webapp .................................. SUCCESS [  8.642 s]
[INFO] storm-kafka-0.8-plus ............................... SUCCESS [ 17.440 s]
[INFO] Storm Demo Parent Project .......................... FAILURE [  0.171 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:45 min
[INFO] Finished at: 2016-07-26T14:15:46+00:00
[INFO] Final Memory: 119M/826M
[INFO] ------------------------------------------------------------------------
[ERROR] Error resolving version for plugin 'org.apache.maven.plugins:maven-compiler-plugin' from the repositories [local (/root/.m2/repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository 

1 个答案:

答案 0 :(得分:0)

您的maven插件正在尝试连接到https远程存储库,即https://clojars.org/repo/

你可以使用这篇文章中的一个解决方案:

Problems using Maven and SSL behind proxy

我推荐的解决方案是:

(步骤可能因浏览器而异)

  • 使用浏览器(使用Chrome)转到https://clojars.org/repo/
  • 点击锁定图标,然后选择&#34;详情&#34;然后单击&#34;查看证书&#34;
  • 转到&#34;细节&#34;选项卡,然后选择&#34;复制到文件&#34;
  • 选择类型&#34; Base 64 X.509(.CER)&#34;并将其保存在某个地方
  • 现在打开命令提示符并键入(使用您自己的路径):

    keytool -import -file C:\temp\mavenCert.cer -keystore C:\temp\mavenKeystore

  • 现在您可以使用参数

    再次运行该命令

    -Djavax.net.ssl.trustStore=C:\temp\mavenKeystore

  • 在linux下使用绝对路径

    -Djavax.net.ssl.trustStore=/tmp/mavenKeystore

现在您可以将maven build运行为:

/root/maven/bin/mvn clean package -Djavax.net.ssl.trustStore=C:\temp\mavenKeystore