2017-06-13 114 views
0

我有一個scala jar文件,它從hive視圖中讀取數據並在hdfs中創建一個csv文件,這個jar在從CLI調用時處於Spark集羣模式,但是從Oozie的觸發工作流時,它拋出以下錯誤spark動作拋出'Classpath包含多個SLF4J綁定'來自oozie的錯誤

SLF4J : Classpath contains multiple SLF4J bindings. 
SLF4J : Found binding in [jar:file:/data/hadoop-data/9/yarn/nm/filecache/7505/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J : Found binding in [jar:file:/data/hadoop-data/1/yarn/nm/usercache/cntr/filecache/216569/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J : Found binding in [jar:file:/opt/cloudera/parcels/CDH-5.8.3-1.cdh5.8.3.p2256.2455/jars/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] 

SLF4J : Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 

我已經做了一些搜索和發現,在pom.xml中的依賴關係添加排除會做伎倆,所以下面我已經加入到我在pom.xml中排除

<exclusions> 
    <exclusion> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-log4j12</artifactId> 
    </exclusion> 
    <exclusion> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
    </exclusion> 
    <exclusion> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
    </exclusion> 
</exclusions> 

,但我依然得到同樣的錯誤觸發從Oozie的工作流程

火花罐子當任何建議,歡迎

+0

它的原因是您的類路徑中有多個'slf4j-log4j12-1.7.5.jar',就像您在錯誤中看到的一樣。我想這不是一個錯誤,它只是一個信息,不是嗎? –

+0

嗨@RameshMaharjan,它來自oozie stderr,並因爲這個火花行動是失敗的,因爲罐子在命令行界面運行時成功運行羣集 – major

回答

0

這裏是另一種方式來檢查綁定。我假設你使用eclipse進行開發,並且這是一個maven項目。

  • 轉到您的pom.xml
  • 在依賴標籤,搜索的結合,你的情況SLF4J。
  • 右鍵單擊所有並排除它們。

它的作用基本上就是像你在那裏提到的那樣向你的pom.xml添加排除塊,好處是你能夠看到這個依賴是否來自任何其他庫。

讓我知道這是否有幫助。 乾杯。

+0

您好@chitral verma我試圖尋找slf4j在依賴項選項卡中pom.xml,並沒有找到任何排除 – major

+0

而不是依賴關係選項卡你可以做同樣的依賴關係層次選項卡? –

0

這是由於多個jarsslf4j使用不同的其他人jars。更簡單的解決方案是在您的依賴項中添加最新版本或更高版本的slf4j,該版本強制只使用最新的jar,這些版本將向後兼容。

您還可以運行mvn dependency:tree和搜索SLF4J的實施和排除作爲

<exclusions> 
     <exclusion> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-log4j12</artifactId> 
     </exclusion> 
     <exclusion> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     </exclusion> 
    </exclusions> 

希望這有助於!

0

經過對日誌文件的進一步研究,我發現問題是由於hive-site.xml未正確傳遞給spark動作,spark動作期望從oozie工作流中的hive-site.xml,因爲我的spark工作包含引用配置表格。在通過hive-site.xml後,問題得到解決

謝謝大家的時間和建議。