ipipdotnet / ipdb-java

IPIP.net officially supported IP database ipdb format parsing library
Apache License 2.0
148 stars 72 forks source link

ipdb库无法解析 #3

Closed qianshangding closed 4 years ago

qianshangding commented 5 years ago

Maven版本:

net.ipip ipdb 1.1.1

采用免费版本的库-ipipfree.ipdb,报错: com.alibaba.fastjson.JSONException: syntax error, expect {, actual error, pos 0 at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:154) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer.parseRest(ASMJavaBeanDeserializer.java:96) at Fastjson_ASM_MetaData_1.deserialze(Unknown Source) at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:513) at com.alibaba.fastjson.JSON.parseObject(JSON.java:243) at com.alibaba.fastjson.JSON.parseObject(JSON.java:219) at com.alibaba.fastjson.JSON.parseObject(JSON.java:178) at com.alibaba.fastjson.JSON.parseObject(JSON.java:322) at net.ipip.ipdb.Reader.init(Reader.java:53) at net.ipip.ipdb.Reader.(Reader.java:25) at net.ipip.ipdb.Reader.(Reader.java:21) at net.ipip.ipdb.BaseStation.(BaseStation.java:17)

使用收费版本库-ipip.ipdb,报错: net.ipip.ipdb.InvalidDatabaseException: database file size error at net.ipip.ipdb.Reader.init(Reader.java:58) at net.ipip.ipdb.Reader.(Reader.java:25) at net.ipip.ipdb.Reader.(Reader.java:21) at net.ipip.ipdb.BaseStation.(BaseStation.java:17)

QQ加不进去,急,在线等~

qianshangding commented 5 years ago

机器是mac,难道和文件的类型有关?

17mon commented 5 years ago

机器是mac,难道和文件的类型有关?

与 fastjson 版本版本有关

brucenan commented 5 years ago

fastjson使用了最新的1.2.58,还是报同样的错误。 com.alibaba.fastjson.JSONException: syntax error, expect {, actual error, pos 0, fastjson-version 1.2.58 at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:489) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.parseRest(JavaBeanDeserializer.java:1537) at com.alibaba.fastjson.parser.deserializer.FastjsonASMDeserializer_1_MetaData.deserialze(Unknown Source) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:284) at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:689) at com.alibaba.fastjson.JSON.parseObject(JSON.java:378) at com.alibaba.fastjson.JSON.parseObject(JSON.java:282) at com.alibaba.fastjson.JSON.parseObject(JSON.java:555) at net.ipip.ipdb.Reader.init(Reader.java:53) at net.ipip.ipdb.Reader.<init>(Reader.java:25) at net.ipip.ipdb.Reader.<init>(Reader.java:21) at net.ipip.ipdb.City.<init>(City.java:17)

xianleizheng commented 5 years ago

fastjson使用了最新的1.2.58,还是报同样的错误。 com.alibaba.fastjson.JSONException: syntax error, expect {, actual error, pos 0, fastjson-version 1.2.58 at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:489) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.parseRest(JavaBeanDeserializer.java:1537) at com.alibaba.fastjson.parser.deserializer.FastjsonASMDeserializer_1_MetaData.deserialze(Unknown Source) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:284) at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:689) at com.alibaba.fastjson.JSON.parseObject(JSON.java:378) at com.alibaba.fastjson.JSON.parseObject(JSON.java:282) at com.alibaba.fastjson.JSON.parseObject(JSON.java:555) at net.ipip.ipdb.Reader.init(Reader.java:53) at net.ipip.ipdb.Reader.(Reader.java:25) at net.ipip.ipdb.Reader.(Reader.java:21) at net.ipip.ipdb.City.(City.java:17)

brucenan commented 5 years ago

fastjson使用了最新的1.2.58,还是报同样的错误。 com.alibaba.fastjson.JSONException: syntax error, expect {, actual error, pos 0, fastjson-version 1.2.58 at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:489) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.parseRest(JavaBeanDeserializer.java:1537) at com.alibaba.fastjson.parser.deserializer.FastjsonASMDeserializer_1_MetaData.deserialze(Unknown Source) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:284) at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:689) at com.alibaba.fastjson.JSON.parseObject(JSON.java:378) at com.alibaba.fastjson.JSON.parseObject(JSON.java:282) at com.alibaba.fastjson.JSON.parseObject(JSON.java:555) at net.ipip.ipdb.Reader.init(Reader.java:53) at net.ipip.ipdb.Reader.(Reader.java:25) at net.ipip.ipdb.Reader.(Reader.java:21) at net.ipip.ipdb.City.(City.java:17)

maven打包有没有做变量${XX}替换?有可能把ip库文件里的相同字符串给替换了