首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于IPv6,Avro工具无法从json转换

由于IPv6,Avro工具无法从json转换
EN

Stack Overflow用户
提问于 2015-07-01 21:28:12
回答 1查看 367关注 0票数 0

我正在尝试使用avro工具(1.7.7)将一个简单的json文件转换为avro。

我一直在运行的命令

代码语言:javascript
复制
java -jar ~/Downloads/avro-tools-1.7.7.jar fromjson 
--schema-file src/main/avro/twitter.avsc tweet.json > tweet.avro

关于这个模式

代码语言:javascript
复制
{
"type": "record",
"name": "tweet",
"namespace": "co.feeb.avro",
"fields": [
    {
        "name": "username",
        "type": "string",
        "doc": "screen name of the user on twitter.com"
    },
    {
        "name": "text",
        "type": "string",
        "doc": "the content of the user's message"
    },
    {
        "name": "timestamp",
        "type": "long",
        "doc": "unix epoch time in seconds"
    }
],
"doc": "Schema for twitter messages"
}

在运行这个命令之后,我看到了这个异常:

代码语言:javascript
复制
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:189)
at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:159)
at org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroupInformation.java:216)
at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:409)
at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:395)
at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:1436)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1337)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:244)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:122)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:228)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:187)
at org.apache.avro.tool.Util.openFromFS(Util.java:88)
at org.apache.avro.tool.DataFileWriteTool.run(DataFileWriteTool.java:82)
at org.apache.avro.tool.Main.run(Main.java:84)
at org.apache.avro.tool.Main.main(Main.java:73)

Caused by: java.lang.NumberFormatException: For input string: "810d:340:1770::1"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at com.sun.jndi.dns.DnsClient.<init>(DnsClient.java:127)
at com.sun.jndi.dns.Resolver.<init>(Resolver.java:61)
at com.sun.jndi.dns.DnsContext.getResolver(DnsContext.java:573)
at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141)
at com.sun.jndi.toolkit.url.GenericURLDirContext.getAttributes(GenericURLDirContext.java:103)
at sun.security.krb5.KrbServiceLocator.getKerberosService(KrbServiceLocator.java:85)
at sun.security.krb5.Config.checkRealm(Config.java:1120)
at sun.security.krb5.Config.getRealmFromDNS(Config.java:1093)
at sun.security.krb5.Config.getDefaultRealm(Config.java:987)
at org.apache.hadoop.security.KerberosName.<clinit>(KerberosName.java:81)

试图更喜欢IPv4而不是IPv6,使用-Djava.net.preferIPv4Stack=true并没有帮助。(我运行的是Mac 10.10.3和Java 1.8.0_25-b17)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-01 21:30:49

噢,快..。我刚发完这个就自己解决了。我的本地路由器向我的本地机器添加了一个IPv6名称服务器。

将指定的名称服务器手动更改为Google的8.8.8.8解决了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31172009

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档