Oozie继续在classpath中添加旧版本的httpcore jar

时间:2016-01-19 05:48:07

标签: java hadoop oozie

我不断收到异常,因为Oozie在classpath中添加了错误版本的httpcore jar。我尝试了不同的选项,如

oozie.launcher.mapreduce.task.classpath.user.precedence
oozie.launcher.mapreduce.user.classpath.first

oozie.launcher.mapreduce.task.classpath.user.precedence完全没有响应,当我使用oozie.launcher.mapreduce.user.classpath.first时,应用程序甚至无法加载一个类。

在类路径中,我可以看到两个版本的http-core。

httpcore-4.4.1.jar
httpcore-4.2.4.jar

当应用程序以独立模式运行时,我没有得到该异常。

例外:

    Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.JavaMain], main() threw exception, java.lang.NoSuchFieldError: INSTANCE
org.apache.oozie.action.hadoop.JavaMainException: java.lang.NoSuchFieldError: INSTANCE
    at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:59)
    at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:47)
    at org.apache.oozie.action.hadoop.JavaMain.main(JavaMain.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:236)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:453)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.NoSuchFieldError: INSTANCE
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)
    at microsoft.exchange.webservices.data.core.ExchangeServiceBase.createConnectionSocketFactoryRegistry(ExchangeServiceBase.java:244)
    at microsoft.exchange.webservices.data.core.ExchangeServiceBase.initializeHttpClient(ExchangeServiceBase.java:198)
    at microsoft.exchange.webservices.data.core.ExchangeServiceBase.<init>(ExchangeServiceBase.java:174)
    at microsoft.exchange.webservices.data.core.ExchangeServiceBase.<init>(ExchangeServiceBase.java:179)
    at microsoft.exchange.webservices.data.core.ExchangeService.<init>(ExchangeService.java:3729)
    at com.sonasoft.sonacloud.email.dispatcher.conn.EwsConnection.getConnection(EwsConnection.java:16)
    at com.sonasoft.sonacloud.email.dispatcher.conn.EwsConnection.getConnection(EwsConnection.java:10)
    at com.sonasoft.sonacloud.email.dispatcher.utils.EwsOperations.<init>(EwsOperations.java:47)
    at com.sonasoft.sonacloud.email.dispatcher.utils.EwsOperations.getInstance(EwsOperations.java:53)
    at com.sonasoft.sonacloud.email.dispatcher.main.MainClass.main(MainClass.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:56)
    ... 15 more

Oozie客户端构建版本:4.2.0.2.3.2.0-2950

感谢任何帮助。

2 个答案:

答案 0 :(得分:3)

我们在HortonWorks发行版2.3.2 中遇到了这个令人讨厌的问题(对它们感到羞耻)

  • Oozie&#34;发射器&#34;工作总是得到httpcorehttpclient CLASSPATH作为Hadoop客户端的一部分
  • Oozie&#34;发射器&#34;工作总是获得httpcorehttpclient 捆绑在&#34; Oozie&#34; ShareLib
  • Hive / Hive2 Sharelibs包含httpcorehttpclient 更新版本
  • 从Hadoop的角度来看,user.classpath.first适用于两者 ShareLibs所以它有50/50的机会为每个人获得正确的订单 JAR(整体上有25/75的机会)

底线:我们必须

  1. 删除 httpcorehttpclient来自&#34; Oozie&#34; ShareLib HDFS dir(duh!)
  2. 为依赖于Hive JARS 的所有操作提出oozie.launcher.mapreduce.job.user.classpath.first标志(即Hive操作,Hive2操作,以某种方式调用JDBC驱动程序的Shell操作等)
  3. Post-scriptum - Oozie服务器在内存中保存每个ShareLib中的JAR列表,以便在服务器运行时删除JAR将触发新作业中的错误。如果您不想停止Oozie服务器,那么&#34;正确的方式&#34;更新实时ShareLib是(a)在新的带时间戳的目录中创建新版本 [查看文档...] (b )告诉服务器使用oozie admin -sharelibupdate

    重新同步更新的库

答案 1 :(得分:0)

您希望使用本地版本的httpcore JAR进行构建,但是您不希望它出现在您的类路径中,因为Hadoop将提供自己的版本。那么您应该使用provided JAR的httpcore范围:

<project>
    ...
    <dependencies>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <scope>provided</scope>           <!-- this line is important -->
            <version>4.4.1</version>
        </dependency>
    </dependencies>
</project>

来自provided的{​​{3}}:

  

这很像compile,但表示您希望JDK或容器在运行时提供依赖。