由于IPv6,Avro工具无法从json转换
我正在尝试使用avro工具(1.7.7)将一个简单的json文件转换为avro 我一直在运行的命令由于IPv6,Avro工具无法从json转换,json,dns,ipv6,avro,Json,Dns,Ipv6,Avro,我正在尝试使用avro工具(1.7.7)将一个简单的json文件转换为avro 我一直在运行的命令 java -jar ~/Downloads/avro-tools-1.7.7.jar fromjson --schema-file src/main/avro/twitter.avsc tweet.json > tweet.avro 在这个模式上 { "type": "record", "name": "tweet", "namespace": "co.feeb.avro", "fiel
java -jar ~/Downloads/avro-tools-1.7.7.jar fromjson
--schema-file src/main/avro/twitter.avsc tweet.json > tweet.avro
在这个模式上
{
"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"
}
运行此命令后,我看到此异常:
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)
线程“main”java.lang.ExceptionInInitializeError中的异常
位于org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:189)
位于org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:159)
位于org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroupInformation.java:216)
位于org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:409)
位于org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:395)
位于org.apache.hadoop.fs.FileSystem$Cache$Key.(FileSystem.java:1436)
位于org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1337)
位于org.apache.hadoop.fs.FileSystem.get(FileSystem.java:244)
位于org.apache.hadoop.fs.FileSystem.get(FileSystem.java:122)
位于org.apache.hadoop.fs.FileSystem.get(FileSystem.java:228)
位于org.apache.hadoop.fs.Path.getFileSystem(Path.java:187)
位于org.apache.avro.tool.Util.openFromFS(Util.java:88)
位于org.apache.avro.tool.DataFileWriteTool.run(DataFileWriteTool.java:82)
位于org.apache.avro.tool.Main.run(Main.java:84)
位于org.apache.avro.tool.Main.Main(Main.java:73)
原因:java.lang.NumberFormatException:对于输入字符串:“810d:340:1770::1”
位于java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
在java.lang.Integer.parseInt(Integer.java:580)处
在java.lang.Integer.parseInt(Integer.java:615)
位于com.sun.jndi.dns.DnsClient.(DnsClient.java:127)
位于com.sun.jndi.dns.Resolver。(Resolver.java:61)
位于com.sun.jndi.dns.DnsContext.getResolver(DnsContext.java:573)
位于com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434)
位于com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235)
位于com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141)
位于com.sun.jndi.toolkit.url.GenericURLDirContext.getAttributes(GenericURLDirContext.java:103)
位于sun.security.krb5.KrbServiceLocator.getKerberosService(KrbServiceLocator.java:85)
位于sun.security.krb5.Config.checkRealm(Config.java:1120)
位于sun.security.krb5.Config.getRealmFromDNS(Config.java:1093)
位于sun.security.krb5.Config.getDefaultRealm(Config.java:987)
位于org.apache.hadoop.security.KerberosName.(KerberosName.java:81)
尝试使用-Djava.net.preferIPv4Stack=true将IPv4优先于IPv6没有帮助。(我正在运行Mac OSX 10.10.3和Java 1.8.0_25-b17)。哦,快照。。。我已经解决了自己的权利后,张贴这一点。我的本地路由器向我的本地计算机添加了一个IPv6名称服务器
手动将分配的名称服务器更改为Google的8.8.8.8解决了此问题。除了“正常”的Google 8.8.8.8和8.8.4.4之外,Google还有IPv6名称服务器:2001:4860:4860::8888和2001:4860:4860::8844。如果两个网络堆栈都已配置,那么现代操作系统将更喜欢IPv6而不是IPv4。是的,但问题是所使用的Java库似乎不支持IPv6