由于输入字符串的 java.lang.NumberFormatException 导致 Apache Tez 作业失败:“30s”

Posted

技术标签:

【中文标题】由于输入字符串的 java.lang.NumberFormatException 导致 Apache Tez 作业失败:“30s”【英文标题】:Apache Tez Job fails due to java.lang.NumberFormatException for input string: "30s" 【发布时间】:2020-04-22 16:05:47 【问题描述】:

我正在尝试在 tez 上对 Apache hive 执行查询,但不知何故我收到如下错误,我不知道如何解决它

    Apache Hadoop 3.1.1 Apache Hive 3.1.0 Apache Tez 0.9.1

我的 tez-site.xml


    <configuration>
        <property>
            <name>tez.lib.uris</name>
            <value>hdfs://localhost:8020/apps/apache-tez-0.9.1-bin/share/tez.tar.gz</value>
        </property>
        <property>
            <name>tez.staging-dir</name>
            <value>/tmp/$user.name/staging</value>
        </property>
    <configuration>

020-04-22 21:08:55,530 [INFO] [main] |shim.HadoopShimsLoader|: Trying to locate HadoopShimProvider for hadoopVersion=2.7.0, majorVersion=2, minorVersion=7
2020-04-22 21:08:55,531 [INFO] [main] |shim.HadoopShimsLoader|: Picked HadoopShim org.apache.tez.hadoop.shim.HadoopShim27, providerName=org.apache.tez.hadoop.shim.HadoopShim25_26_27Provider, overrideProviderViaConfig=null, hadoopVersion=2.7.0, majorVersion=2, minorVersion=7
2020-04-22 21:08:55,551 [INFO] [main] |app.DAGAppMaster|: AM Level configured TaskSchedulers: [0:TezYarn:null],[1:TezUber:null]
2020-04-22 21:08:55,551 [INFO] [main] |app.DAGAppMaster|: AM Level configured ContainerLaunchers: [0:TezYarn:null],[1:TezUber:null]
2020-04-22 21:08:55,551 [INFO] [main] |app.DAGAppMaster|: AM Level configured TaskCommunicators: [0:TezYarn:null],[1:TezUber:null]
2020-04-22 21:08:55,551 [INFO] [main] |app.DAGAppMaster|: Comparing client version with AM version, clientVersion=0.9.1, AMVersion=0.9.1
2020-04-22 21:08:55,633 [INFO] [main] |service.AbstractService|: Service org.apache.tez.dag.app.DAGAppMaster failed in state INITED; cause: java.lang.NumberFormatException: For input string: "30s"
java.lang.NumberFormatException: For input string: "30s"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:589)
    at java.lang.Long.parseLong(Long.java:631)
    at org.apache.hadoop.conf.Configuration.getLong(Configuration.java:1311)
    at org.apache.hadoop.hdfs.DFSClient$Conf.<init>(DFSClient.java:502)
    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:637)
    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:619)
    at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:149)
    at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2653)
    at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:92)
    at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2687)
    at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2669)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371)
    at org.apache.hadoop.fs.Path.getFileSystem(Path.java:295)
    at org.apache.tez.common.TezCommonUtils.getTezBaseStagingPath(TezCommonUtils.java:87)
    at org.apache.tez.common.TezCommonUtils.getTezSystemStagingPath(TezCommonUtils.java:146)
    at org.apache.tez.dag.app.DAGAppMaster.serviceInit(DAGAppMaster.java:492)
    at org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
    at org.apache.tez.dag.app.DAGAppMaster$9.run(DAGAppMaster.java:2662)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
    at org.apache.tez.dag.app.DAGAppMaster.initAndStartAppMaster(DAGAppMaster.java:2659)
    at org.apache.tez.dag.app.DAGAppMaster.main(DAGAppMaster.java:2464)
2020-04-22 21:08:55,636 [WARN] [main] |service.AbstractService|: When stopping the service org.apache.tez.dag.app.DAGAppMaster : java.lang.NullPointerException
java.lang.NullPointerException

【问题讨论】:

【参考方案1】:

尝试在 hdfs-site.xml 中添加此属性

<property>
    <name>dfs.client.datanode-restart.timeout</name>
    <value>30</value>
</property>

【讨论】:

【参考方案2】:

感谢您的回复..我已经检查了我的 hdfs-site.xml 没有设置表明将值指定为“30s”。

<property>
        <name>dfs.replication</name>
        <value>1</value>
</property>
<property>
    <name>dfs.namenode.name.dir</name>
    <value>file:///hadoopdata/hdfs/namenode</value>
</property>
<property>
    <name>dfs.datanode.data.dir</name>
    <value>file:///hadoopdata/hdfs/datanode</value>
</property>
<property>
    <name>dfs.blocksize</name>
    <value>268435456</value>
</property>
<property>
    <name>dfs.blocksize</name>
    <value>268435456</value>
</property>
<property>
    <name>dfs.namenode.handler.count</name>
    <value>100</value>
</property>
<property>
    <name>dfs.permissions.superusergroup</name>
    <value>hadoop</value>
    <description>The name of the group of super-users.</description>
</property>

【讨论】:

就我而言,“30s”没有设置,但正如@alen 建议的那样,添加属性然后它就可以工作了。 (相同版本的 Hadoop - 3.1.1) 问题在于默认值,显然是30s【参考方案3】:

属性dfs.client.datanode-restart.timeout 的默认值为30s。 This issue is related.

Here 提到了一种解决方法。它对我有用。

【讨论】:

以上是关于由于输入字符串的 java.lang.NumberFormatException 导致 Apache Tez 作业失败:“30s”的主要内容,如果未能解决你的问题,请参考以下文章

Java泛型Number能比较大小吗?

JDK源码分析-Integer

JDK源码分析-Integer

J2EE面试题集锦

2.20专项测试复盘

Java中 intValue,parseInt,Valueof